Class: DXOpal::Font

Inherits:
Object
  • Object
show all
Defined in:
opal/dxopal/font.rb

Class Method Summary collapse

Instance Method Summary collapse

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

.defaultObject



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_strObject

Return a string like “48px serif”



16
17
18
# File 'opal/dxopal/font.rb', line 16

def _spec_str
  "#{@size}px #{@fontname}"
end

#fontnameObject



13
# File 'opal/dxopal/font.rb', line 13

def fontname; @orig_fontname; end

#sizeObject



12
# File 'opal/dxopal/font.rb', line 12

def size; @size; end