cf_text_effect_set_font¶
Category: text
GitHub: cute_draw.h
Maps a text-effect code name to a loaded font for mid-string font swaps (e.g. bold/italic).
| Parameters | Description |
|---|---|
effect_name |
Text code name, e.g. "b" or "i". Used as <b>...</b> in cf_draw_text. |
font_name |
Name of a font previously loaded with cf_make_font / cf_make_font_from_memory. |
Remarks¶
Bold, italic, and other styles are separate font files -- load each face, then map it here.
If effect_name is not yet registered, a no-op effect is registered automatically so the
markup parses and renders. Glyph metrics (advance, kerning) come from the mapped font for
that span. Nested overrides use the innermost active font. When both a mapped font and a
<font name=...> markup apply, later (typically inner) overrides win.
Example:
cf_make_font("fonts/MyFont-Bold.ttf", "MyFont Bold");
cf_make_font("fonts/MyFont-Italic.ttf", "MyFont Italic");
cf_text_effect_set_font("b", "MyFont Bold");
cf_text_effect_set_font("i", "MyFont Italic");
cf_draw_text("Normal, <b>bold</b>, <i>italic</i>.", position, -1);
Related Pages¶
CF_TextEffect
cf_text_effect_register
cf_draw_text
cf_make_font