Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-6053

Android: fontStyle not supported on Android

    Details

      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();
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sunila Sunila
                Reporter:
                aevans Arthur Evans
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-5126
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code