-
-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -826,7 +826,7 @@ def draw_mathtext(self, gc, x, y, s, prop, angle): | |
| f"{angle:g} rotate\n") | ||
| lastfont = None | ||
| for font, fontsize, ccode, glyph_index, ox, oy in glyphs: | ||
| self._character_tracker.track_glyph(font, glyph_index) | ||
| self._character_tracker.track_glyph(font, ccode, glyph_index) | ||
| if (font.postscript_name, fontsize) != lastfont: | ||
| lastfont = font.postscript_name, fontsize | ||
| self._pswriter.write( | ||
|
|
@@ -1069,18 +1069,19 @@ def print_figure_impl(fh): | |
| print("mpldict begin", file=fh) | ||
| print("\n".join(_psDefs), file=fh) | ||
| 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 \ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but we do loop here?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 This change here doesn't modify any logic, but just changes the loop to work over the new structure of the |
||
| ps_renderer._character_tracker.used.items(): | ||
| if not charmap: | ||
| continue | ||
| fonttype = mpl.rcParams['ps.fonttype'] | ||
| # Can't use more than 255 chars from a single Type 3 font. | ||
| if len(glyphs) > 255: | ||
| if len(charmap) > 255: | ||
| fonttype = 42 | ||
| fh.flush() | ||
| if fonttype == 3: | ||
| fh.write(_font_to_ps_type3(font_path, glyphs)) | ||
| fh.write(_font_to_ps_type3(font, charmap.values())) | ||
| else: # Type 42 only. | ||
| _font_to_ps_type42(font_path, glyphs, fh) | ||
| _font_to_ps_type42(font, charmap.values(), fh) | ||
| print("end", file=fh) | ||
| print("%%EndProlog", file=fh) | ||
|
|
||
|
|
||
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.