2
0

newFont.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. return {
  2. tag = 'graphics-objects',
  3. summary = 'Create a new Font.',
  4. description = 'Creates a new Font.',
  5. arguments = {
  6. filename = {
  7. type = 'string',
  8. description = 'A path to a TTF file.'
  9. },
  10. blob = {
  11. type = 'Blob',
  12. description = 'A Blob containing TTF file data.'
  13. },
  14. rasterizer = {
  15. type = 'Rasterizer',
  16. description = 'An existing Rasterizer to use to load glyph images.'
  17. },
  18. size = {
  19. type = 'number',
  20. default = '32',
  21. description = [[
  22. The size of the Font in pixels. Larger sizes are slower to initialize and use more memory,
  23. but have better quality.
  24. ]]
  25. },
  26. spread = {
  27. type = 'number',
  28. default = '4',
  29. description = [[
  30. For signed distance field fonts (currently all fonts), the width of the SDF, in pixels. The
  31. greater the distance the font is viewed from, the larger this value needs to be for the font
  32. to remain properly antialiased. Increasing this will have a performance penalty similar to
  33. increasing the size of the font.
  34. ]]
  35. }
  36. },
  37. returns = {
  38. font = {
  39. type = 'Font',
  40. description = 'The new Font.'
  41. }
  42. },
  43. variants = {
  44. {
  45. description = 'Creates a new Font from a TTF file.',
  46. arguments = { 'filename', 'size', 'spread' },
  47. returns = { 'font' }
  48. },
  49. {
  50. description = 'Creates a new Font from TTF data.',
  51. arguments = { 'blob', 'size', 'spread' },
  52. returns = { 'font' }
  53. },
  54. {
  55. description = 'Creates a new Font using the default typeface (Varela Round).',
  56. arguments = { 'size', 'spread' },
  57. returns = { 'font' }
  58. },
  59. {
  60. description = 'Creates a new Font from an existing Rasterizer.',
  61. arguments = { 'rasterizer', 'spread' },
  62. returns = { 'font' }
  63. }
  64. },
  65. related = {
  66. 'lovr.graphics.getDefaultFont',
  67. 'lovr.data.newRasterizer',
  68. 'Pass:text'
  69. }
  70. }