Class: DXOpal::Font
- Inherits:
-
Object
- Object
- DXOpal::Font
- Defined in:
- opal/dxopal/font.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#_spec_str ⇒ Object
Return a string like “48px serif”.
- #fontname ⇒ Object
-
#initialize(size, fontname = nil, option = {}) ⇒ Font
constructor
A new instance of Font.
- #size ⇒ Object
Constructor Details
#initialize(size, fontname = nil, option = {}) ⇒ Font
Returns a new instance of Font
6 7 8 9 10 |
# File 'opal/dxopal/font.rb', line 6 def initialize(size, fontname=nil, option={}) @size = size @orig_fontname = fontname @fontname = fontname || "sans-serif" end |
Class Method Details
.default ⇒ Object
3 |
# File 'opal/dxopal/font.rb', line 3 def self.default; @@default ||= Font.new(24); end |
.default=(f) ⇒ Object
4 |
# File 'opal/dxopal/font.rb', line 4 def self.default=(f); @@default = f; end |
Instance Method Details
#_spec_str ⇒ Object
Return a string like “48px serif”
16 17 18 |
# File 'opal/dxopal/font.rb', line 16 def _spec_str "#{@size}px #{@fontname}" end |
#fontname ⇒ Object
13 |
# File 'opal/dxopal/font.rb', line 13 def fontname; @orig_fontname; end |
#size ⇒ Object
12 |
# File 'opal/dxopal/font.rb', line 12 def size; @size; end |