RubyMotion custom fonts
Original article here
In your Rakefile add your font in the app setup.
Motion::Project::App.setup do |app|
# App Settings
app.fonts = ['st-marie.ttf']
end
Make sure your st-marie.ttf is in your resources directory
To use in your app do the following
my_font = UIFont.fontWithName 'St Marie', size: 32
To find your font family name
UIFont.familyNames.sort # Should contain 'St Marie'
To find the font names for a family name
# Returns array of font names for 'St Marie'
UIFont.fontNamesForFamilyName 'St Marie'
Written by mtchavez
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#