@@ -247,11 +247,23 @@ def autokern(font):
247247 font .addLookupSubtable ('kerning' , 'kern' )
248248
249249 def kern (sep , left , right , ** kwargs ):
250- """Wraps font.autoKern: binds the subtable and expands accented variants."""
251- font .autoKern ('kern' , sep ,
252- _expand_with_variants (font , left ),
253- _expand_with_variants (font , right ),
254- ** kwargs )
250+ """Wraps font.autoKern: expands accented variants and leading/trailing ligatures."""
251+ def expand (chars , left_side ):
252+ expanded = _expand_with_variants (font , chars )
253+ seen = set (expanded )
254+ for glyph in font .glyphs ():
255+ name = glyph .glyphname
256+ if '_' not in name :
257+ continue
258+ parts = name .split ('_' )
259+ # Left side: ligature's right edge (last component) determines spacing.
260+ # Right side: ligature's left edge (first component) determines spacing.
261+ anchor = parts [- 1 ] if left_side else parts [0 ]
262+ if anchor in seen and name not in seen :
263+ expanded .append (name )
264+ seen .add (name )
265+ return expanded
266+ font .autoKern ('kern' , sep , expand (left , left_side = True ), expand (right , left_side = False ), ** kwargs )
255267
256268 kern (150 , ['/' , '\\ ' ], ['/' , '\\ ' ])
257269
@@ -274,10 +286,13 @@ def kern(sep, left, right, **kwargs):
274286 kern (220 , all_chars , ['j' ], minKern = 35 )
275287 # F/E are separated from T/J so they can use a tighter target gap.
276288 kern (130 , ['F' ], all_chars )
289+ kern (140 , ['E' ], ['V' , 'W' , 'Y' ])
277290 kern (100 , ['E' ], all_chars )
278- kern (150 , ['T' , 'J' , 'T_T' , 'T_O' ], all_chars )
291+ kern (120 , ['T' , 'J' ], ['R' ])
292+ kern (150 , ['T' , 'J' ], all_chars )
279293 # C: loosen from the default (was too tight for Ct/Cf/Cj).
280294 kern (65 , ['C' ], all_chars )
295+ kern (60 , ['O' ], all_chars )
281296
282297
283298font = basic_font ()
0 commit comments