Class: RMQFont
Instance Attribute Summary collapse
-
#font_family ⇒ Object
Returns the value of attribute font_family.
-
#name ⇒ Object
Returns the value of attribute name.
-
#size ⇒ Object
Returns the value of attribute size.
-
#text_style ⇒ Object
Returns the value of attribute text_style.
Class Method Summary collapse
- .add_named(name, font_family, size, text_style) ⇒ Object
- .font_cache ⇒ Object
- .method_missing(font_key) ⇒ Object
Instance Method Summary collapse
-
#initialize(name, font_family, size, text_style) ⇒ RMQFont
constructor
A new instance of RMQFont.
- #inspect ⇒ Object
- #sdk_text_style ⇒ Object
- #to_s ⇒ Object
- #to_typeface ⇒ Object
Constructor Details
#initialize(name, font_family, size, text_style) ⇒ RMQFont
14 15 16 17 18 19 |
# File 'lib/project/ruby_motion_query/rmq_font.rb', line 14 def initialize(name, font_family, size, text_style) @name = name @font_family = font_family @text_style = text_style @size = size end |
Instance Attribute Details
#font_family ⇒ Object
Returns the value of attribute font_family.
12 13 14 |
# File 'lib/project/ruby_motion_query/rmq_font.rb', line 12 def font_family @font_family end |
#name ⇒ Object
Returns the value of attribute name.
12 13 14 |
# File 'lib/project/ruby_motion_query/rmq_font.rb', line 12 def name @name end |
#size ⇒ Object
Returns the value of attribute size.
12 13 14 |
# File 'lib/project/ruby_motion_query/rmq_font.rb', line 12 def size @size end |
#text_style ⇒ Object
Returns the value of attribute text_style.
12 13 14 |
# File 'lib/project/ruby_motion_query/rmq_font.rb', line 12 def text_style @text_style end |
Class Method Details
.add_named(name, font_family, size, text_style) ⇒ Object
47 48 49 |
# File 'lib/project/ruby_motion_query/rmq_font.rb', line 47 def add_named(name, font_family, size, text_style) font_cache[name] = RMQFont.new(name, font_family, size, text_style) end |
.font_cache ⇒ Object
56 57 58 |
# File 'lib/project/ruby_motion_query/rmq_font.rb', line 56 def font_cache @font_cache ||= {} end |
.method_missing(font_key) ⇒ Object
51 52 53 54 |
# File 'lib/project/ruby_motion_query/rmq_font.rb', line 51 def method_missing(font_key) # define_singleton_method isn't implemented in Android :'( font_cache[font_key] end |
Instance Method Details
#inspect ⇒ Object
21 22 23 |
# File 'lib/project/ruby_motion_query/rmq_font.rb', line 21 def inspect "<RMQFont #{@name} \"#{@font_family}\" #{@size} #{@text_style}>" end |
#sdk_text_style ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/project/ruby_motion_query/rmq_font.rb', line 29 def sdk_text_style case @text_style when :bold Android::Graphics::Typeface::BOLD when :italic Android::Graphics::Typeface::ITALIC when :bold_italic Android::Graphics::Typeface::BOLD_ITALIC when :normal Android::Graphics::Typeface::NORMAL end end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/project/ruby_motion_query/rmq_font.rb', line 25 def to_s self.inspect end |
#to_typeface ⇒ Object
42 43 44 |
# File 'lib/project/ruby_motion_query/rmq_font.rb', line 42 def to_typeface Android::Graphics::Typeface.create(@font_family, sdk_text_style) end |