git.lucas.co / Myna
git clone https://git.lucas.co/Myna.git

changeheight.py (572B)

 1 import fontforge
 2 
 3 font = fontforge.open("Myna-Regular.sfd")
 4 
 5 ascent  = font.ascent
 6 descent = font.descent
 7 
 8 RATIO = 0.9
 9 
10 # general
11 font.ascent  = int(font.ascent * RATIO)
12 font.descent = int(font.descent * RATIO)
13 
14 # hhea
15 font.hhea_ascent  = int(font.hhea_ascent * RATIO)
16 font.hhea_descent = int(font.hhea_descent * RATIO)
17 
18 # OS/2 typo
19 font.os2_typoascent  = font.hhea_ascent
20 font.os2_typodescent = font.hhea_descent
21 
22 # OS/2 win
23 font.os2_winascent = ascent # can increase or decrease this if clipped 
24 font.os2_windescent = descent
25 
26 font.save("Myna-Regular.sfd")
27 font.close()