font.bmx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. SuperStrict
  2. Module BRL.Font
  3. ModuleInfo "Version: 1.06"
  4. ModuleInfo "Author: Mark Sibly"
  5. ModuleInfo "License: zlib/libpng"
  6. ModuleInfo "Copyright: Blitz Research Ltd"
  7. ModuleInfo "Modserver: BRL"
  8. ModuleInfo "History: 1.06"
  9. ModuleInfo "History: Module is now SuperStrict"
  10. ModuleInfo "History: 1.05 Release"
  11. ModuleInfo "History: Modified interface for improved unicode support"
  12. Const BOLDFONT:Int= $001
  13. Const ITALICFONT:Int=$002
  14. Const SMOOTHFONT:Int=$004
  15. Const SMALLCAPSFONT:Int= $0000100
  16. Const ALLSMALLCAPSFONT:Int= $0000200
  17. Const LIGATURESFONT:Int= $0000400
  18. Const DISCRETIONARYLIGATURESFONT:Int= $0000800
  19. Const OLDSTYLEFIGURESFONT:Int= $0001000
  20. Const TABULARFIGURESFONT:Int= $0002000
  21. Const FRACTIONSFONT:Int= $0004000
  22. Const SUPERSCRIPTFONT:Int= $0008000
  23. Const SUBSCRIPTFONT:Int= $0010000
  24. Const SWASHESFONT:Int= $0020000
  25. Const STYLISTICALTERNATESFONT:Int= $0040000
  26. Const CONTEXTUALALTERNATESFONT:Int= $0080000
  27. Const HISTORICALFORMSFONT:Int= $0100000
  28. Const DENOMINATORSFONT:Int= $0200000
  29. Const NUMERATORFONT:Int= $0400000
  30. Const LININGFIGURESFONT:Int= $0800000
  31. Const SCIENTIFICINFERIORSFONT:Int= $1000000
  32. Const PROPORTIONALFIGURESFONT:Int= $2000000
  33. Const KERNFONT:Int= $4000000
  34. Const ZEROFONT:Int= $8000000
  35. Type TGlyph
  36. Method Pixels:Object() Abstract
  37. Method Advance:Float() Abstract
  38. Method GetRect( x:Int Var,y:Int Var,width:Int Var,height:Int Var ) Abstract
  39. Method Index:Int() Abstract
  40. End Type
  41. Type TFont
  42. Method Style:Int() Abstract
  43. Method Height:Int() Abstract
  44. Method CountGlyphs:Int() Abstract
  45. Method CharToGlyph:Int( char:Int ) Abstract
  46. Method LoadGlyph:TGlyph( index:Int ) Abstract
  47. Method LoadGlyphs:TGlyph[]( text:String ) Abstract
  48. End Type
  49. Type TFontLoader
  50. Field _succ:TFontLoader
  51. Method LoadFont:TFont( url:Object,size:Float,style:Int ) Abstract
  52. End Type
  53. Private
  54. Global _loaders:TFontloader
  55. Public
  56. Function AddFontLoader( loader:TFontLoader )
  57. If loader._succ Return
  58. loader._succ=_loaders
  59. _loaders=loader
  60. End Function
  61. Function LoadFont:TFont( url:Object,size:Float,style:Int=SMOOTHFONT )
  62. Local loader:TFontLoader=_loaders
  63. While loader
  64. Local font:TFont=loader.LoadFont( url,size,style )
  65. If font Return font
  66. loader=loader._succ
  67. Wend
  68. End Function