natiny.font.set_letter_spacing

Lua
natiny.font.set_letter_spacing(font, spacing)

Sets an extra gap added after every glyph, in drawing units.

Parameters

Name Type Description
font number Font handle from natiny.font.create
spacing number Drawing units added after each glyph; must satisfy -1e9 < spacing < 1e9

Example

Lua
natiny.font.set_letter_spacing(font, 2)

Notes

  • Added after every glyph, including the final glyph.
  • Applies on top of kerning rather than replacing it: the pairs the face defines still tuck together, and this moves them all apart by the same amount.
  • Measuring, wrapping, hit-testing, and drawing all use the value.
  • Tab stops are four spaces wide, so they widen with it too.
  • Out-of-range values and NaN are ignored. The setting survives an atlas re-bake.