Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Text Rendering

GoudEngine renders text using TrueType fonts with glyph atlas caching for performance.

Text Component

Attach Text to an entity to render text.

FieldTypeDefaultDescription
contentString""Text to display
font_handleAssetHandle<FontAsset>TrueType font asset
bitmap_font_handleOption<AssetHandle<BitmapFontAsset>>NoneBitmap font (.fnt)
font_sizef3216.0Font size in pixels
colorColorwhiteText color (RGBA)
alignmentTextAlignmentLeftHorizontal alignment
max_widthOption<f32>NoneWord-wrap width
line_spacingf321.0Line height multiplier

Font Types

Two font formats are supported:

  • TrueType (TTF/OTF) — vector fonts loaded via FontAsset, rasterized into a glyph atlas at the requested size
  • Bitmap (.fnt) — pre-rendered sprite fonts loaded via BitmapFontAsset

Text Alignment

TextAlignment controls horizontal positioning:

  • Left — left edge aligned to entity position
  • Center — centered on entity position
  • Right — right edge aligned to entity position

Word Wrapping

Set max_width to enable word-wrapping. Text breaks at word boundaries when a line exceeds the specified width. The line_spacing multiplier controls vertical distance between lines.

Glyph Atlas

TrueType fonts are rasterized into a glyph atlas texture on first use. The atlas caches rendered glyphs to avoid per-frame rasterization. Different font sizes produce separate atlas entries.