我用fontforge创建了一个带有连字的字体,有些还使用数字。不过,我可以用连字来处理,但是我可以用连字来处理。在
这是我目前掌握的代码:
import fontforge
font = fontforge.font()
font.encoding = 'UnicodeFull'
font.version = '1.0'
font.weight = 'Regular'
font.fontname = 'icon'
font.familyname = 'icon'
font.fullname = 'icon'
font.em = 1008
font.ascent = 864
font.descent = 144
# Set up ligatures
font.addLookup('liga', 'gsub_ligature', (), (('liga', (('latn', ('dflt')), )), ))
font.addLookupSubtable('liga', 'liga')
def createEmptyChar(font, char):
glyph = font.createChar(ord(char)).glyphPen()
glyph.moveTo((0, 0))
glyph = None
# Empty all characters to remove gibberish...
for code in range(0, 256):
createEmptyChar(font, chr(code))
# Name of ligature
name = str('commentsmultiple')
icon = font.createChar(-1, name)
icon.addPosSub("liga", tuple(name))
icon.importOutlines('fonts/icon/svg/e601_commentsmultiple128.svg')
font.generate('fonts/icon/icon.woff')
font.close()
但是,当我将字符串“commentsmultiple”更改为“commentsmultiple128”时,它会抛出一个错误:
Lookup subtable contains unused glyph 1 making the whole subtable invalid
其中“1”是字符串中的第一个数字。调用addposub()时引发此错误
如何给连字加数字?在
元组需要包含要替换的字形的名称。在
你的字形应该用Adobe Glyph List命名
数字必须是姓名:
^{pr2}$相关问题 更多 >
编程相关推荐