It still wasn't right; I think the glyph order mess is now sufficiently cleaned up; at least compiling the result of ttdump -x glyf works again.

git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@265 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
jvr 2002-05-25 15:28:48 +00:00
parent 22f068929c
commit d57c4346e5
3 changed files with 8 additions and 18 deletions

View File

@ -42,7 +42,7 @@ Dumping 'prep' table...
""" """
# #
# $Id: __init__.py,v 1.33 2002-05-25 14:56:29 jvr Exp $ # $Id: __init__.py,v 1.34 2002-05-25 15:28:48 jvr Exp $
# #
import os import os
@ -258,10 +258,10 @@ class TTFont:
a font object. a font object.
""" """
if self.has_key("maxp") and self.has_key("post"): if self.has_key("maxp") and self.has_key("post"):
# Make sure the glyph order is loaded, as it otherwise may # Make sure the glyph order is loaded, as it otherwise gets
# get lost if the XML doesn't contain the glyph order, yet # lost if the XML doesn't contain the glyph order, yet does
# does contain the CFF table, which then can't be used to # contain the table which was originally used to extract the
# retrieve the glyph order. # glyph names from (ie. 'post', 'cmap' or 'CFF ').
self.getGlyphOrder() self.getGlyphOrder()
import xmlImport import xmlImport
xmlImport.importXML(self, file, progress) xmlImport.importXML(self, file, progress)
@ -342,10 +342,6 @@ class TTFont:
def setGlyphOrder(self, glyphOrder): def setGlyphOrder(self, glyphOrder):
self.glyphOrder = glyphOrder self.glyphOrder = glyphOrder
if self.has_key('CFF '):
self['CFF '].setGlyphOrder(glyphOrder)
if self.has_key('glyf'):
self['glyf'].setGlyphOrder(glyphOrder)
def getGlyphOrder(self): def getGlyphOrder(self):
try: try:

View File

@ -52,7 +52,7 @@ class table__g_l_y_f(DefaultTable.DefaultTable):
currentLocation = 0 currentLocation = 0
dataList = [] dataList = []
recalcBBoxes = ttFont.recalcBBoxes recalcBBoxes = ttFont.recalcBBoxes
for glyphName in ttFont.getGlyphOrder(): for glyphName in self.glyphOrder:
glyph = self.glyphs[glyphName] glyph = self.glyphs[glyphName]
glyphData = glyph.compile(self, recalcBBoxes) glyphData = glyph.compile(self, recalcBBoxes)
locations.append(currentLocation) locations.append(currentLocation)

View File

@ -78,14 +78,8 @@ class ExpatParser:
tableClass = ttLib.getTableClass(tag) tableClass = ttLib.getTableClass(tag)
if tableClass is None: if tableClass is None:
tableClass = DefaultTable tableClass = DefaultTable
if tag in ('post', 'loca') and self.ttFont.has_key(tag): if tag == 'loca' and self.ttFont.has_key(tag):
# Special-case 'post' to prevent a bootstrap problem with # Special-case the 'loca' table as we need the
# ttCompile.py -i:
# - import post table from XML
# - don't import glyf table from XML
# - the glyphOrder is in the *original* binary post table
# So: we can't throw away the original post table.
# Also special-case the 'laca' table as we need the
# original if the 'glyf' table isn't recompiled. # original if the 'glyf' table isn't recompiled.
self.currentTable = self.ttFont[tag] self.currentTable = self.ttFont[tag]
else: else: