Skip to content

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 intoobsproject:masterfrom
reyohoho:fix_freetype2_text_sometimes_skips_letters
Open

text-freetype2: Fix font index retrieval and increase texture buffer size; add support for Cyrillic characters in glyph caching#13290
reyohoho wants to merge 3 commits intoobsproject:masterfrom
reyohoho:fix_freetype2_text_sometimes_skips_letters

Conversation

@reyohoho
Copy link
Copy Markdown

@reyohoho reyohoho commented Apr 4, 2026

Description

Fix multiple issues in text-freetype2 that cause glyphs to be silently dropped on Linux:

  1. Fix FC_INDEX retrieval in Fontconfig (find-font-unix.c): FcPatternGetInteger was called with value index 1 instead of 0, requesting a non-existent second value. For TTC/OTC font collections, this caused the wrong face (with incomplete glyph coverage) to be loaded.
  2. Increase glyph atlas from 2048×2048 to 4096×4096 (text-freetype2.c): At larger font sizes (e.g. v2 default 256px), the atlas overflows after caching Latin glyphs. cache_glyphs hits break on "Out of space", and fill_vertex_buffer skips uncached glyphs — producing missing characters.
  3. Pre-cache Cyrillic in 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-freetype2 renders strings with missing characters — especially Cyrillic. Windows is unaffected because it uses text-gdiplus, which has no fixed-size atlas.

How Has This Been Tested?

  • Built patched text-freetype2.so on Arch Linux (GCC 15.2.1) against OBS 32.1.1 (Flatpak).
  • Cyrillic text via OBS WebSocket (SetInputSettings) renders completely.
  • No "Out of space trying to render glyphs" warnings at font sizes up to 256px with mixed Latin/Cyrillic.
  • Latin text unaffected.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@Fenrirthviti
Copy link
Copy Markdown
Member

If these are distinct bug fixes, please split the commits.

reyohoho added 3 commits April 5, 2026 08:46
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 reyohoho force-pushed the fix_freetype2_text_sometimes_skips_letters branch from 7e9f2ca to 4d92dcf Compare April 5, 2026 05:49
@reyohoho reyohoho changed the title text-freetype2: Fix font index retrieval and increase texture buffer … text-freetype2: Fix font index retrieval and increase texture buffer size; add support for Cyrillic characters in glyph caching Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Linux] FreeType2 text sometimes skips letters

2 participants