getWidth.lua 953 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. return {
  2. summary = 'Get the width of rendered text.',
  3. description = [[
  4. Returns the maximum width of a piece of text. This function does not perform wrapping but does
  5. respect newlines in the text.
  6. ]],
  7. arguments = {
  8. string = {
  9. type = 'string',
  10. description = 'The text to measure.'
  11. },
  12. strings = {
  13. type = 'table',
  14. description = [[
  15. A table of colored strings, each given as a `{ color, string }` pair. The color can be a
  16. `Vec3`, `Vec4`, table, or hexcode.
  17. ]]
  18. },
  19. },
  20. returns = {
  21. width = {
  22. type = 'number',
  23. description = 'The maximum width of the text.'
  24. }
  25. },
  26. variants = {
  27. {
  28. arguments = { 'string' },
  29. returns = { 'width' }
  30. },
  31. {
  32. arguments = { 'strings' },
  33. returns = { 'width' }
  34. }
  35. },
  36. related = {
  37. 'Font:getAscent',
  38. 'Font:getDescent',
  39. 'Font:getHeight',
  40. 'Font:getKerning',
  41. 'Font:getLines'
  42. }
  43. }