ttf文件属性详细信息

python实现ttf文件属性详细信息

 1 import sys
 2 from fontTools import ttLib
 3 
 4 def shortName( font ):
 5     name = ""
 6
 7     ret = []
 8     for record in font['name'].names:
 9         if '\000' in record.string:
10             ret.append(unicode(record.string, 'utf-16-be').encode('utf-8'))
11         else:
12             ret.append(record.string)
13     return ret
14 
15 tt = ttLib.TTFont("SIMYOU.TTF")
16 print shortName(tt)

http://www.cnblogs.com/sjhrun2001/archive/2010/01/19/1651274.html

posted @ 2016-02-21 14:35  lyjsy  阅读(1630)  评论(0编辑  收藏  举报