Repository navigation
text-freetype2: Fix font index retrieval and increase texture buffer size; add support for Cyrillic characters in glyph caching - #13290
Open
reyohoho wants to merge 3 commits into
Conversation
Member
|
If these are distinct bug fixes, please split the commits. |
FcPatternGetInteger was called with value list index 1 instead of 0, requesting a non-existent second value. For TTC/OTC font collections where the matched face has a non-zero index, this caused the wrong face to be loaded — potentially one with incomplete character coverage, resulting in missing glyphs.
Increase the glyph texture atlas from 2048x2048 to 4096x4096. At larger font sizes the atlas overflows after caching standard Latin glyphs, causing cache_glyphs to break early with "Out of space". Uncached glyphs are then silently skipped in fill_vertex_buffer, producing missing characters.
Add Cyrillic uppercase and lowercase characters to cache_standard_glyphs alongside the existing ASCII Latin set, so they are available on first render without relying on on-demand caching.
reyohoho
force-pushed
the
fix_freetype2_text_sometimes_skips_letters
branch
from
April 5, 2026 05:49
7e9f2ca to
4d92dcf
Compare
vpacher
pushed a commit
to vpacher/obs-studio
that referenced
this pull request
Oct 18, 2026
…bs-rust#1411) * test/cmocka: Add failing test for a font that is not face 0 of its file The Text (FreeType 2) source on Linux loads the first face of a font file whatever face fontconfig matched (obsproject/obs-studio#11819). A face of a .ttc/.otc collection, such as Noto Sans CJK SC, TC or KR, or a named instance of a variable font, such as Adwaita Sans Bold, renders as face 0. test_text_freetype2_face_index points fontconfig at a directory that holds only text-collection.ttc, a two-face collection generated by test/cmocka/data/text-collection.py from synthetic outlines ("OBS Collection Fixture" Regular as face 0, Bold as face 1), and asks get_font_path() for each style. Fails 1 of 2: bold_resolves_to_face_1 ("Bold resolved to face 0 of .../text-collection.ttc (expected 1)"). Regular passes. Needs no display. Refs obs-rust#1409. * text-freetype2: Read the matched font's face index from fontconfig get_font_path() read FC_INDEX with FcPatternGetInteger(match, FC_INDEX, 1, ...). The third argument is the position among the property's values, and a matched pattern has one index, at position 0. The call always failed, fc_index kept its default 0, and FT_New_Face() loaded the first face of the file (obsproject/obs-studio#11819). So any font that is not face 0 of its file rendered as face 0: Bold and the other named instances of a variable font (Adwaita Sans Bold is index 458752 in AdwaitaSans-Regular.ttf), and the faces of a .ttc collection (Noto Sans CJK SC is face 2 of NotoSansCJK-Regular.ttc; it rendered as the JP face 0). Port of the first commit of obsproject/obs-studio#13290 by reyohoho. The other two commits there (a larger glyph atlas, pre-cached Cyrillic) are covered here by obs-rust#196's atlas fix and are not part of this change. test_text_freetype2_face_index: 2 of 2. In the app, Adwaita Sans Bold now renders bold (513 -> 525 px wide, ink 0.185 -> 0.273 at 96 px), and Noto Sans CJK SC renders the SC glyphs instead of JP's. Fixes obs-rust#1409. Co-Authored-By: reyohoho <[email protected]> --------- Co-authored-by: reyohoho <[email protected]>
This branch has not been deployed
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.
Description
Fix multiple issues in
text-freetype2that cause glyphs to be silently dropped on Linux:FC_INDEXretrieval in Fontconfig (find-font-unix.c):FcPatternGetIntegerwas called with value index1instead of0, requesting a non-existent second value. For TTC/OTC font collections, this caused the wrong face (with incomplete glyph coverage) to be loaded.text-freetype2.c): At larger font sizes (e.g. v2 default 256px), the atlas overflows after caching Latin glyphs.cache_glyphshitsbreakon "Out of space", andfill_vertex_bufferskips uncached glyphs — producing missing characters.cache_standard_glyphs(text-functionality.c): Only ASCII was pre-cached. Cyrillic letters are now included alongside Latin.Motivation and Context
Fixes #11819
On Linux,
text-freetype2renders strings with missing characters — especially Cyrillic. Windows is unaffected because it usestext-gdiplus, which has no fixed-size atlas.How Has This Been Tested?
text-freetype2.soon Arch Linux (GCC 15.2.1) against OBS 32.1.1 (Flatpak).SetInputSettings) renders completely."Out of space trying to render glyphs"warnings at font sizes up to 256px with mixed Latin/Cyrillic.Types of changes
Checklist: