{ "id": "62299", "key": "TIMOB-1667", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2011-04-15T02:58:54.000+0000", "created": "2011-04-15T02:58:52.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "eventlistener", "font", "fontsize", "label" ], "versions": [], "issuelinks": [], "assignee": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-09T22:58:36.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

Environment: Titanium Developer 1.40 and iPhone\nSimulator (iphone and iphone4). Also tested on iPhone4 device with\nsame results.

\n

Issue: Changing the fontSize property of a\nlabel after label is rendered has no effect. The following code\ndoes not work.

\n

Example code: (notice 2 methods for defining\nnew font size - neither work)

\n
\nvar w = Ti.UI.createWindow({backgroundColor:'#fff'});\nvar b = Ti.UI.createButton({\n   title:'Click Me',\n   top:10,\n   height:40,\n   width:200\n});\nvar lab = Ti.UI.createLabel({\n   text: 'test',\n   top: 150,\n   height: 140,\n   width: 300,\n   font:{fontSize:20},\n   color: '#c00',\n   backgroundColor: '#ccc'\n});\n\nw.add(b);\nw.add(lab);\n\nb.addEventListener('click', function() {\n   lab.font = '{fontSize:100}'; \n  // lab.font.fontSize = 100; // this also doesn't work\n});\n\nw.open();\n
{html}", "attachment": [], "flagged": false, "summary": "Changing label view's font.fontSize property after view is rendered has no effect.", "creator": { "name": "k00k", "key": "k00k", "displayName": "k00k", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "k00k", "key": "k00k", "displayName": "k00k", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "126317", "author": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

This should work as a workaround (it's what I've been doing,\nworks for me on both Android and iPhone):

\n

lab.font = {fontSize:100};

\n

I think the reason the initial attempt to just assign\nlab.font.fontSize directly doesn't work is that the 'font' property\nis implemented with getters/setters that just take and return plain\nJSON-style objects.

\n

So 'lab.font' returns a plain old object which has no inherent\nconnection back to 'lab'; changing its contents only changes the\nnew object, and doesn't ever reach the original.

\n

This could probably be made to work as expected if the font\nproperty's getter returned a proxy object, which itself would have\ngetters/setters to handle sending through the subproperties.

{html}", "updateAuthor": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:58:53.000+0000", "updated": "2011-04-15T02:58:53.000+0000" }, { "id": "126318", "author": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Since we encountered this same issue while working on StatusNet\nMobile, I'm assigning this to our support contact. Nolan, can you\nmake sure it's reassigned to the appropriate people for iPhone and\nAndroid implementations? We've used the above workaround, but\nclearly other people are encountering the same problem... if it\ncan't be fixed easily, could the workaround be added to API\ndocumentation perhaps?

\n

Thanks!

{html}", "updateAuthor": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:58:53.000+0000", "updated": "2011-04-15T02:58:53.000+0000" }, { "id": "126319", "author": { "name": "nwright", "key": "nwright", "displayName": "Nolan Wright", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

it's working as designed. Our properties use getters/setters, so\nthere is no support for property nesting. The font property takes\nan object as a value, so this:

\n

label.font = {fontSize:20};

\n

is the proper way to change the value.

\n

thanks.

{html}", "updateAuthor": { "name": "nwright", "key": "nwright", "displayName": "Nolan Wright", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:58:53.000+0000", "updated": "2011-04-15T02:58:53.000+0000" }, { "id": "126320", "author": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Nolan, any comment on the feasibility of my suggested\nimplementation for property nesting?

\n

Or is there a deliberate choice to not implement\nproperty nesting? If so, this should be very clearly documented;\nmost JavaScript developers will probably be coming from web\ndevelopment and will be used to nested properties like\n'div.style.fontSize = 100'.

{html}", "updateAuthor": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:58:53.000+0000", "updated": "2011-04-15T02:58:53.000+0000" }, { "id": "126321", "author": { "name": "k00k", "key": "k00k", "displayName": "k00k", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Thanks for the clarification Nolan. I see I was mistakenly\nwrapping the object in ''. I agree on needing better documentation.\nI also realize you guys are busy. Time to get a few interns :)

{html}", "updateAuthor": { "name": "k00k", "key": "k00k", "displayName": "k00k", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:58:53.000+0000", "updated": "2011-04-15T02:58:53.000+0000" }, { "id": "126322", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Nolan should have invalidated.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:58:54.000+0000", "updated": "2011-04-15T02:58:54.000+0000" }, { "id": "410876", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-09T22:58:36.000+0000", "updated": "2017-03-09T22:58:36.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }