Last Updated: May 11, 2020
·
2.763K
· mtchavez

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'