Issue: IECoreGL::Font – Expand glyph atlas to support Latin-1 characters
Repository: ImageEngine/cortex
Component: IECoreGL / IECoreScene (Font)
Type: Feature Request / Enhancement
Summary
IECoreGL::Font currently only supports ASCII characters (code points 0–127) in its glyph texture atlas. Characters from the Latin-1 Supplement range (128–255) — such as ñ, á, é, ü, ö, ç — are not rendered correctly. This prevents proper localisation of any Gaffer UI text rendered via OpenGL (node labels, nodule labels, tooltips in the graph canvas).
Current behaviour
The font rendering pipeline iterates over raw char values to index glyphs in a texture atlas laid out as a 16 × 8 grid (128 cells). When a string contains a multi-byte UTF-8 character (e.g. ñ = 0xC3 0xB1), each byte is treated as a separate glyph index, producing two incorrect glyphs instead of one correct one.
For example, rendering the Spanish string "Señal" displays something like "Se??al" or garbled symbols in place of ñ.
Expected behaviour
Characters in the Latin-1 Supplement range (U+0080–U+00FF) should render correctly. This would cover accented vowels, ñ/Ñ, ç/Ç, umlauts, and other characters essential for Western European languages (Spanish, French, German, Portuguese, Italian, etc.).
Proposed solution
Expand the glyph atlas from 16 × 8 (128 glyphs) to 16 × 16 (256 glyphs), covering the full Latin-1 range (ISO 8859-1). This involves:
-
IECoreScene::Font: Extend the character set used when building the glyph image from FreeType. Instead of iterating over code points 0–127, iterate over 0–255. Adjust the image dimensions and UV calculations accordingly.
-
IECoreGL::Font: Update the texture creation and sprite rendering to index into a 16 × 16 grid. The renderSprites() method should decode UTF-8 input to code points (or at minimum handle single-byte Latin-1) rather than iterating byte-by-byte over char values.
-
No changes needed in Gaffer itself — StandardStyle::renderText() already passes std::string to IECoreGL::Font::renderSprites(), so supporting wider characters is transparent once Cortex handles them.
Backward compatibility
- The atlas size change is internal; the public API remains the same.
- The bundled Bitstream Vera fonts (
Vera.ttf, VeraBd.ttf) already include Latin-1 glyphs, so no font file changes are required.
- Existing ASCII-only text renders identically — the first 128 cells in a 16 × 16 atlas are the same as the current 16 × 8 atlas.
Context
We are developing a Spanish localisation for Gaffer's UI. The translation framework (gettext-based, using _() wrappers in Python UI modules) is functional, but all text rendered through IECoreGL::Font must currently have diacritical marks stripped (á→a, ñ→n, etc.) to avoid rendering artefacts. This workaround produces readable but incorrect Spanish.
Languages affected by this limitation include at minimum: Spanish, French, German, Portuguese, Italian, Catalan, Swedish, Norwegian, Danish, Finnish, and any other language using Latin-1 characters.
Workaround in use
In our Gaffer i18n branch, we apply stripAccents() — a Unicode NFD decomposition that removes combining marks and replaces ñ→n — before any string reaches IECoreGL::Font::renderSprites(). This produces legible text but loses linguistic correctness (e.g. "año" → "ano", "señal" → "senal").
References
- Gaffer i18n branch: jonbragado/gaffer@feature/i18n-spanish
- Relevant Gaffer files:
GafferUI/StandardStyle.cpp (lines 608–641), GafferUI/i18n.py (stripAccents())
- Font files:
resources/fonts/Vera.ttf, resources/fonts/VeraBd.ttf (Bitstream Vera Sans — includes full Latin-1 coverage)
Issue: IECoreGL::Font – Expand glyph atlas to support Latin-1 characters
Repository: ImageEngine/cortex
Component: IECoreGL / IECoreScene (Font)
Type: Feature Request / Enhancement
Summary
IECoreGL::Fontcurrently only supports ASCII characters (code points 0–127) in its glyph texture atlas. Characters from the Latin-1 Supplement range (128–255) — such asñ,á,é,ü,ö,ç— are not rendered correctly. This prevents proper localisation of any Gaffer UI text rendered via OpenGL (node labels, nodule labels, tooltips in the graph canvas).Current behaviour
The font rendering pipeline iterates over raw
charvalues to index glyphs in a texture atlas laid out as a 16 × 8 grid (128 cells). When a string contains a multi-byte UTF-8 character (e.g.ñ=0xC3 0xB1), each byte is treated as a separate glyph index, producing two incorrect glyphs instead of one correct one.For example, rendering the Spanish string
"Señal"displays something like"Se??al"or garbled symbols in place ofñ.Expected behaviour
Characters in the Latin-1 Supplement range (U+0080–U+00FF) should render correctly. This would cover accented vowels,
ñ/Ñ,ç/Ç, umlauts, and other characters essential for Western European languages (Spanish, French, German, Portuguese, Italian, etc.).Proposed solution
Expand the glyph atlas from 16 × 8 (128 glyphs) to 16 × 16 (256 glyphs), covering the full Latin-1 range (ISO 8859-1). This involves:
IECoreScene::Font: Extend the character set used when building the glyph image from FreeType. Instead of iterating over code points 0–127, iterate over 0–255. Adjust the image dimensions and UV calculations accordingly.IECoreGL::Font: Update the texture creation and sprite rendering to index into a 16 × 16 grid. TherenderSprites()method should decode UTF-8 input to code points (or at minimum handle single-byte Latin-1) rather than iterating byte-by-byte overcharvalues.No changes needed in Gaffer itself —
StandardStyle::renderText()already passesstd::stringtoIECoreGL::Font::renderSprites(), so supporting wider characters is transparent once Cortex handles them.Backward compatibility
Vera.ttf,VeraBd.ttf) already include Latin-1 glyphs, so no font file changes are required.Context
We are developing a Spanish localisation for Gaffer's UI. The translation framework (gettext-based, using
_()wrappers in Python UI modules) is functional, but all text rendered throughIECoreGL::Fontmust currently have diacritical marks stripped (á→a,ñ→n, etc.) to avoid rendering artefacts. This workaround produces readable but incorrect Spanish.Languages affected by this limitation include at minimum: Spanish, French, German, Portuguese, Italian, Catalan, Swedish, Norwegian, Danish, Finnish, and any other language using Latin-1 characters.
Workaround in use
In our Gaffer i18n branch, we apply
stripAccents()— a Unicode NFD decomposition that removes combining marks and replacesñ→n— before any string reachesIECoreGL::Font::renderSprites(). This produces legible text but loses linguistic correctness (e.g."año"→"ano","señal"→"senal").References
GafferUI/StandardStyle.cpp(lines 608–641),GafferUI/i18n.py(stripAccents())resources/fonts/Vera.ttf,resources/fonts/VeraBd.ttf(Bitstream Vera Sans — includes full Latin-1 coverage)