Skip to content

Commit 1e9392d

Browse files
committed
fix code ligature glyph widths when calt is applied to proportional fonts
1 parent f3110fd commit 1e9392d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

scripts/dlig2calt.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ def dlig2calt(fontPath, inplace=False):
2626

2727
font['hmtx'].__setitem__('LIG', font['hmtx']['space'])
2828

29+
# set /LIG glyph width to /equal width, not /space, to allow proportional fonts
30+
31+
# print(font['glyf']._getPhantomPoints('LIG', font['hmtx'].metrics))
32+
33+
# newPhantomPoints = [(0,0), (600,0), (0, 0), (0, 0)]
34+
35+
font['glyf']._setCoordinates('LIG', [(0,0), (600,0), (0, 0), (0, 0)], font['hmtx'].metrics)
36+
37+
2938
# update code ligature widths to be single units with left overhang
3039
for glyphName in font.getGlyphNames():
3140
if font['hmtx'][glyphName][0] > unitWidth:

0 commit comments

Comments
 (0)