1"""fontTools.ttLib -- a package for dealing with TrueType fonts. 2 3This package offers translators to convert TrueType fonts to Python 4objects and vice versa, and additionally from Python to TTX (an XML-based 5text format) and vice versa. 6 7Example interactive session: 8 9Python 1.5.2c1 (#43, Mar 9 1999, 13:06:43) [CW PPC w/GUSI w/MSL] 10Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam 11>> from fontTools import ttLib 12>> tt = ttLib.TTFont("afont.ttf") 13>> tt['maxp'].numGlyphs 14242 15>> tt['OS/2'].achVendID 16'B&H\000' 17>> tt['head'].unitsPerEm 182048 19>> tt.saveXML("afont.ttx") 20Dumping 'LTSH' table... 21Dumping 'OS/2' table... 22Dumping 'VDMX' table... 23Dumping 'cmap' table... 24Dumping 'cvt ' table... 25Dumping 'fpgm' table... 26Dumping 'glyf' table... 27Dumping 'hdmx' table... 28Dumping 'head' table... 29Dumping 'hhea' table... 30Dumping 'hmtx' table... 31Dumping 'loca' table... 32Dumping 'maxp' table... 33Dumping 'name' table... 34Dumping 'post' table... 35Dumping 'prep' table... 36>> tt2 = ttLib.TTFont() 37>> tt2.importXML("afont.ttx") 38>> tt2['maxp'].numGlyphs 39242 40>> 41 42""" 43 44from __future__ import print_function, division, absolute_import 45from fontTools.misc.py23 import * 46from fontTools.misc.loggingTools import deprecateFunction 47import logging 48 49 50log = logging.getLogger(__name__) 51 52class TTLibError(Exception): pass 53 54@deprecateFunction("use logging instead", category=DeprecationWarning) 55def debugmsg(msg): 56 import time 57 print(msg + time.strftime(" (%H:%M:%S)", time.localtime(time.time()))) 58 59from fontTools.ttLib.ttFont import * 60from fontTools.ttLib.ttCollection import TTCollection 61