Repository navigation
Respect explicit BASIC layout in font_variant() - #10214
Merged
radarhere merged 3 commits intoOct 15, 2026
Merged
Conversation
radarhere
reviewed
Oct 15, 2026
radarhere
force-pushed
the
fix_font_variant_basic_layout
branch
from
October 15, 2026 22:12
c72b007 to
0887df3
Compare
radarhere
enabled auto-merge (squash)
October 15, 2026 22:26
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.
FreeTypeFont.font_variant(layout_engine=ImageFont.Layout.BASIC)silently keepsthe original font's Raqm engine.
Layout.BASIChas the value zero, so the currentlayout_engine or self.layout_engineexpression discards the explicit override.This changes shaping, kerning and text measurements despite the requested engine.
Changes proposed in this pull request:
None, consistentwith the other overrides in
font_variant().with a directly constructed font, and check that an omitted engine is inherited.
Measurements and reproduction script
The comparison uses generated text and the checkout's bundled DejaVu Sans font.
With FreeType 2.13.2 and Raqm 0.10.1, the copied font's advance for
AVATAR officechanges from 368.28125 px to the requested BASIC engine's 385 px. Its rendering
then matches a directly created BASIC font pixel for pixel. The proof files are
on a separate fork branch; this PR changes only the font implementation, tests
and release note.
Validation on Ubuntu 24.04, Python 3.12.3, built from
27af434ef326fd5f71e600ba39c86c5706526fc3with FreeType and Raqm enabled:python3 selftest.py: 59 passed.python3 -m pytest Tests/ -n 4 -q): 5,495 passed, 220 skipped,3 xfailed, no failures. Skipped cases include optional codecs, GUI bindings and platform-specific tests.
tox -e mypy: no issues in 303 source files.Prepared with AI assistance. Commit author: iAlturki.