🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@QuLogic
Copy link
Member

@QuLogic QuLogic commented Sep 16, 2025

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

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))
Copy link
Member

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?

Copy link
Member

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.

@tacaswell
Copy link
Member

"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 \
Copy link
Member

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?

Copy link
Member Author

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.

@tacaswell
Copy link
Member

I am a bit confused by the sub-setting logic. I think I've lost track of "is implemented" vs "will be implemented".

@tacaswell
Copy link
Member

We understand both the macos 13 and mypy failures as unrelated.

@tacaswell tacaswell merged commit 43d5d4e into matplotlib:text-overhaul Sep 17, 2025
55 of 62 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Font and text overhaul Sep 17, 2025
@QuLogic QuLogic deleted the full-charmap-tracking branch September 17, 2025 01:37
@QuLogic
Copy link
Member Author

QuLogic commented Sep 17, 2025

We understand both the macos 13 and mypy failures as unrelated.

Yes, I'll merge main after the macOS CI is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants