Document and clarify _imagingft - #9908
Open
akx wants to merge 8 commits into
Open
Conversation
akx
force-pushed
the
ft-clarify
branch
3 times, most recently
from
August 26, 2026 19:25
23b2e18 to
aabb26a
Compare
Member
Looks to me like |
Contributor
Author
|
Er, yes..? The test passes (even on On even though the typings say they should be accepted: |
radarhere
reviewed
Aug 27, 2026
radarhere
reviewed
Aug 27, 2026
Member
|
Oh, right, most PR tests fail without the other changes, but that was not your intention here. |
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
Avoids a segfault when `encoding` and `font_bytes` weren't passed at all (they were left uninitialized)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refs #9898 - had to figure out what's happening in
_imagingftto get to the bottom of the kerning woes, and these came out of that. The actual bugfixes will be in another PR stacked on this.Basically:
FT_F26Dot6type (an alias tolong, since C doesn't have real newtypes, more's the shame) to make it more obvious to the reader.* 64s or<< 6s. Not truly type-safe since, well, see above about newtypes, but better than throwing magic numbers around._imagingft.pyi's types to match the reality of the module, and adds tests that prove that the typings were wrong.getfont()'s signature to make all arguments required (C interface is internal #9879 in mind, that should be fine to do), since callinggetfont()without encoding could handily segfault (sinceencodingin C was left uninitialized, set to stack garbage).