This is a simple how to on how to embed a Font in Titanium ALLOY for both Android an iOS
I suggest using a OTF version of your font as Android 4.3 Jelly Beans and Android 4.4 Kitkat
1. Place the font in the following folder – /yourapp/app/assets/fonts/Crazy.otf
2. Define something simular to this in your alloy.js file
//////////////////////////////////////////////////////////////////////////////////// // Start Custon Font Section // // On iOS use the actual name of the font - Open the font to find this Name Alloy.Globals.customFont = 'Crazy Unicode System'; // use the friendly-name on iOS // Start IF - Android if (Ti.Platform.osname=='android') { // on Android, use the "base name" of the file (name without extension) Alloy.Globals.customFont = 'Crazy'; } // End IF - Android // End Custon Font Section // //////////////////////////////////////////////////////////////////////////////////
3. Call the Font from anywhere in the app for example
font: {fontSize:15,fontFamily: Alloy.Globals.customFont},
How to: Appcelerator Titanium Alloy Embed Font – Android and iOS
One thought on “How to: Appcelerator Titanium Alloy Embed Font – Android and iOS”