diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 05:10:50 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 05:10:50 +0000 |
commit | de4f7ff413777a1e54edb6b99f8f36f1c13736eb (patch) | |
tree | 9448f0d8e2fabdd010330dfb5491f1bcef442a90 /Lib/fontTools/misc/psCharStrings.py | |
parent | a52e6fdd1363dff2ec36c6799830b7e9ee7c0f8f (diff) | |
parent | 7fe79ddd4ba95175b23fc4bdd321b745cf142643 (diff) | |
download | fonttools-android14-mainline-uwb-release.tar.gz |
Snap for 10453563 from 7fe79ddd4ba95175b23fc4bdd321b745cf142643 to mainline-uwb-releaseaml_uwb_341710010aml_uwb_341513070aml_uwb_341511050aml_uwb_341310300aml_uwb_341310030aml_uwb_341111010aml_uwb_341011000android14-mainline-uwb-release
Change-Id: I8ecaa3886e4f3bfaa8892ad016630f85717ae9c4
Diffstat (limited to 'Lib/fontTools/misc/psCharStrings.py')
-rw-r--r-- | Lib/fontTools/misc/psCharStrings.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Lib/fontTools/misc/psCharStrings.py b/Lib/fontTools/misc/psCharStrings.py index 29c2d365..549dae25 100644 --- a/Lib/fontTools/misc/psCharStrings.py +++ b/Lib/fontTools/misc/psCharStrings.py @@ -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,8 +545,11 @@ class T2OutlineExtractor(T2WidthExtractor): def endPath(self): # In T2 there are no open paths, so always do a closePath when - # finishing a sub path. - self.closePath() + # 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() # # hint operators |