Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6053] Android: fontStyle not supported on Android

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-02-12T19:32:26.000+0000
Affected Version/sRelease 1.8.0
Fix Version/sRelease 3.1.0, 2013 Sprint 04 API, 2013 Sprint 04
ComponentsAndroid
Labelsmodule_label, parity, qe-testadded, tbs-2.1.0
ReporterArthur Evans
AssigneeSunila
Created2011-11-07T13:36:29.000+0000
Updated2013-08-09T17:13:48.000+0000

Description

On iOS, the user can select an italic font by specifying a font object like:
{ fontSize: '16', fontStyle: 'italic' }
In Android, there appears to be no way to select an italic font, even when using a family like DroidSerif which includes an italic face. Both:
{ fontFamily: 'DroidSerif', fontStyle: 'italic' }
And:
{ fontFamily: 'DroidSerif-Italic' }
Fail to produce the desired results. The following code snippet demonstrates the issue. The italic fonts show up as expected on iOS, but not on Android.
var win1 = Ti.UI.createWindow({
	backgroundColor:'white',
	layout:'vertical'
});

function makeLabel(labelText, labelFont) 
{
    return Titanium.UI.createLabel({
    top: 20,
    text:labelText,
    font:labelFont,
    width:'auto',
    height:'auto'
    });
}
 
var theTestFont = 'serif';
 
win1.add(makeLabel('Font normal normal', { fontFamily:theTestFont, fontWeight:'normal', fontStyle:'normal'}));
win1.add(makeLabel('Font bold normal', { fontFamily:theTestFont, fontWeight:'bold', fontStyle:'normal'}));
win1.add(makeLabel('Font normal italic', { fontFamily:theTestFont, fontWeight:'normal', fontStyle:'italic'}));
win1.add(makeLabel('Font bold italic', { fontFamily:theTestFont, fontWeight:'bold', fontStyle:'italic'}));

win1.open();

Comments

  1. Allen Yeung 2013-02-12

    https://github.com/appcelerator/titanium_mobile/pull/3581
  2. Shyam Bhadauria 2013-02-27

    Environment used for verification - Titanium SDK: 3.1.0.v20130226024607 Titanium  Studio:3.0.2.201302141201 Device: Samsung GALAXY Note (2.3.6)

JSON Source