Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0Digg thisPin on Pinterest0Email this to someone

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},

 

If you enjoyed this post, why not leave a comment or consider a Donation as a token of your appreciation. If you need help implementing something you saw on this site or any other project why not Hire Me?
How to: Appcelerator Titanium Alloy Embed Font – Android and iOS
Tagged on:                                                     

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “How to: Appcelerator Titanium Alloy Embed Font – Android and iOS

Loading Facebook Comments ...