Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Formatting with font - a quick reference (italics please)

I haven't been able to find a reference to all the font formatting options. So far I've found:

  • fontFamily, e.g. fontFamily:'Helvetica Neue'
  • fontSize, e.g. fontSize:48
  • fontWeight, e.g. fontWeight:'bold'

If someone knows how to do italic I'd love it it they could share it with us!

— asked March 21st 2010 by Chris Lamothe
  • bold
  • font
  • italics
  • mobile
0 Comments

2 Answers

  • Accepted Answer

    So here's the problem. On the mobile device, you don't have a wide ranging set of fonts - it's fairly limited and device specific. For iPhone, you can't do font or italics - you simply have to choose a font family. For bold, we simply attempt to find a font typeface for the family passed in that has bold in the font name. for italics, it would be similar.

    Or, the right way of doing it …. Go to this webpage for a list of supported phones on the iphone (google for android). Find the supported font you want and just pass that name for fontFamily.

    we're going to add some smarts to the code down the road to support italics, but it won't be an exact science.

    — answered March 21st 2010 by Jeff Haynie
    permalink
    0 Comments
  • On Android you can get italics text in labels by using the .html property in stead of text:

    var myLabel = Ti.UI.createLabel(....)   ;
    myLabel.html = '<i>i am in italics on Android</i>' ; 
    myLabel.text = 'maybe i am as well on iphone, depending on font style' ;
    
    — answered November 18th 2011 by Michael Janus
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.