natiny_font_get_atlas

C
NatinyTexture natiny_font_get_atlas(NatinyFont font);

Returns the texture the font's glyphs are baked into.

Parameters

Name Type Description
font NatinyFont Font handle from natiny_font_create

Returns

Type Description
NatinyTexture Texture handle, or 0 for an invalid font

Example

C
NatinyTexture atlas = natiny_font_get_atlas(font);
natiny_render_texture(atlas, 0.0f, 0.0f, 256.0f, 256.0f);

Notes

  • The returned handle is compatible with texture and render APIs.
  • The texture contains white glyphs with alpha coverage, so rendering it is tinted by the current draw color.
  • The font owns the texture. Do not pass it to natiny_texture_destroy or modify it with natiny_texture_update.
  • Glyphs are added on demand. A display-scale change may replace the atlas contents, invalidating coordinates returned by natiny_font_get_glyph.
  • A fallback font has an atlas of its own.