Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TYP: Make glyph indices distinct from character codes#30143

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
QuLogic wants to merge3 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromQuLogic:character-glyph-types

Conversation

QuLogic
Copy link
Member

PR summary

Previously, these were both typed asint, which means you could mix and match them erroneously. While the character code can't be made a distinct type (because it's used forchr/ord), typing glyph indices as a distinct type means these can't be fully swapped.

Unfortunately, you can still go back to the base type, so glyph indices still work as character codes. But this is still sufficient to catch errors such as the wrong call toFT2Font.get_kerning in_mathtext.py.

This depends on#30134.

PR checklist

Also, check some expected conditions at parse time instead of somewhereduring use of the data.
Previously, these were both typed as `int`, which means you could mixand match them erroneously. While the character code can't be made adistinct type (because it's used for `chr`/`ord`), typing glyph indicesas a distinct type means these can't be fully swapped.Unfortunately, you can still go back to the base type, so glyph indicesstill work as character codes. But this is still sufficient to catcherrors such as the wrong call to `FT2Font.get_kerning` in`_mathtext.py`.
@QuLogic
Copy link
MemberAuthor

But this is still sufficient to catch errors such as the wrong call toFT2Font.get_kerning in_mathtext.py.

Note, fixing this would require updating 20 images (for very minimal changes), which I originally rolled into#29816, but it could be moved here.

@QuLogicQuLogic moved this toWaiting for other PR inFont and text overhaulJun 5, 2025
@QuLogicQuLogic added this to thev3.11.0 milestoneJun 5, 2025
The `FontInfo.num` value returned by `TruetypeFonts._get_info` is acharacter code, but `FT2Font.get_kerning` takes *glyph indices*, meaningthat kerning was likely off in most cases.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
Status: Waiting for other PR
Milestone
v3.11.0
Development

Successfully merging this pull request may close these issues.

1 participant
@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp