Class: DXRubyRP5::Font
- Inherits:
-
Object
- Object
- DXRubyRP5::Font
- Defined in:
- lib/dxruby_rp5/font.rb
Instance Attribute Summary collapse
-
#native ⇒ Object
readonly
Returns the value of attribute native.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
- #get_width(string) ⇒ Object (also: #getWidth)
-
#initialize(size, fontname = '', hash = {}) ⇒ Font
constructor
A new instance of Font.
Constructor Details
#initialize(size, fontname = '', hash = {}) ⇒ Font
Returns a new instance of Font.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/dxruby_rp5/font.rb', line 9 def initialize(size, fontname = '', hash = {}) @size = size # TODO: use fontname gothics = PFont.list.grep(/gothic/i) if gothics.any? ipa_gothics = gothics.grep(/ipa/i) if ipa_gothics.any? fontname = ipa_gothics.first else fontname = gothics.first end else fontname = PFont.list.first end @native = $app.create_font(fontname, @size) end |
Instance Attribute Details
#native ⇒ Object (readonly)
Returns the value of attribute native.
5 6 7 |
# File 'lib/dxruby_rp5/font.rb', line 5 def native @native end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
4 5 6 |
# File 'lib/dxruby_rp5/font.rb', line 4 def size @size end |
Instance Method Details
#get_width(string) ⇒ Object Also known as: getWidth
26 27 28 29 30 |
# File 'lib/dxruby_rp5/font.rb', line 26 def get_width(string) # TODO: $app.text_size(@size) return $app.text_width(string); end |