Skip to content

script to transform a fontastic or icomoon font to a cobalt font module

License

Notifications You must be signed in to change notification settings

Cobaltians-Fonts/fontToCobalt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Font To Cobalt

This python script will help you to include any Fontastic or Icomoon fonts on your Android or IOS Cobalt App. See the How to use below.

  • This script create a standard Android|IOS module architecture.
  • Parse the .css given by Fontastic|Icomoon, extract icons name and associated glyphs and put them in the created package.
  • Android: Create a basic AndroidManifest.xml, build.gradle with Cobalt dependency, and the corresponding java code according to the Cobalt framework in the package.
  • IOS: Create a basic projet with a header and some generated .m code and fill them.
  • Copy the font.ttf in the package's assets directory.
  • The resulting module is generated in the ./Fonts-FontName-Android|IOS directory.

Installation

pip install tinycss
git clone https://github.com/Cobaltians-Fonts/FontToCobalt.git

Usage

python fontToCobalt.py --name fontname --arch android|ios styles.css yourfont.ttf

Examples

python fontToCobalt.py styles.css yourfont.ttf
python fontToCobalt.py --name myFontName styles.css yourfont.ttf
python fontToCobalt.py --name myFontName --arch ios styles.css yourfont.ttf

Installation

Note: the --name param must match the font name as shown in your font book (Mac) or equivalent as in the screenshot below

Font book

In cobalt.conf:

Add this example code at the end of cobalt.conf

"fonts" : {
 "fa": {
   "ios": "FontsAwesome",
   "android": "org.cobaltians.fonts.fontAwesome.FontAwesomeDrawable"
 }
}

In Android Studio:

  • Open your project
  • Select File/New/ImportModule/
  • Then select the generated font module 'Fonts-FontName-Android'
  • Clic Finish

In Xcode:

  • Open your project or workspace
  • Drag and drop the generated 'Fonts-FontName-iOS' folder into your project navigator and check the "Copy items if needed" in the pop-up which appears Import
  • Add a Fonts provided by application array in the .plist file of your application project with an item whose value is the filename of your font file. plist

Voila! You can now use native bars icon using the name of the icon:

"icon": "fa house-icon"

About

script to transform a fontastic or icomoon font to a cobalt font module

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages