newFont.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. return {
  2. tag = 'graphicsObjects',
  3. summary = 'Create a new Font.',
  4. description = [[
  5. Creates a new Font. It can be used to render text with `lovr.graphics.print`.
  6. Currently, the only supported font format is TTF.
  7. ]],
  8. arguments = {
  9. filename = {
  10. type = 'string',
  11. description = 'The filename of the font file.'
  12. },
  13. size = {
  14. type = 'number',
  15. default = '32',
  16. description = 'The size of the font, in pixels.'
  17. },
  18. padding = {
  19. type = 'number',
  20. default = '2',
  21. description = 'The number of pixels of padding around each glyph.'
  22. },
  23. spread = {
  24. type = 'number',
  25. default = '4.0',
  26. description = 'The range of the distance field, in pixels.'
  27. },
  28. rasterizer = {
  29. type = 'Rasterizer',
  30. description = 'The existing Rasterizer object used to render the glyphs.'
  31. }
  32. },
  33. returns = {
  34. font = {
  35. type = 'Font',
  36. description = 'The new Font.'
  37. }
  38. },
  39. variants = {
  40. {
  41. arguments = { 'filename', 'size', 'padding', 'spread' },
  42. returns = { 'font' }
  43. },
  44. {
  45. description = 'Creates a new Font from the default font included with LÖVR (Varela Round).',
  46. arguments = { 'size', 'padding', 'spread' },
  47. returns = { 'font' }
  48. },
  49. {
  50. arguments = { 'rasterizer', 'padding', 'spread' },
  51. returns = { 'font' }
  52. }
  53. },
  54. notes = 'Larger font sizes will lead to more detailed curves at the cost of performance.'
  55. }