font.bmx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. Strict
  2. Module BRL.Font
  3. ModuleInfo "Version: 1.05"
  4. ModuleInfo "Author: Mark Sibly"
  5. ModuleInfo "License: zlib/libpng"
  6. ModuleInfo "Copyright: Blitz Research Ltd"
  7. ModuleInfo "Modserver: BRL"
  8. ModuleInfo "History: 1.05 Release"
  9. ModuleInfo "History: Modified interface for improved unicode support"
  10. Const BOLDFONT=1
  11. Const ITALICFONT=2
  12. Const SMOOTHFONT=4
  13. Type TGlyph
  14. Method Pixels:Object() Abstract
  15. Method Advance#() Abstract
  16. Method GetRect( x Var,y Var,width Var,height Var ) Abstract
  17. End Type
  18. Type TFont
  19. Method Style() Abstract
  20. Method Height() Abstract
  21. Method CountGlyphs() Abstract
  22. Method CharToGlyph( char ) Abstract
  23. Method LoadGlyph:TGlyph( index ) Abstract
  24. End Type
  25. Type TFontLoader
  26. Field _succ:TFontLoader
  27. Method LoadFont:TFont( url:Object,size,style ) Abstract
  28. End Type
  29. Private
  30. Global _loaders:TFontloader
  31. Public
  32. Function AddFontLoader( loader:TFontLoader )
  33. If loader._succ Return
  34. loader._succ=_loaders
  35. _loaders=loader
  36. End Function
  37. Function LoadFont:TFont( url:Object,size,style=SMOOTHFONT )
  38. Local loader:TFontLoader=_loaders
  39. While loader
  40. Local font:TFont=loader.LoadFont( url,size,style )
  41. If font Return font
  42. loader=loader._succ
  43. Wend
  44. End Function