Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8328] Mobileweb: Ti.UI.Label doesn't handle string values for `fontSize`

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-06-05T13:09:03.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sRelease 2.1.0, Sprint 2012-12 MW
ComponentsMobileWeb
Labelsmw-list, qe-port
ReporterTony Lukasavage
AssigneeBryan Hughes
Created2012-03-27T11:01:06.000+0000
Updated2012-08-08T16:27:48.000+0000

Description

Problem

Mobileweb does not translate string values for fontSize into the appropriate integer values. Android and iOS do this automatically. This likely impacts other properties, but this is how it surfaced for me.

Test Case

var win = Ti.UI.createWindow();
win.add(Ti.UI.createLabel({
    text: 'Hello, World!',
    font: {
        fontSize: '32'   // Will automatically become an integer on android and ios, does not on mobileweb
    }
}));
win.open();
The result on Android and iOS will be a label with a font size of 32. On mobileweb, I'm guessing it doesn't recognize the string value and then just uses the default font size to display the label. Changing '32' to simply 32 allows mobileweb to resize correctly.

Comments

  1. Bryan Hughes 2012-06-05

    Pull Request: https://github.com/appcelerator/titanium_mobile/pull/2327 Note: make sure to set a background color on the window when running the above test case, otherwise you just get a black screen and can't see the text.
  2. Lokesh Choudhary 2012-08-07

    Tested On: Titanium studio : 2.1.1.201207271312 SDK version : 2.2.0.v20120807070117 Android 4.0.4 - default ,chrome 18.0 Iphone 4.3.5 - safari mobile Mountain lion(10.8) - chrome 21.0,safari 5.1.4,firefox 14.0.1

JSON Source