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!
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.
-
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' ;