Class: RubyMotionQuery::Font
Class Method Summary (collapse)
- + (Object) add_named(key, font_name_or_font, size = nil)
-
+ (Array) family_list
(also: family_names)
Use this in the console to get a list of font families.
- + (UIFont) font_with_name(name, size) (also: with_name)
- + (Array) for_family(family)
-
+ (UIFont) system(size = nil)
System font given size.
Class Method Details
+ (Object) add_named(key, font_name_or_font, size = nil)
38 39 40 41 42 43 44 45 46 47 48 |
# File 'motion/ruby_motion_query/font.rb', line 38 def add_named(key, font_name_or_font, size = nil) font = if font_name_or_font.is_a?(UIFont) font_name_or_font else Font.font_with_name(font_name_or_font, size || 22) end Font.define_singleton_method(key) do font end end |
+ (Array) family_list Also known as: family_names
Use this in the console to get a list of font families
64 65 66 |
# File 'motion/ruby_motion_query/font.rb', line 64 def family_list UIFont.familyNames.sort end |
+ (UIFont) font_with_name(name, size) Also known as: with_name
56 57 58 59 |
# File 'motion/ruby_motion_query/font.rb', line 56 def font_with_name(name, size) # TODO, should rename this to just with_name, so it's rmq.font.with_name UIFont.fontWithName(name, size: size) end |
+ (Array) for_family(family)
70 71 72 |
# File 'motion/ruby_motion_query/font.rb', line 70 def for_family(family) UIFont.fontNamesForFamilyName(family) end |
+ (UIFont) system(size = nil)
Returns System font given size
79 80 81 |
# File 'motion/ruby_motion_query/font.rb', line 79 def system(size = nil) UIFont.systemFontOfSize(size) end |