Handle implicit CFF2 closePath within T2OutlineExtractor
This commit is contained in:
parent
169731c7f5
commit
520ee0236d
@ -502,11 +502,20 @@ class T2OutlineExtractor(T2WidthExtractor):
|
||||
T2WidthExtractor.__init__(
|
||||
self, localSubrs, globalSubrs, nominalWidthX, defaultWidthX, private)
|
||||
self.pen = pen
|
||||
self.subrLevel = 0
|
||||
|
||||
def reset(self):
|
||||
T2WidthExtractor.reset(self)
|
||||
self.currentPoint = (0, 0)
|
||||
self.sawMoveTo = 0
|
||||
self.subrLevel = 0
|
||||
|
||||
def execute(self, charString):
|
||||
self.subrLevel += 1
|
||||
super().execute(charString)
|
||||
self.subrLevel -= 1
|
||||
if self.subrLevel == 0:
|
||||
self.endPath()
|
||||
|
||||
def _nextPoint(self, point):
|
||||
x, y = self.currentPoint
|
||||
@ -536,7 +545,10 @@ class T2OutlineExtractor(T2WidthExtractor):
|
||||
|
||||
def endPath(self):
|
||||
# In T2 there are no open paths, so always do a closePath when
|
||||
# finishing a sub path.
|
||||
# finishing a sub path. We avoid spurious calls to closePath()
|
||||
# because its a real T1 op we're emulating in T2 whereas
|
||||
# endPath() is just a means to that emulation
|
||||
if self.sawMoveTo:
|
||||
self.closePath()
|
||||
|
||||
#
|
||||
@ -980,7 +992,6 @@ class T2CharString(object):
|
||||
self.private.nominalWidthX, self.private.defaultWidthX,
|
||||
self.private)
|
||||
extractor.execute(self)
|
||||
extractor.endPath()
|
||||
self.width = extractor.width
|
||||
|
||||
def calcBounds(self, glyphSet):
|
||||
|
Loading…
x
Reference in New Issue
Block a user