我正在使用字体伪造创建一个字体与连接,有些使用数字在其中。我可以让纯粹字母的连接很好,但是当我使用数字时,它会抛出一个错误。
这是我到目前为止掌握的代码:
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()但是,当我将字符串‘评论员多个’改为‘评论员多个128’时,它会抛出一个错误:
查找子表包含未使用的字形1,使整个子表无效。
其中'1‘是字符串中的第一个数字。当我调用addPosSub()时会引发此错误
我怎样才能把数字加到连体上呢?
发布于 2016-02-17 09:53:38
元组需要包含要替换的符号的名称。
liga = ('a','one', 'Delta')
icon.addPosSub("liga", liga)您的符号应该使用Adobe字形表命名。
数字必须是姓名:
0 = zero
1 = one
2 = two
3 = three
4 = four
5 = five
6 = six
7 = seven
8 = eight
9 = ninehttps://stackoverflow.com/questions/33577046
复制相似问题