getPixelDensity.lua 1.0 KB

123456789101112131415161718192021222324252627
  1. return {
  2. summary = 'Get the pixel density of the Font.',
  3. description = [[
  4. Returns the pixel density of the font. The density is a "pixels per world unit" factor that
  5. controls how the pixels in the font's texture are mapped to units in the coordinate space.
  6. The default pixel density is set to the height of the font. This means that lines of text
  7. rendered with a scale of 1.0 come out to 1 unit (meter) tall. However, if this font was drawn
  8. to a 2D texture where the units are in pixels, the font would still be drawn 1 unit (pixel)
  9. tall! Scaling the coordinate space or the size of the text by the height of the font would fix
  10. this. However, a more convenient option is to set the pixel density of the font to 1.0 when
  11. doing 2D rendering to make the font's size match up with the pixels of the canvas.
  12. ]],
  13. arguments = {},
  14. returns = {
  15. density = {
  16. type = 'number',
  17. description = 'The pixel density of the font.'
  18. }
  19. },
  20. variants = {
  21. {
  22. arguments = {},
  23. returns = { 'density' }
  24. }
  25. }
  26. }