class RMQFont

Attributes

font_family[RW]
name[RW]
size[RW]
text_style[RW]

Public Class Methods

add_named(name, font_family, size, text_style) click to toggle source
# 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() click to toggle source
# File lib/project/ruby_motion_query/rmq_font.rb, line 56
def font_cache
  @font_cache ||= {}
end
method_missing(font_key) click to toggle source
# 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
new(name, font_family, size, text_style) click to toggle source
# 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

Public Instance Methods

inspect() click to toggle source
# File lib/project/ruby_motion_query/rmq_font.rb, line 21
def inspect
  "<RMQFont #{@name} \"#{@font_family}\" #{@size} #{@text_style}>"
end
sdk_text_style() click to toggle source
# 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() click to toggle source
# File lib/project/ruby_motion_query/rmq_font.rb, line 25
def to_s
  self.inspect
end
to_typeface() click to toggle source
# File lib/project/ruby_motion_query/rmq_font.rb, line 42
def to_typeface
  Android::Graphics::Typeface.create(@font_family, sdk_text_style)
end