Extra "ports" of juce-based plugins using the distrho build system
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2KB

  1. --- Font.
  2. -- Is a pointer to a [JUCE Font](http://www.juce.com/api/classFont.html).
  3. -- Can be used by @{juce.Graphics} for text operations.
  4. -- @classmod juce.Font
  5. ffi.cdef [[
  6. pFont Font_new(const char *typefaceName, float fontHeight, int styleFlags, bool hinted);
  7. void Font_delete(pFont f);
  8. ]]
  9. --- Constuctor.
  10. -- Caveat : on OSX and Linux, hinting only works for protoplug's
  11. -- built-in hinted fonts (`DejaVu Sans Mono` and `Source Code Pro`). On
  12. -- Windows it's available for every font. Cross-platform hinting is on the be
  13. -- todo list.
  14. -- @tparam string typefaceName
  15. -- @tparam number fontHeight
  16. -- @param[opt=0] styleFlags any combination of @{styles}
  17. -- @tparam[opt=false] bool hinted
  18. -- @within Constructors
  19. -- @constructor
  20. -- @function Font
  21. local Font = setmetatable({}, {
  22. __call = function (self, typefaceName, fontHeight, styleFlags, hinted)
  23. styleFlags = styleFlags or 0
  24. hinted = hinted or false;
  25. return ffi.gc(
  26. protolib.Font_new(typefaceName, fontHeight, styleFlags, hinted),
  27. protolib.Font_delete
  28. )
  29. end
  30. })
  31. --- Font styles.
  32. -- @table juce.Font.styles
  33. Font.styles = {
  34. plain = 0, -- `0`
  35. bold = 1, -- `1`
  36. italic = 2, -- `2`
  37. underlined = 4 -- `4`
  38. }
  39. return Font