renamed _getTableData() to getTableData(); optimized getGlyphOrder() somewhat.
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@202 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
parent
f707463256
commit
cf4b3b3d9b
@ -42,7 +42,7 @@ Dumping 'prep' table...
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
#
|
#
|
||||||
# $Id: __init__.py,v 1.20 2002-05-04 22:04:02 jvr Exp $
|
# $Id: __init__.py,v 1.21 2002-05-05 09:48:31 jvr Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@ -324,25 +324,27 @@ class TTFont:
|
|||||||
self['glyf'].setGlyphOrder(glyphOrder)
|
self['glyf'].setGlyphOrder(glyphOrder)
|
||||||
|
|
||||||
def getGlyphOrder(self):
|
def getGlyphOrder(self):
|
||||||
if not hasattr(self, "glyphOrder"):
|
try:
|
||||||
if self.has_key('CFF '):
|
return self.glyphOrder
|
||||||
# CFF OpenType font
|
except AttributeError:
|
||||||
self.glyphOrder = self['CFF '].getGlyphOrder()
|
pass
|
||||||
elif self.has_key('post'):
|
if self.has_key('CFF '):
|
||||||
# TrueType font
|
# CFF OpenType font
|
||||||
glyphOrder = self['post'].getGlyphOrder()
|
self.glyphOrder = self['CFF '].getGlyphOrder()
|
||||||
if glyphOrder is None:
|
elif self.has_key('post'):
|
||||||
#
|
# TrueType font
|
||||||
# No names found in the 'post' table.
|
glyphOrder = self['post'].getGlyphOrder()
|
||||||
# Try to create glyph names from the unicode cmap (if available)
|
if glyphOrder is None:
|
||||||
# in combination with the Adobe Glyph List (AGL).
|
#
|
||||||
#
|
# No names found in the 'post' table.
|
||||||
self._getGlyphNamesFromCmap()
|
# Try to create glyph names from the unicode cmap (if available)
|
||||||
else:
|
# in combination with the Adobe Glyph List (AGL).
|
||||||
self.glyphOrder = glyphOrder
|
#
|
||||||
else:
|
|
||||||
self._getGlyphNamesFromCmap()
|
self._getGlyphNamesFromCmap()
|
||||||
# XXX what if a font contains 'glyf'/'post' table *and* CFF?
|
else:
|
||||||
|
self.glyphOrder = glyphOrder
|
||||||
|
else:
|
||||||
|
self._getGlyphNamesFromCmap()
|
||||||
return self.glyphOrder
|
return self.glyphOrder
|
||||||
|
|
||||||
def _getGlyphNamesFromCmap(self):
|
def _getGlyphNamesFromCmap(self):
|
||||||
@ -444,15 +446,14 @@ class TTFont:
|
|||||||
self._writeTable(masterTable, writer, done)
|
self._writeTable(masterTable, writer, done)
|
||||||
else:
|
else:
|
||||||
done.append(masterTable)
|
done.append(masterTable)
|
||||||
tabledata = self._getTableData(tag)
|
tabledata = self.getTableData(tag)
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
debugmsg("writing '%s' table to disk" % tag)
|
debugmsg("writing '%s' table to disk" % tag)
|
||||||
writer[tag] = tabledata
|
writer[tag] = tabledata
|
||||||
done.append(tag)
|
done.append(tag)
|
||||||
|
|
||||||
def _getTableData(self, tag):
|
def getTableData(self, tag):
|
||||||
"""Internal helper function. Returns raw table data,
|
"""Returns raw table data, whether compiled or directly read from disk.
|
||||||
whether compiled or directly read from disk.
|
|
||||||
"""
|
"""
|
||||||
if self.isLoaded(tag):
|
if self.isLoaded(tag):
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user