| | - Exception(BaseException)
- TTLibError
- GlyphOrder
- TTFont
- _TTGlyph
- _TTGlyphSet
classGlyphOrder | | Apseudotable.Theglyphorderisn‘tinthefontasaseparate table,butit‘snicetopresentitassuchintheTTXformat.
| | Methods defined here:
- __init__(self, tag)
- fromXML(self, (name, attrs, content), ttFont)
- toXML(self, writer, ttFont)
|
classTTFont | | Themainfontobject.Itmanagesfileinputandoutput,andoffers aconvenientwayofaccessingtables. Tableswillbeonlydecompiledwhenneccesary,ie.whenthey‘reactually accessed.Thismeansthatsimpleoperationscanbeextremelyfast.
| | Methods defined here:
- __contains__=has_key(self, tag)
- __delitem__(self, tag)
- __getitem__(self, tag)
- __init__(self, file=None, res_name_or_index=None, sfntVersion=‘\x00\x01\x00\x00‘, checkChecksums=0, verbose=0, recalcBBoxes=1, allowVID=0, ignoreDecompileErrors=False)
- Theconstructorcanbecalledwithafewdifferentarguments.
Whenreadingafontfromdisk,‘file‘shouldbeeitherapathname pointingtoafile,orareadablefileobject.
Itwe‘rerunningonaMacintosh,‘res_name_or_index‘maybeansfnt resourcenameoransfntresourceindexnumberorzero.Thelatter casewillcauseTTLibtoautodetectwhetherthefileisaflatfile orasuitcase.(Ifit‘sasuitcase,onlythefirst‘sfnt‘resource willberead!)
The‘checkChecksums‘argumentisusedtospecifyhowsfnt checksumsaretreateduponreadingafilefromdisk: 0:don‘tcheck(default) 1:check,printwarningsifawrongchecksumisfound 2:check,raiseanexceptionifawrongchecksumisfound.
TheTTFontconstructorcanalsobecalledwithouta‘file‘ argument:thisisthewaytocreateanewemptyfont. Inthiscaseyoucanoptionallysupplythe‘sfntVersion‘argument.
IftherecalcBBoxesargumentisfalse,anumberofthingswill*not* berecalculateduponsave/compile: 1)glyphboundingboxes 2)maxpfontboundingbox 3)hheamin/maxvalues (1)isneededforcertainkindsofCJKfonts(askWernerLemberg;-). Additionally,uponimportinganTTXfile,thisoptioncauseglyphs tobecompiledrightaway.Thisshouldreducememoryconsumption greatly,andthereforeshouldhavesomeimpactonthetimeneeded toparse/compilelargefonts.
IftheallowVIDargumentissettotrue,thenvirtualGID‘sare supported.AskingforaglyphIDwithaglyphnameorGIDthatisnotin thefontwillreturnavirtualGID.ThisisvalidforGSUBandcmap tables.ForSINGglyphlets,thecmaptableisusedtospecifyUnicode valuesforvirtualGI‘susedinGSUB/GPOSrules.IfthegidNisrequested anddoesnotexistinthefont,ortheglyphnamehastheformglyphN anddoesnotexistinthefont,thenNisusedasthevirtualGID. Else,thefirstvirtualGIDisassignedas0x1000-1;forsubsequentnew virtualGIDs,thenextisonelessthantheprevious.
IfignoreDecompileErrorsissettoTrue,exceptionsraisedin individualtablesduringdecompilationwillbeignored,falling backtotheDefaultTableimplementation,whichsimplykeepsthe binarydata.
- __len__(self)
- __setitem__(self, tag, table)
- close(self)
- Ifwestillhaveareaderobject,closeit.
- getGlyphID(self, glyphName, requireReal=0)
- getGlyphName(self, glyphID, requireReal=0)
- getGlyphNames(self)
- Getalistofglyphnames,sortedalphabetically.
- getGlyphNames2(self)
- Getalistofglyphnames,sortedalphabetically,
butnotcasesensitive.
- getGlyphOrder(self)
- getGlyphSet(self, preferCFF=1)
- ReturnagenericGlyphSet,whichisadict-likeobject
mappingglyphnamestoglyphobjects.Thereturnedglyphobjects havea.draw()methodthatsupportsthePenprotocol,andwill haveanattributenamed‘width‘,butonly*after*the.draw()method hasbeencalled.
IfthefontisCFF-based,theoutlineswillbetakenfromthe‘CFF‘ table.Otherwisetheoutlineswillbetakenfromthe‘glyf‘table. Ifthefontcontainsbotha‘CFF‘anda‘glyf‘table,youcanuse the‘preferCFF‘argumenttospecifywhichoneshouldbetaken.
- getReverseGlyphMap(self, rebuild=0)
- getTableData(self, tag)
- Returnsrawtabledata,whethercompiledordirectlyreadfromdisk.
- has_key(self, tag)
- importXML(self, file, progress=None)
- ImportaTTXfile(anXML-basedtextformat),soastorecreate
afontobject.
- isLoaded(self, tag)
- Returntrueifthetableidentifiedby‘tag‘hasbeen
decompiledandloadedintomemory.
- keys(self)
- save(self, file, makeSuitcase=0, reorderTables=1)
- Savethefonttodisk.Similarlytotheconstructor,
the‘file‘argumentcanbeeitherapathnameorawritable fileobject.
OntheMac,ifmakeSuitcaseistrue,asuitcase(resourcefork) filewillwemadeinsteadofaflat.ttffile.
- saveXML(self, fileOrPath, progress=None, tables=None, skipTables=None, splitTables=0, disassembleInstructions=1)
- ExportthefontasTTX(anXML-basedtextfile),orasaseriesoftext
fileswhensplitTablesistrue.Inthelattercase,the‘fileOrPath‘ argumentshouldbeapathtoadirectory. The‘tables‘argumentmusteitherbefalse(dumpalltables)ora listoftablestodump.The‘skipTables‘argumentmaybealistoftables toskip,butonlywhenthe‘tables‘argumentisfalse.
- setGlyphOrder(self, glyphOrder)
|
classTTLibError(Exception) | | | - Method resolution order:
- TTLibError
- Exception
- BaseException
- object
Data descriptors defined here:
- __weakref__
- listofweakreferencestotheobject(ifdefined)
Methods inherited fromException:
- __init__(...)
- x.__init__(...)initializesx;seex.__class__.__doc__forsignature
Data and other attributes inherited fromException:
- __new__= <built-in method __new__ of type object at 0x8108c0>
- T.__new__(S,...)->anewobjectwithtypeS,asubtypeofT
Methods inherited fromBaseException:
- __delattr__(...)
- x.__delattr__(‘name‘)<==>delx.name
- __getattribute__(...)
- x.__getattribute__(‘name‘)<==>x.name
- __getitem__(...)
- x.__getitem__(y)<==>x[y]
- __getslice__(...)
- x.__getslice__(i,j)<==>x[i:j]
Useofnegativeindicesisnotsupported.
- __reduce__(...)
- __repr__(...)
- x.__repr__()<==>repr(x)
- __setattr__(...)
- x.__setattr__(‘name‘,value)<==>x.name=value
- __setstate__(...)
- __str__(...)
- x.__str__()<==>str(x)
- __unicode__(...)
Data descriptors inherited fromBaseException:
- __dict__
- args
- message
|
class_TTGlyph | | WrapperforaTrueTypeglyphthatsupportsthePenprotocol,meaning thatithasa.draw()methodthattakesapenobjectasitsonly argument.Additionallythereisa‘width‘attribute.
| | Methods defined here:
- __init__(self, glyphName, ttFont)
- draw(self, pen)
- DrawtheglyphontoPen.SeefontTools.pens.basePenfordetails
howthatworks.
|
class_TTGlyphSet | | Genericdict-likeGlyphSetclass,meantasaTrueTypecounterpart toCFF‘sCharStringdict.SeeTTFont.getGlyphSet().
| | Methods defined here:
- __contains__=has_key(self, glyphName)
- __getitem__(self, glyphName)
- __init__(self, ttFont)
- get(self, glyphName, default=None)
- has_key(self, glyphName)
- keys(self)
|
|