Module: SDL::TTF
- Extended by:
- NiceFFI::Library
- Defined in:
- lib/ruby-sdl-ffi/ttf.rb
Defined Under Namespace
Classes: Font
Constant Summary collapse
- UNICODE_BOM_NATIVE =
0xFEFF
- UNICODE_BOM_SWAPPED =
0xFFFE
- STYLE_NORMAL =
0x00
- STYLE_BOLD =
0x01
- STYLE_ITALIC =
0x02
- STYLE_UNDERLINE =
0x04
Class Method Summary collapse
-
.GlyphMetrics(font, char) ⇒ Object
- Returns
-
[minx, maxx, miny, maxy, advance], or nil on failure.
- .SizeText(font, text) ⇒ Object
- .SizeUNICODE(font, text) ⇒ Object
- .SizeUTF(font, text) ⇒ Object
- .ttf_func(name, args, ret) ⇒ Object
Class Method Details
.GlyphMetrics(font, char) ⇒ Object
- Returns
-
[minx, maxx, miny, maxy, advance], or nil on failure.
111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/ruby-sdl-ffi/ttf.rb', line 111 def self.GlyphMetrics( font, char ) minx, maxx = FFI::Buffer.new(:int), FFI::Buffer.new(:int) miny, maxy = FFI::Buffer.new(:int), FFI::Buffer.new(:int) advance = FFI::Buffer.new(:int) result = __GlyphMetrics( font, char, minx, maxx, miny, maxy, advance ) if( result == 0 ) return [minx.get_int(0), maxx.get_int(0), miny.get_int(0), maxy.get_int(0), advance.get_int(0)] else nil end end |
.SizeText(font, text) ⇒ Object
129 130 131 132 133 134 |
# File 'lib/ruby-sdl-ffi/ttf.rb', line 129 def self.SizeText( font, text ) w = FFI::Buffer.new( :int ) h = FFI::Buffer.new( :int ) __SizeText( font, text, w, h ) return [w.get_int(0),h.get_int(0)] end |
.SizeUNICODE(font, text) ⇒ Object
153 154 155 156 157 158 |
# File 'lib/ruby-sdl-ffi/ttf.rb', line 153 def self.SizeUNICODE( font, text ) w = FFI::Buffer.new( :int ) h = FFI::Buffer.new( :int ) __SizeUNICODE( font, text, w, h ) return [w.get_int(0),h.get_int(0)] end |
.SizeUTF(font, text) ⇒ Object
141 142 143 144 145 146 |
# File 'lib/ruby-sdl-ffi/ttf.rb', line 141 def self.SizeUTF( font, text ) w = FFI::Buffer.new( :int ) h = FFI::Buffer.new( :int ) __SizeUTF( font, text, w, h ) return [w.get_int(0),h.get_int(0)] end |
.ttf_func(name, args, ret) ⇒ Object
42 43 44 |
# File 'lib/ruby-sdl-ffi/ttf.rb', line 42 def self.ttf_func( name, args, ret ) func name, "TTF_#{name}", args, ret end |