Fontforge Scripting how to add ligatures for a gly

2019-04-26 07:25发布

I'm making a font with scripting on Fontforge. Everything goes well, but I have this problem I don't know how to specify for a selected glyph that if two other glyphs came simultaneously show the selected glyph. I have already made the Lookuptable and the subtable for that but I don't know the function that would define some ligatures for a specified glyph. Here is the code for making table and subtable for adding ligatures to a glyph.

AddLookup("Ligatures","GSUB_ligature",9,[["rlig",[["arab",["dflt"]]]]])
AddLookupSubtable("Ligatures","Ligatureshi")

标签: fontforge
2条回答
Emotional °昔
2楼-- · 2019-04-26 07:46

After you've added the lookup & subtable, do this:

Select("fl")
AddPosSub("LigatureSubtableName", "f l")

The above FontForge script will add a fl ligature.

查看更多
成全新的幸福
3楼-- · 2019-04-26 07:47

You need to specify the Ligature substitution using a tuple of existing Glyph names. A contrived example:

ligature_name = 'f_l'
ligature_tuple = ('f', 'l')
font.AddLookup('ligatures','gsub_ligature', (),[['rlig',[['arab',['dflt']]]]])
font.AddLookupSubtable('ligatures', 'ligatureshi')
glyph = font.createChar(-1, ligature_name)
glyph.addPosSub('ligatureshi', ligature_tuple)
查看更多
登录 后发表回答