Quantcast
Channel: 极限社区 - 字体交流
Viewing all articles
Browse latest Browse all 2498

工具 Fontlab Flat Unicodes script

$
0
0
有的Glyph对应多个unicode,有时候我们需要拆开成独立的Glyph
下面的脚本干这个

代码:

#FLM: Flatten Unicodes
#Copyright 2013, HDH
#Free for everyone use

f = fl.font
if f == None:
  exit

print f.__doc__
exit
font = fl.font
glyphs = font.glyphs
for index in range(len(glyphs)):
        unicodes = glyphs[index].unicodes
        if len(unicodes)<=1:
                continue
        oldGlyph = glyphs[index]
        print oldGlyph.name
        for j in range(1,len(unicodes)) :
                newName =  "%s%X" % ("uni", unicodes[j])
                print newName
                newGlyph = Glyph(oldGlyph)
                newGlyph.name = newName
                newGlyph.unicodes = [unicodes[j]]
                glyphs.append(newGlyph)
        oldGlyph.unicodes = [unicodes[0]]

fl.UpdateFont()  # add this command update font


Viewing all articles
Browse latest Browse all 2498

Trending Articles