Class: Hokusai::FontRegistry
- Inherits:
-
Object
- Object
- Hokusai::FontRegistry
- Defined in:
- ui/src/hokusai/font.rb
Instance Attribute Summary collapse
-
#active_font ⇒ Object
readonly
Returns the value of attribute active_font.
-
#fonts ⇒ Object
readonly
Returns the value of attribute fonts.
Instance Method Summary collapse
- #activate(name) ⇒ Object
- #active ⇒ Object
- #active_font_name ⇒ Object
- #get(name) ⇒ Object
-
#initialize ⇒ FontRegistry
constructor
A new instance of FontRegistry.
- #register(name, font) ⇒ Object
Constructor Details
#initialize ⇒ FontRegistry
Returns a new instance of FontRegistry.
249 250 251 252 |
# File 'ui/src/hokusai/font.rb', line 249 def initialize @fonts = {} @active_font = nil end |
Instance Attribute Details
#active_font ⇒ Object (readonly)
Returns the value of attribute active_font.
247 248 249 |
# File 'ui/src/hokusai/font.rb', line 247 def active_font @active_font end |
#fonts ⇒ Object (readonly)
Returns the value of attribute fonts.
247 248 249 |
# File 'ui/src/hokusai/font.rb', line 247 def fonts @fonts end |
Instance Method Details
#activate(name) ⇒ Object
266 267 268 269 270 |
# File 'ui/src/hokusai/font.rb', line 266 def activate(name) raise Hokusai::Error.new("Font #{name} is not registered") unless fonts[name] @active_font = name end |
#active ⇒ Object
276 277 278 |
# File 'ui/src/hokusai/font.rb', line 276 def active fonts[active_font] end |
#active_font_name ⇒ Object
260 261 262 263 264 |
# File 'ui/src/hokusai/font.rb', line 260 def active_font_name raise Hokusai::Error.new("No active font") if active_font.nil? active_font end |
#get(name) ⇒ Object
272 273 274 |
# File 'ui/src/hokusai/font.rb', line 272 def get(name) fonts[name] end |