Repository navigation
Description
Upstream OBS bug, reported by iarspider in obsproject/obs-studio#11819 (confirmed upstream; a maintainer noted the log shows the source running out of glyph space). Code unchanged in this fork.
Location
plugins/text-freetype2/text-functionality.c:311-314 in cache_glyphs():
if (dy + g_h >= texbuf_h) {
blog(LOG_WARNING, "Out of space trying to render glyphs");
break;
}and text-functionality.c:166-168 in fill_vertex_buffer(), which skips any character with no cached glyph.
Class
Logic error: text silently drawn with letters missing.
Cause
Each Text (FreeType 2) source keeps one 2048x2048 glyph atlas. It is only emptied when the font or antialiasing changes (text-freetype2.c:431-434, :466-473), never when the text changes. Every new character is packed into the atlas and stays there. Once it is full, cache_glyphs() gives up and fill_vertex_buffer() drops every character that isn't cached, so all new letters disappear until the font is changed. It isn't specific to Cyrillic; any text that cycles through enough distinct characters fills it, faster at bigger sizes.
How it is reached
A Text (FreeType 2) source with default settings (256 px) whose text keeps changing, for example a "now playing" file. Replaying the reporter's attached title list (1055 titles, 136 distinct characters) through the plugin's packing logic with real FreeType glyphs:
- 256 px (the default): title fix(libobs): get_ue_golomb UB on a truncated SPS (1 << 32) #17 is the first to lose letters (about 3 minutes in at one title per 10 s, matching "after a few minutes"); 201 of 1055 titles lose letters
- 400 px: 540 titles lose letters, from the first one
- 32 px and 128 px: none
Proposed fix and failing test
Fix: when a glyph doesn't fit and the atlas holds glyphs from earlier texts, empty the atlas once and cache the current text again. A single text that can't fit even in an empty atlas still stops with the warning instead of retrying forever.
RED test (cmocka, test_glyph_atlas), with the packing logic moved into a small glyph-atlas.[ch] (FreeType rendering and the texture are callbacks, behaviour unchanged): fixed 10x10 glyphs in a 64x64 atlas.
new_text_after_full_atlas_is_drawn: fails today (a letter of the current text is never cached)texts_keep_rotating_without_losing_letters: fails today- guards that pass: glyphs are packed without overlap, already-cached glyphs aren't re-rendered, and
text_larger_than_atlas_is_not_retried_forever
With the fix all 5 pass, and the replay above loses no letters at 128, 256 or 400 px.
Not related to #121 (UTF-16 text files), which changes the file-loading code; the two merge cleanly.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 11, 2026
Claiming: this issue.
test_glyph_atlas(2 of 5 failing), packing logic moved intoglyph-atlas.[ch]with no behaviour change.First PR within a day.
text-freetype2: Evict old glyphs when the atlas is full
test/cmocka: Add RED FreeType 2 glyph atlas tests
rdoupe commentedon Oct 11, 2026
@iarspider @CyberRex0 you reported or hit this in obsproject/obs-studio#11819, so a heads-up: it's fixed here in obs-rust by #196.
Cause: each Text (FreeType 2) source caches every character it has drawn in one fixed-size glyph texture, and only empties it when the font changes. Once enough different characters have gone through (sooner at bigger sizes, e.g. the default 256 px), every new letter is silently dropped. Replaying the titles from the original report, letters start vanishing at about the 17th title.
Workaround on stock OBS: change the font (or toggle antialiasing) on the source, which empties the cache; a smaller font size makes it fill more slowly.
obs-rust is an AI-assisted fork of OBS; on Arch it's
obs-studio-rust-gitin the AUR.If you get a chance to try it, a short reply here on whether it fixes it for you would really help, especially if it does not. Your distro, OBS version, font and size are the useful details.