Skip to content

Commit c046b41

Browse files
committed
[commands] improve report formatting, fix alignment
1 parent d48376a commit c046b41

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

lib/fontline/commands.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ def get_font_report(fontpath):
2323
report.append("SHA1: " + metrics.sha1)
2424
report.append("")
2525
# The vertical metrics strings
26-
report.append("--- Metrics ---")
26+
report.append(":" * 50)
27+
report.append(" Metrics")
28+
report.append(":" * 50)
2729
report.append("[head] Units per Em: {}".format(metrics.units_per_em))
2830
report.append("[head] yMax: {}".format(metrics.ymax))
2931
report.append("[head] yMin: {}".format(metrics.ymin))
@@ -40,7 +42,9 @@ def get_font_report(fontpath):
4042
report.append("[OS/2] TypoLineGap: {}".format(metrics.os2_typo_linegap))
4143
report.append("")
4244

43-
report.append("--- Ascent to Descent Calculations ---")
45+
report.append(":" * 50)
46+
report.append(" Ascent to Descent Calculations")
47+
report.append(":" * 50)
4448
report.append(
4549
"[hhea] Ascent to Descent: {}".format(metrics.hhea_total_height)
4650
)
@@ -54,14 +58,16 @@ def get_font_report(fontpath):
5458
)
5559
report.append("")
5660

57-
report.append("--- Delta Values ---")
61+
report.append(":" * 50)
62+
report.append(" Delta Values")
63+
report.append(":" * 50)
5864
report.append(
5965
"[hhea] Ascent to [OS/2] TypoAscender: {}".format(
6066
metrics.hhea_ascent - metrics.os2_typo_ascender
6167
)
6268
)
6369
report.append(
64-
"[hhea] Descent to [OS/2] TypoDescender: {}".format(
70+
"[hhea] Descent to [OS/2] TypoDescender: {}".format(
6571
metrics.os2_typo_descender - metrics.hhea_descent
6672
)
6773
)
@@ -76,7 +82,9 @@ def get_font_report(fontpath):
7682
)
7783
)
7884
report.append("")
79-
report.append("--- Baseline to Baseline Distances ---")
85+
report.append(":" * 50)
86+
report.append(" Baseline to Baseline Distances")
87+
report.append(":" * 50)
8088
report.append("hhea metrics: {}".format(metrics.hhea_btb_distance))
8189
report.append("typo metrics: {}".format(metrics.typo_btb_distance))
8290
report.append("win metrics: {}".format(metrics.win_btb_distance))
@@ -87,7 +95,9 @@ def get_font_report(fontpath):
8795
)
8896
)
8997
report.append("")
90-
report.append("--- Ratios ---")
98+
report.append(":" * 50)
99+
report.append(" Ratios")
100+
report.append(":" * 50)
91101
report.append("hhea metrics / UPM: {0:.3g}".format(metrics.hheaascdesc_to_upm))
92102
report.append("typo metrics / UPM: {0:.3g}".format(metrics.typo_to_upm))
93103
report.append("win metrics / UPM: {0:.3g}".format(metrics.winascdesc_to_upm))

0 commit comments

Comments
 (0)