natiny.font.set_filter

Lua
natiny.font.set_filter(font, min_filter [, mag_filter])

Sets how the font's atlas is sampled.

Parameters

Name Type Default Description
font number Font handle from natiny.font.create
min_filter number natiny.font.FILTER_LINEAR or natiny.font.FILTER_NEAREST
mag_filter number min_filter natiny.font.FILTER_LINEAR or natiny.font.FILTER_NEAREST

Example

Lua
natiny.font.set_filter(pixel_font, natiny.font.FILTER_NEAREST)

Notes

  • natiny.font.FILTER_LINEAR is the default.
  • Omitting mag_filter applies min_filter to both operations.
  • Values other than natiny.font.FILTER_NEAREST select linear filtering.
  • 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.