Module: VER::Font
- Defined in:
- lib/ver/font.rb
Overview
FIXME:
If a font doesn't support, for example, underline, we will still create a
new font for it.
This means that there can be an infinite number of fonts with identical
options, yet we still try to create new instances because the actual
properties of the font don't equal the properties it was created with.
We might be able to fix this by storing the options used for creation with
the Font and comparing against them instead.
Class Attribute Summary collapse
-
.cache ⇒ Object
readonly
Returns the value of attribute cache.
Class Method Summary collapse
- .[](options) ⇒ Object
- .default ⇒ Object
- .default_options ⇒ Object
- .normalize_options(options) ⇒ Object
Class Attribute Details
.cache ⇒ Object (readonly)
Returns the value of attribute cache.
14 15 16 |
# File 'lib/ver/font.rb', line 14 def cache @cache end |
Class Method Details
.[](options) ⇒ Object
19 20 21 22 |
# File 'lib/ver/font.rb', line 19 def []() = () @cache[] ||= Tk::Font.new() end |
.default ⇒ Object
24 25 26 |
# File 'lib/ver/font.rb', line 24 def default VER..font end |
.default_options ⇒ Object
28 29 30 |
# File 'lib/ver/font.rb', line 28 def default ? default.actual_hash : {} end |
.normalize_options(options) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ver/font.rb', line 32 def () result = {} .each{|key, value| case key = key.to_s when 'family' result[key.to_sym] = value.to_s when 'weight', 'slant' result[key.to_sym] = value.to_sym when 'size' result[key.to_sym] = value.to_i when 'underline', 'overstrike' result[key.to_sym] = !!value end } result end |