Fix #134972: Do Not Render Text Characters in Control Code Range

Text characters in the CO Controls range, 0-31, are not meant to have
any displayable representation. For most Blender code this hasn't
mattered since we usually specifically exclude this range in text
processing. But for times when we don't we need to avoid rendering
glyphs in this range as some fonts contain blank (but not empty) items
here.

Pull Request: https://projects.blender.org/blender/blender/pulls/135013
This commit is contained in:
Harley Acheson
2025-02-23 22:19:09 +01:00
committed by Harley Acheson
parent 0013db5aef
commit 12b1f8bd7a

View File

@@ -1351,6 +1351,11 @@ static FT_GlyphSlot blf_glyph_render(FontBLF *settings_font,
GlyphBLF *blf_glyph_ensure(FontBLF *font, GlyphCacheBLF *gc, const uint charcode, uint8_t subpixel)
{
if (charcode < 32) {
/* Do not render C0 controls (U+0000 - U+001F) characters. #134972 */
return nullptr;
}
GlyphBLF *g = blf_glyph_cache_find_glyph(gc, charcode, subpixel);
if (g) {
return g;