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 — Use glyph indices for font tracking in vector formats by QuLogic · Pull Request #30335 · matplotlib/matplotlib

Conversation

@QuLogic

@QuLogic QuLogic commented Jul 19, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

PR summary

With libraqm, string layout produces glyph indices, not character codes, and font features may even produce different glyphs for the same character code (e.g., by picking a different Stylistic Set). Thus we cannot rely on character codes as unique items within a font, and must move toward glyph indices everywhere.

The only thing I don't quite like is that PDF uses character codes for its lookup, and I have to map glyph indices back through an inverse charmap. I think I may have to send everything through CharacterTracker and produce my own limited charmap, but still need to test out what's required. Better stuff for this is done in #30512.

This is based on #30143.

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 QuLogic added this to the v3.11.0 milestone Jul 19, 2025
@QuLogic QuLogic added this to Font and text overhaul Jul 19, 2025
@QuLogic QuLogic added the status: waiting for other PR label Jul 19, 2025
@github-project-automation github-project-automation Bot moved this to Waiting for other PR in Font and text overhaul Jul 19, 2025
@github-actions github-actions Bot added topic: text backend: ps backend: pdf backend: svg backend: cairo topic: text/fonts topic: text/mathtext labels Jul 19, 2025
@github-actions github-actions Bot added the status: needs rebase label Jul 31, 2025
@QuLogic
QuLogic force-pushed the vector-glyphs branch from 33418b6 to e2befff Compare August 23, 2025 09:40
@github-actions github-actions Bot removed topic: text/fonts status: needs rebase labels Aug 23, 2025
@QuLogic
QuLogic force-pushed the vector-glyphs branch 2 times, most recently from 4ca7af0 to e684f7b Compare August 27, 2025 02:21
@QuLogic QuLogic removed the status: waiting for other PR label Aug 27, 2025
@QuLogic
QuLogic marked this pull request as ready for review August 27, 2025 02:33
@QuLogic QuLogic moved this from Waiting for other PR to Ready for Review in Font and text overhaul Aug 27, 2025
@QuLogic
QuLogic force-pushed the vector-glyphs branch 3 times, most recently from 3d5e48c to a2db55c Compare August 30, 2025 05:37
@QuLogic
QuLogic force-pushed the vector-glyphs branch from a2db55c to 2118966 Compare September 4, 2025 04:31
@QuLogic

QuLogic commented Sep 4, 2025

Copy link
Copy Markdown
Member Author

I've decided to restore the character code in the return values from mathtext, because I've found some use for it in PDF output.

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 4, 2025
pdf: Improve text with characters outside embedded font limits #30512
Merged
4 tasks done
anntzer
anntzer reviewed Sep 4, 2025
View reviewed changes
Comment thread lib/matplotlib/_mathtext.py Resolved

Uh oh!

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

anntzer
anntzer reviewed Sep 5, 2025
View reviewed changes
Comment thread lib/matplotlib/_text_helpers.py Resolved

Uh oh!

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

anntzer
anntzer reviewed Sep 5, 2025
View reviewed changes
Comment thread lib/matplotlib/backends/_backend_pdf_ps.py Resolved

Uh oh!

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

anntzer
anntzer reviewed Sep 5, 2025
View reviewed changes
Comment thread lib/matplotlib/backends/backend_pdf.py Resolved

Uh oh!

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

anntzer
anntzer reviewed Sep 5, 2025
View reviewed changes
Comment thread lib/matplotlib/backends/backend_ps.py Resolved

Uh oh!

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

anntzer
anntzer reviewed Sep 5, 2025
View reviewed changes
Comment thread lib/matplotlib/textpath.py Resolved

Uh oh!

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

@QuLogic
QuLogic force-pushed the vector-glyphs branch 3 times, most recently from df7fa98 to 8de7f4e Compare September 13, 2025 20:28
@QuLogic
Use glyph indices for font tracking in vector formats
f630b48
With libraqm, string layout produces glyph indices, not character codes,
and font features may even produce different glyphs for the same
character code (e.g., by picking a different Stylistic Set). Thus we
cannot rely on character codes as unique items within a font, and must
move toward glyph indices everywhere.
@QuLogic
QuLogic force-pushed the vector-glyphs branch from 8de7f4e to f630b48 Compare September 16, 2025 04:25
anntzer
anntzer approved these changes Sep 16, 2025
View reviewed changes

@anntzer anntzer left a comment

Copy link
Copy Markdown
Contributor

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.

Looks like mypy is unhappy for unrelated reasons (beyond the disjoint bases issues) so that can probably be fixed as a separate PR.

Sorry, something went wrong.

Uh oh!

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

All reactions
@QuLogic

QuLogic commented Sep 16, 2025

Copy link
Copy Markdown
Member Author

I've rebased #30512 as well now. Of course, I wrote the change much after this one, but now it does seem like they go together quite well, so let me know if you want me to move the "pdf/ps: Track full character map in CharacterTracker" commit here to review together.

All reactions

Sorry, something went wrong.

Uh oh!

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

@anntzer

anntzer commented Sep 16, 2025

Copy link
Copy Markdown
Contributor

I don't really mind either way, the advantage of splitting things in smaller chunks is that once a PR is done we can just forget about it and move on to the next one (whereas if you add another patch here there's no easy way to state "the first commit is ready to go but the second still needs review"). More specifically, it seems to me that the UI of github is not really optimal in that reviews (and the approval process) are "PR-oriented" whereas for these large, multi-step PRs, it would be useful to have "commit-oriented" reviews. Given the current limitations I would suggest splitting the charmap tracking commit into its own PR (on top of this one) as well as I suspect (no guarantees) that it can also be approved quickly.

All reactions

Sorry, something went wrong.

Uh oh!

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

@anntzer

anntzer commented Sep 16, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Edit: I reviewed that commit and would approve it except for the two doc-related comments I've left.

All reactions

Sorry, something went wrong.

Uh oh!

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

@anntzer anntzer mentioned this pull request Sep 16, 2025
[ENH]: Backend versioning #30559
Closed
@QuLogic QuLogic mentioned this pull request Sep 16, 2025
pdf/ps: Track full character map in CharacterTracker #30566
Merged
1 task done
@QuLogic

QuLogic commented Sep 16, 2025

Copy link
Copy Markdown
Member Author

Given the current limitations I would suggest splitting the charmap tracking commit into its own PR (on top of this one) as well as I suspect (no guarantees) that it can also be approved quickly.

OK, I split that into #30566, and fixed the comments as well.

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 16, 2025
pdf: Merge loops for single byte text chunk output #30567
Merged
1 task done
@tacaswell
tacaswell merged commit d56936b into matplotlib:text-overhaul Sep 16, 2025
@github-project-automation github-project-automation Bot moved this from Ready for Review to Done in Font and text overhaul Sep 16, 2025
@QuLogic
QuLogic deleted the vector-glyphs branch September 17, 2025 00:10
wavebyrd pushed a commit to wavebyrd/matplotlib that referenced this pull request Mar 13, 2026
@tacaswell
Merge pull request matplotlib#30335 from QuLogic/vector-glyphs
a1db7d3
Use glyph indices for font tracking in vector formats
ksunden pushed a commit that referenced this pull request May 8, 2026
@QuLogic
Fix RendererCairo._draw_mathtext implementation
faf35f3
It wasn't updated to handle the change to `VectorParse` in #30335.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@anntzer anntzer anntzer approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

backend: cairo backend: pdf backend: ps backend: svg topic: text/mathtext topic: text

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 @anntzer @tacaswell
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.