1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

tools/sizes.py: Change Unicode box-drawing chars to that of double version (#8573)

Due to historical circumstances, some of light/heavy version of Unicode
box-drawing chars may have twice width of others (aka. "Zen-Kaku" in Japanese,
means full-square), eg. All of '─'(U+2500), '│'(U+2502), '└'(U+2514) and
'├'(U+251C) correspond to that in Windows Japanese fonts and locale.

Double versions, '═'(U+2550), '║'(U+2551), '╚'(U+255A) and '╠'(U+2560) are
not like that.

(See [Box Drawing, The Unicode Standard](https://www.unicode.org/charts/PDF/U2500.pdf))
This commit is contained in:
Takayuki 'January June' Suwa 2022-05-17 22:48:30 +09:00 committed by GitHub
parent fbba25cf65
commit fd9af97e00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -110,9 +110,9 @@ def safe_prefix(n, length):
def prefix(n, length): def prefix(n, length):
if n == length: if n == length:
return "└──" return "╚══"
return "├──" return "╠══"
def filter_segments(segments): def filter_segments(segments):
@ -159,7 +159,10 @@ def main():
number, used, segments = filter_segments(segments) number, used, segments = filter_segments(segments)
print(f". {group:<8}, used {used} / {total} bytes ({percentage(used, total)})") print(f". {group:<8}, used {used} / {total} bytes ({percentage(used, total)})")
print("| SEGMENT BYTES DESCRIPTION") try:
print("║ SEGMENT BYTES DESCRIPTION")
except UnicodeEncodeError:
print("| SEGMENT BYTES DESCRIPTION")
for n, segment, size in segments: for n, segment, size in segments:
try: try:
print(f"{prefix(n, number)} ", end="") print(f"{prefix(n, number)} ", end="")