-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
pdf/ps: Track full character map in CharacterTracker #30566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pdf/ps: Track full character map in CharacterTracker #30566
Conversation
By tracking both character codes and glyph indices, we can handle producing multiple font subsets if needed by a file format.
| glyphs = self._character_tracker.used.get(filename) | ||
| if glyphs: | ||
| fonts[Fx] = self.embedTTF(filename, glyphs) | ||
| charmap = self._character_tracker.used.get((filename, 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to loop and add all the partitions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this looks like more prep work as I see we never set subset size.
|
"power cycled" to drop the already merged commit from the diff. |
| if not mpl.rcParams['ps.useafm']: | ||
| for font_path, glyphs in ps_renderer._character_tracker.used.items(): | ||
| if not glyphs: | ||
| for (font, subset_index), charmap in \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but we do loop here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PS is a little different from PDF in that it just dumps all the fonts in the CharacterTracker instance, while PDF has its own tracking of fonts, so it needs a bit more in-depth change (that continues on #30512.)
This change here doesn't modify any logic, but just changes the loop to work over the new structure of the .used attribute.
|
I am a bit confused by the sub-setting logic. I think I've lost track of "is implemented" vs "will be implemented". |
|
We understand both the macos 13 and mypy failures as unrelated. |
Yes, I'll merge |
PR summary
By tracking both character codes and glyph indices, we can handle producing multiple font subsets if needed by a file format.
This was split out of #30512, but based on #30335.
PR checklist