Font.lua 687 B

12345678910111213141516171819202122232425262728293031323334353637
  1. class "Font"
  2. function Font:Font(...)
  3. for k,v in pairs(arg) do
  4. if type(v) == "table" then
  5. if v.__ptr ~= nil then
  6. arg[k] = v.__ptr
  7. end
  8. end
  9. end
  10. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  11. self.__ptr = Polycore.Font(unpack(arg))
  12. end
  13. end
  14. function Font:getFace()
  15. local retVal = Polycore.Font_getFace(self.__ptr)
  16. if Polycore.__ptr_lookup[retVal] ~= nil then
  17. return Polycore.__ptr_lookup[retVal]
  18. else
  19. Polycore.__ptr_lookup[retVal] = FT_Face("__skip_ptr__")
  20. Polycore.__ptr_lookup[retVal].__ptr = retVal
  21. return Polycore.__ptr_lookup[retVal]
  22. end
  23. end
  24. function Font:isValid()
  25. local retVal = Polycore.Font_isValid(self.__ptr)
  26. return retVal
  27. end