Honor the Linux menu font face selected by Fontconfig #1371
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1371
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/linux-menu-font-index"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The Linux Insert menu asks Fontconfig for the file matching its regular and bold fonts. It opens face 0 even when Fontconfig selected a different face in a collection.
Read the file and index from the same match and pass the collection index to stb_truetype. The lower 16 bits select the collection face. Higher bits identify a named variable-font instance. See FreeType's face-index format.
Validation
The cause of the hollow boxes in #1279 remains unconfirmed.
Compatibility with #1405: that patch checks Latin glyph coverage, while this one opens the collection face chosen by Fontconfig. I resolved the overlapping lines in a temporary combined tree and ran the font-index, Latin-coverage and #1389 UTF-8 fixtures on Linux. All three passed. The combined test stub returns the face index and logs only the font pattern.
This landed in the v2.0.12 branch (merged there for testing; it reaches
mainwith that release), so closing. Thanks!Reopened: closing this was a mistake on my side. It was tested in the v2.0.12 branch, and it will be merged into main here, so it shows as merged. Sorry for the noise.
Looks right to me.
fc-matchnow returns the face index and the file in one call, and the index is masked with& 0xffffbefore it goes to stb, which is the right thing for a Fontconfig index that carries the named-instance bits. The parsing is careful. The test builds the real loader, is registered intests/run_all.pywith a Windows skip, and I could not find a bug.One heads-up for merge order: #1405 rewrites the same
fc_match(...)calls and theInitFontline inface_load(it adds:lang=enand a Latin-letter check), so whichever lands second has to rebase, and thelang=enpattern needs to move into theface_match(...)patterns. The two are compatible otherwise. Therun_all.pylines next to #1389 and #1405 will also need a trivial resolve.Nit: if the selected face fails to load there is no fallback to face 0. The hard-coded font paths follow, so it is harmless.