2
0

GlyphData.lua 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. class "GlyphData"
  2. function GlyphData:__getvar(name)
  3. if name == "num_glyphs" then
  4. local retVal = Polycode.GlyphData_get_num_glyphs(self.__ptr)
  5. if retVal == nil then return nil end
  6. local __c = _G["FT_UInt"]("__skip_ptr__")
  7. __c.__ptr = retVal
  8. return __c
  9. elseif name == "trailingAdvance" then
  10. return Polycode.GlyphData_get_trailingAdvance(self.__ptr)
  11. end
  12. end
  13. function GlyphData:__setvar(name,value)
  14. if name == "num_glyphs" then
  15. Polycode.GlyphData_set_num_glyphs(self.__ptr, value.__ptr)
  16. return true
  17. elseif name == "trailingAdvance" then
  18. Polycode.GlyphData_set_trailingAdvance(self.__ptr, value)
  19. return true
  20. end
  21. return false
  22. end
  23. function GlyphData:GlyphData(...)
  24. local arg = {...}
  25. for k,v in pairs(arg) do
  26. if type(v) == "table" then
  27. if v.__ptr ~= nil then
  28. arg[k] = v.__ptr
  29. end
  30. end
  31. end
  32. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  33. self.__ptr = Polycode.GlyphData(unpack(arg))
  34. end
  35. end
  36. function GlyphData:clearData()
  37. local retVal = Polycode.GlyphData_clearData(self.__ptr)
  38. end
  39. function GlyphData:__delete()
  40. if self then Polycode.delete_GlyphData(self.__ptr) end
  41. end