getBoundingBox.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. return {
  2. summary = 'Get the bounding box of a glyph, or the font.',
  3. description = [[
  4. Returns the bounding box of a glyph, or the bounding box surrounding all glyphs. Note that font
  5. coordinates use a cartesian "y up" coordinate system.
  6. ]],
  7. arguments = {
  8. character = {
  9. type = 'string',
  10. description = 'A character.'
  11. },
  12. codepoint = {
  13. type = 'number',
  14. description = 'A codepoint.'
  15. }
  16. },
  17. returns = {
  18. x1 = {
  19. type = 'number',
  20. description = 'The left edge of the bounding box, in pixels.'
  21. },
  22. y1 = {
  23. type = 'number',
  24. description = 'The bottom edge of the bounding box, in pixels.'
  25. },
  26. x2 = {
  27. type = 'number',
  28. description = 'The right edge of the bounding box, in pixels.'
  29. },
  30. y2 = {
  31. type = 'number',
  32. description = 'The top edge of the bounding box, in pixels.'
  33. }
  34. },
  35. variants = {
  36. {
  37. arguments = { 'character' },
  38. returns = { 'x1', 'y1', 'x2', 'y2' }
  39. },
  40. {
  41. arguments = { 'codepoint' },
  42. returns = { 'x1', 'y1', 'x2', 'y2' }
  43. },
  44. {
  45. arguments = {},
  46. returns = { 'x1', 'y1', 'x2', 'y2' }
  47. }
  48. },
  49. related = {
  50. 'Rasterizer:getWidth',
  51. 'Rasterizer:getHeight',
  52. 'Rasterizer:getDimensions'
  53. }
  54. }