Font.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. require('Polycode/Resource')
  2. function Font(fileName,FTLibrary) {
  3. if(arguments[0] != "__skip_ptr__") {
  4. this.__ptr = Polycode.Font(fileName,FTLibrary)
  5. }
  6. Object.defineProperties(this, {
  7. 'loaded': { enumerable: true, configurable: true, get: Font.prototype.__get_loaded, set: Font.prototype.__set_loaded}
  8. })
  9. }
  10. Font.prototype = Object.create(Resource.prototype)
  11. Font.prototype.__get_loaded = function() {
  12. return Polycode.Font__get_loaded(this.__ptr)
  13. }
  14. Font.prototype.__set_loaded = function(val) {
  15. Polycode.Font__set_loaded(this.__ptr, val)
  16. }
  17. Duktape.fin(Font.prototype, function (x) {
  18. if (x === Font.prototype) {
  19. return;
  20. }
  21. Polycode.Font__delete(x.__ptr)
  22. })
  23. Font.prototype.getFace = function() {
  24. var retVal = new FT_Face("__skip_ptr__")
  25. retVal.__ptr = Polycode.Font_getFace(this.__ptr)
  26. return retVal
  27. }
  28. Font.prototype.isValid = function() {
  29. return Polycode.Font_isValid(this.__ptr)
  30. }
  31. Font.prototype.setFontName = function(fontName) {
  32. Polycode.Font_setFontName(this.__ptr, fontName)
  33. }
  34. Font.prototype.getFontName = function() {
  35. return Polycode.Font_getFontName(this.__ptr)
  36. }
  37. Font.prototype.getFontPath = function() {
  38. return Polycode.Font_getFontPath(this.__ptr)
  39. }