init.lua 1.1 KB

12345678910111213141516171819202122232425
  1. return {
  2. summary = 'A Font used to render text.',
  3. description = [[
  4. Font objects are used to render text with `Pass:text`. The active font can be changed using
  5. `Pass:setFont`. The default font is Varela Round, which is used when no font is active, and can
  6. be retrieved using `lovr.graphics.getDefaultFont`. Custom fonts can be loaded from TTF files
  7. using `lovr.graphics.newFont`.
  8. Each Font uses a `Rasterizer` to load the TTF file and create images for each glyph. As text is
  9. drawn, the Font uploads images from the Rasterizer to a GPU texture atlas as needed. The Font
  10. also performs text layout and mesh generation for strings of text.
  11. LÖVR uses a text rendering technique called "multichannel signed distance fields" (MSDF), which
  12. makes the font rendering remain crisp when text is viewed up close.
  13. ]],
  14. constructors = {
  15. 'lovr.graphics.newFont',
  16. 'lovr.graphics.getDefaultFont'
  17. },
  18. notes = [[
  19. MSDF text requires a special shader to work. LÖVR will automatically switch to this shader if
  20. no shader is active on the `Pass`. This font shader is also available as a `DefaultShader`.
  21. ]]
  22. }