{ "id": "146809", "key": "TIMOB-18853", "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": [ { "id": "16723", "description": "Windows Platform Support, ListView updates, Vector overlays in maps", "name": "Release 4.1.0", "archived": false, "released": true, "releaseDate": "2015-07-08" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-04-30T18:17:53.000+0000", "created": "2015-04-10T16:00:49.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "label", "parity", "textarea", "textfield" ], "versions": [], "issuelinks": [ { "id": "47448", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "147087", "key": "AC-91", "fields": { "summary": "Android: Custom font with attributedString doesn't work", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2015-06-03T18:30:03.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h2. Problem\r\nThe Ti.UI.ATTRIBUTE_FONT part of TIMOB-15998 doesn't appear to be working with custom fonts. TIMOB-15998 didn't demonstrate custom fonts working. The built-in font Roboto and its variants are working, as well as the built-in families monospace and serif. However, custom fonts placed in app/assets/android/fonts as well as app/assets/fonts are not working.\r\n\r\nBelow, I'm expecting to see the first line of text, \"Chantelli Antiqua,\" to be displayed in the custom font, which is more of a serif font than the sans-serif shown. Instead, however, we see the text displayed in the default font.\r\n\r\nh2. Test case\r\n{code:lang=javascript|title=app.js}\r\nvar win = Titanium.UI.createWindow({\r\n\tbackgroundColor : \"#ffffff\"\r\n});\r\n\r\nvar scrollView = Ti.UI.createScrollView({\r\n\theight : Ti.UI.FILL,\r\n\twidth : Ti.UI.FILL,\r\n\tlayout : \"vertical\"\r\n});\r\n\r\nwin.add(scrollView);\r\n\r\nwin.open();\r\n\r\nvar fonts = [\"Chantelli_Antiqua\", \"serif\", \"monospace\", \"sans-serif\", \"sans-serif-light\", \"sans-serif-condensed\"];\r\n\r\n_.each(fonts, function(font) {\r\n\tvar text = font;\r\n\r\n\tvar attr = Titanium.UI.createAttributedString({\r\n\t\ttext : text,\r\n\t\tattributes : [\r\n\t\t{\r\n\t\t\ttype : Ti.UI.ATTRIBUTE_FONT,\r\n\t\t\tvalue : {\r\n\t\t\t\tfont : {\r\n\t\t\t\t\tfontSize : 20,\r\n\t\t\t\t\tfontFamily : font\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\trange : [0, text.length]\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype : Ti.UI.ATTRIBUTE_FOREGROUND_COLOR,\r\n\t\t\tvalue : \"#000000\",\r\n\t\t\trange : [0, text.length]\r\n\t\t}]\r\n\t});\r\n\r\n\tvar label = Titanium.UI.createLabel({\r\n\t\ttop : 10,\r\n\t\tleft : 10,\r\n\t\tright : 10,\r\n\t\theight : Titanium.UI.SIZE,\r\n\t\tattributedString : attr\r\n\t});\r\n\r\n\tscrollView.add(label);\r\n});\r\n{code}", "attachment": [ { "id": "54882", "filename": "Chantelli_Antiqua.ttf", "author": { "name": "athorne", "key": "athorne", "displayName": "Alex Bernier", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-04-10T16:00:49.000+0000", "size": 21348, "mimeType": "application/x-font-ttf" }, { "id": "54884", "filename": "Screenshot_2015-04-10-09-31-07.png", "author": { "name": "athorne", "key": "athorne", "displayName": "Alex Bernier", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-04-10T16:32:23.000+0000", "size": 74838, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Custom Fonts not working in Attributed Strings", "creator": { "name": "athorne", "key": "athorne", "displayName": "Alex Bernier", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "athorne", "key": "athorne", "displayName": "Alex Bernier", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Appc Studio: 4.0.0.201504021909\r\nTi SDK: 4.0.0.Beta2 and 4.0.0.Beta3\r\nCLI: 4.0.0-beta3\r\nMAC: 10.9.5\r\nDevice: Nexus 6 - android 5.1", "closedSprints": [ { "id": 398, "state": "closed", "name": "2015 Sprint 09 SDK", "startDate": "2015-04-25T00:00:00.000Z", "endDate": "2015-05-09T00:00:00.000Z", "completeDate": "2015-05-11T14:11:17.028Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "350154", "author": { "name": "athorne", "key": "athorne", "displayName": "Alex Bernier", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Also seeing this in SDK 4.0.0.Beta3. [~rtlechuga] Do you have a sense for when this might be prioritized? I know you guys are pushing hard for 4.0.0.GA.", "updateAuthor": { "name": "athorne", "key": "athorne", "displayName": "Alex Bernier", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-04-20T19:44:29.000+0000", "updated": "2015-04-20T19:44:29.000+0000" }, { "id": "350156", "author": { "name": "rtlechuga", "key": "rtlechuga", "displayName": "Radamantis Torres-Lechuga", "active": false, "timeZone": "Asia/Dubai" }, "body": "[~athorne] Hello, as you can see in the documentation, this is only for iOS [attributed string |http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.iOS.AttributedString] if you want to achieve something similar with android, you must use HTML inside the label [label|http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.Label]\r\n\r\nBest regards", "updateAuthor": { "name": "rtlechuga", "key": "rtlechuga", "displayName": "Radamantis Torres-Lechuga", "active": false, "timeZone": "Asia/Dubai" }, "created": "2015-04-20T19:52:52.000+0000", "updated": "2015-04-20T19:55:08.000+0000" }, { "id": "350165", "author": { "name": "athorne", "key": "athorne", "displayName": "Alex Bernier", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I'm on platform [~rtlechuga]. Attributed string was just brought over to Android and the Ti.UI.iOS.AttributedString was deprecated in favor of Ti.UI.AttributedString. http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.AttributedString. Ti.UI.ATTRIBUTE_FONT is listed as supported on Android since SDK 3.6: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI-property-ATTRIBUTE_FONT", "updateAuthor": { "name": "athorne", "key": "athorne", "displayName": "Alex Bernier", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-04-20T21:02:32.000+0000", "updated": "2015-04-20T21:02:32.000+0000" }, { "id": "350173", "author": { "name": "athorne", "key": "athorne", "displayName": "Alex Bernier", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Duplicated by AC-91.", "updateAuthor": { "name": "athorne", "key": "athorne", "displayName": "Alex Bernier", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-04-20T21:24:57.000+0000", "updated": "2015-04-20T21:24:57.000+0000" }, { "id": "350719", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FYI", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-04-24T22:52:47.000+0000", "updated": "2015-04-24T22:52:47.000+0000" }, { "id": "350973", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/6808\r\n\r\nPut the resource \"Chantelli_Antiqua.ttf\" at assets/Resources/fonts/\r\nTest Code:\r\n{code}\r\n\r\nvar win = Titanium.UI.createWindow({\r\n\tbackgroundColor : \"#ffffff\"\r\n});\r\n \r\nvar scrollView = Ti.UI.createScrollView({\r\n\theight : Ti.UI.FILL,\r\n\twidth : Ti.UI.FILL,\r\n\tlayout : \"vertical\"\r\n});\r\n \r\nwin.add(scrollView);\r\n \r\nwin.open();\r\n\r\n \r\n var font = \"Chantelli_Antiqua\";\r\n\tvar text = font;\r\n \r\n\tvar attr = Titanium.UI.createAttributedString({\r\n\t\ttext : text,\r\n\t\tattributes : [\r\n\t\t{\r\n\t\t\ttype : Ti.UI.ATTRIBUTE_FONT,\r\n\t\t\tvalue : {\r\n\t\t\t\tfont : {\r\n\t\t\t\t\tfontSize : 20,\r\n\t\t\t\t\tfontFamily : font\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\trange : [0, text.length]\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype : Ti.UI.ATTRIBUTE_FOREGROUND_COLOR,\r\n\t\t\tvalue : \"#000000\",\r\n\t\t\trange : [0, text.length]\r\n\t\t}]\r\n\t});\r\n \r\n\tvar label = Titanium.UI.createLabel({\r\n\t\ttop : 10,\r\n\t\tleft : 10,\r\n\t\tright : 10,\r\n\t\theight : Titanium.UI.SIZE,\r\n\t\tattributedString : attr\r\n\t});\r\n \r\n\tscrollView.add(label);\r\n\r\n\t\r\n\tvar font1 = \"serif\";\r\n\tvar text1 = font1;\r\n \r\n\tvar attr1 = Titanium.UI.createAttributedString({\r\n\t\ttext : text1,\r\n\t\tattributes : [\r\n\t\t{\r\n\t\t\ttype : Ti.UI.ATTRIBUTE_FONT,\r\n\t\t\tvalue : {\r\n\t\t\t\tfont : {\r\n\t\t\t\t\tfontSize : 20,\r\n\t\t\t\t\tfontFamily : font1\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\trange : [0, text1.length]\r\n\t\t},\r\n\t\t{\r\n\t\t\ttype : Ti.UI.ATTRIBUTE_FOREGROUND_COLOR,\r\n\t\t\tvalue : \"#000000\",\r\n\t\t\trange : [0, text1.length]\r\n\t\t}]\r\n\t});\r\n \r\n\tvar label1 = Titanium.UI.createLabel({\r\n\t\ttop : 10,\r\n\t\tleft : 10,\r\n\t\tright : 10,\r\n\t\theight : Titanium.UI.SIZE,\r\n\t\tattributedString : attr1\r\n\t});\r\n \r\n\tscrollView.add(label1);\r\n\t\r\n\tvar text2 = \"Chantelli_Antiqua\";\r\n\tvar label2 = Ti.UI.createLabel({\r\n\ttop : 20,\r\n\tfont : {\r\n\t\tfontSize : 50,\r\n\t\tfontFamily : 'Chantelli_Antiqua'\r\n\t},\r\n\tcolor : '#d0d',\r\n\ttext : text2\r\n});\r\nscrollView.add(label2);\r\n\r\n{code}", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-04-28T08:02:18.000+0000", "updated": "2015-04-28T08:04:19.000+0000" }, { "id": "351565", "author": { "name": "athorne", "key": "athorne", "displayName": "Alex Bernier", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thank you, [~msamah] and [~hpham]! Works great.", "updateAuthor": { "name": "athorne", "key": "athorne", "displayName": "Alex Bernier", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-05-04T18:47:09.000+0000", "updated": "2015-05-04T18:47:09.000+0000" }, { "id": "354254", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix.\r\nCustom fonts are now working as expected.\r\n\r\nClosing.\r\n\r\nEnvironment:\r\nAppc Studio : 4.1.0.201505071004\r\nTi SDK : 4.1.0.v20150602140423\r\nCLI : 4.0.1\r\nAlloy : 1.6.0\r\nMAC Yosemite : 10.10.3\r\nAppc npm : 4.0.0\r\nAppc CLI : 4.0.1\r\nNode: v0.10.37\r\nNexus 5 - Android 5.1.1", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-06-03T18:29:51.000+0000", "updated": "2015-06-03T18:29:51.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }