GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pdf/ps: Track full character map in CharacterTracker by QuLogic · Pull Request #30566 · matplotlib/matplotlib

Conversation

@QuLogic

@QuLogic QuLogic commented Sep 16, 2025

Copy link
Copy Markdown
Member

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

  • [n/a] "closes #0000" is in the body of the PR description to link the related issue
  • new and changed code is tested
  • [n/a] Plotting related features are demonstrated in an example
  • [n/a] New Features and API Changes are noted with a directive and release note
  • [n/a] Documentation complies with general and docstring guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@QuLogic
pdf/ps: Track full character map in CharacterTracker
f192c87
By tracking both character codes and glyph indices, we can handle
producing multiple font subsets if needed by a file format.
@QuLogic QuLogic added this to the v3.11.0 milestone Sep 16, 2025
@QuLogic QuLogic added the status: waiting for other PR label Sep 16, 2025
@QuLogic QuLogic added this to Font and text overhaul Sep 16, 2025
@github-project-automation github-project-automation Bot moved this to Waiting for other PR in Font and text overhaul Sep 16, 2025
@github-actions github-actions Bot added topic: text backend: ps backend: pdf backend: svg backend: cairo topic: text/mathtext labels Sep 16, 2025
@QuLogic QuLogic mentioned this pull request Sep 16, 2025
Use glyph indices for font tracking in vector formats #30335
Merged
1 task done
anntzer
anntzer approved these changes Sep 16, 2025
View reviewed changes
tacaswell
tacaswell reviewed Sep 16, 2025
View reviewed changes
Comment thread lib/matplotlib/backends/backend_pdf.py
glyphs = self._character_tracker.used.get(filename)
if glyphs:
fonts[Fx] = self.embedTTF(filename, glyphs)
charmap = self._character_tracker.used.get((filename, 0))

@tacaswell tacaswell Sep 16, 2025

Copy link
Copy Markdown
Member

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tacaswell tacaswell Sep 16, 2025

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tacaswell tacaswell closed this Sep 16, 2025
@github-project-automation github-project-automation Bot moved this from Waiting for other PR to Done in Font and text overhaul Sep 16, 2025
@tacaswell tacaswell reopened this Sep 16, 2025
@github-project-automation github-project-automation Bot moved this from Done to In Progress in Font and text overhaul Sep 16, 2025
@github-actions github-actions Bot removed topic: text backend: svg backend: cairo topic: text/mathtext labels Sep 16, 2025
@tacaswell

tacaswell commented Sep 16, 2025

Copy link
Copy Markdown
Member

"power cycled" to drop the already merged commit from the diff.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tacaswell
tacaswell reviewed Sep 16, 2025
View reviewed changes
Comment thread lib/matplotlib/backends/backend_ps.py
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 \

@tacaswell tacaswell Sep 16, 2025

Copy link
Copy Markdown
Member

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@QuLogic QuLogic Sep 17, 2025

Copy link
Copy Markdown
Member Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tacaswell

tacaswell commented Sep 16, 2025

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tacaswell tacaswell removed the status: waiting for other PR label Sep 17, 2025
@tacaswell

tacaswell commented Sep 17, 2025

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tacaswell
tacaswell merged commit 43d5d4e into matplotlib:text-overhaul Sep 17, 2025
@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

QuLogic commented Sep 17, 2025

Copy link
Copy Markdown
Member Author

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

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@QuLogic QuLogic mentioned this pull request Sep 17, 2025
pdf: Improve text with characters outside embedded font limits #30512
Merged
4 tasks done
wavebyrd pushed a commit to wavebyrd/matplotlib that referenced this pull request Mar 13, 2026
@tacaswell
Merge pull request matplotlib#30566 from QuLogic/full-charmap-tracking
c2d18b6
pdf/ps: Track full character map in CharacterTracker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@tacaswell tacaswell tacaswell left review comments
@anntzer anntzer anntzer approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

backend: pdf backend: ps

Projects

Font and text overhaul
Status: Done

Milestone

v3.11.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@QuLogic @tacaswell @anntzer
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.