natiny_font_set_filter

C
void natiny_font_set_filter(NatinyFont font, uint32_t min_filter,
                            uint32_t mag_filter);

Sets how the font's atlas is sampled.

Parameters

Name Type Description
font NatinyFont Font handle from natiny_font_create
min_filter uint32_t NATINY_FILTER_LINEAR or NATINY_FILTER_NEAREST
mag_filter uint32_t NATINY_FILTER_LINEAR or NATINY_FILTER_NEAREST

Example

C
natiny_font_set_filter(pixel_font,
                       NATINY_FILTER_NEAREST, NATINY_FILTER_NEAREST);

Notes

  • NATINY_FILTER_LINEAR is the default.
  • Anything that is not NATINY_FILTER_NEAREST is taken as NATINY_FILTER_LINEAR.
  • The setting survives an atlas re-bake.
  • Applies to this font's atlas only; a fallback font is filtered by its own setting.
  • The atlas has no mip chain, so min_filter matters only where text is drawn smaller than it was baked.