@@ -36,7 +36,7 @@ def get_font_report(fontpath):
36
36
37
37
# Bit flag checks
38
38
fsselection_bit6_mask = 1 << 6
39
- fsselection_bit6_set = (tt [' OS/2' ].fsSelection & fsselection_bit6_mask ) != 0
39
+ fsselection_bit6_set = (tt [" OS/2" ].fsSelection & fsselection_bit6_mask ) != 0
40
40
41
41
# Calculated values
42
42
os2_typo_total_height = os2_typo_ascender + - (os2_typo_descender )
@@ -45,7 +45,9 @@ def get_font_report(fontpath):
45
45
46
46
hhea_btb_distance = hhea_total_height + hhea_linegap
47
47
typo_btb_distance = os2_typo_total_height + os2_typo_linegap
48
- win_external_leading = hhea_linegap - ((os2_win_ascent + os2_win_descent ) - (hhea_ascent - hhea_descent ))
48
+ win_external_leading = hhea_linegap - (
49
+ (os2_win_ascent + os2_win_descent ) - (hhea_ascent - hhea_descent )
50
+ )
49
51
if win_external_leading < 0 :
50
52
win_external_leading = 0
51
53
win_btb_distance = os2_win_ascent + os2_win_descent + win_external_leading
@@ -86,20 +88,29 @@ def get_font_report(fontpath):
86
88
87
89
report .append ("--- Ascent to Descent Calculations ---" )
88
90
report .append ("[hhea] Ascent to Descent: {}" .format (hhea_total_height ))
89
- report .append ("[OS/2] TypoAscender to TypoDescender: {}" .format (os2_typo_total_height )
91
+ report .append (
92
+ "[OS/2] TypoAscender to TypoDescender: {}" .format (os2_typo_total_height )
93
+ )
94
+ report .append (
95
+ "[OS/2] WinAscent to WinDescent: {}" .format (os2_win_total_height )
90
96
)
91
- report .append ("[OS/2] WinAscent to WinDescent: {}" .format (os2_win_total_height ))
92
97
report .append ("" )
93
98
94
99
report .append ("--- Delta Values ---" )
95
100
report .append (
96
- "[hhea] Ascent to [OS/2] TypoAscender: {}" .format (hhea_ascent - os2_typo_ascender )
101
+ "[hhea] Ascent to [OS/2] TypoAscender: {}" .format (
102
+ hhea_ascent - os2_typo_ascender
103
+ )
97
104
)
98
105
report .append (
99
- "[hhea] Descent : [OS/2] TypoDescender: {}" .format (os2_typo_descender - hhea_descent )
106
+ "[hhea] Descent : [OS/2] TypoDescender: {}" .format (
107
+ os2_typo_descender - hhea_descent
108
+ )
100
109
)
101
110
report .append (
102
- "[OS/2] WinAscent to [OS/2] TypoAscender: {}" .format (os2_win_ascent - os2_typo_ascender )
111
+ "[OS/2] WinAscent to [OS/2] TypoAscender: {}" .format (
112
+ os2_win_ascent - os2_typo_ascender
113
+ )
103
114
)
104
115
report .append (
105
116
"[OS/2] WinDescent to [OS/2] TypoDescender: {}" .format (
@@ -112,14 +123,15 @@ def get_font_report(fontpath):
112
123
report .append ("typo metrics: {}" .format (typo_btb_distance ))
113
124
report .append ("win metrics: {}" .format (win_btb_distance ))
114
125
report .append ("" )
115
- report .append ("[OS/2] fsSelection USE_TYPO_METRICS bit set: {}" .format (fsselection_bit6_set ))
126
+ report .append (
127
+ "[OS/2] fsSelection USE_TYPO_METRICS bit set: {}" .format (fsselection_bit6_set )
128
+ )
116
129
report .append ("" )
117
130
report .append ("--- Ratios ---" )
118
131
report .append ("hhea metrics / UPM: {0:.3g}" .format (hheaascdesc_to_upm ))
119
132
report .append ("typo metrics / UPM: {0:.3g}" .format (typo_to_upm ))
120
133
report .append ("win metrics / UPM: {0:.3g}" .format (winascdesc_to_upm ))
121
134
122
-
123
135
return "\n " .join (report )
124
136
125
137
0 commit comments