{ "id": "123055", "key": "TIMOB-15856", "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": "11", "description": "Is not a bug in our product", "name": "Not Our Bug" }, "resolutiondate": "2013-12-03T00:24:41.000+0000", "created": "2013-11-29T16:42:51.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "ATTRIBUTE_BASELINE_OFFSET", "AttributedString", "look1" ], "versions": [], "issuelinks": [], "assignee": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2018-08-06T17:52:09.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": [], "description": "When using the new AttributedString on a label with the attribute of ATTRIBUTE_BASELINE_OFFSET the text within the label is clipped. This appears in differently depending on choice of font (default or custom) the value set for the offset.\r\n\r\n* When you use the default typeface then the top line of the text is clipped off.\r\n\r\n{code:xml} \r\nvar text = 'We\\'re pleased to announce the beta version of 3.2.0, a major update to our 3.1.0 version of the Titanium SDK and Titanium Studio.\\n\\nVersion 3.2.0 brings numerous fixes and improvements across both products, as well as preliminary support for iOS 7.1 and Android 4.4. Today, we\\'re asking you to help test out the release and provide feedback before it becomes generally available in mid-December.';\r\n\r\nvar attr = Ti.UI.iOS.createAttributedString({\r\n text: text,\r\n attributes: [\r\n {\r\n type: Ti.UI.iOS.ATTRIBUTE_BASELINE_OFFSET,\r\n value: 12,\r\n range: [0, text.length]\r\n }\r\n ]\r\n});\r\n\r\nvar label = Ti.UI.createLabel({\r\n attributedString: attr,\r\n backgroundColor: '#fff',\r\n borderColor: '#666',\r\n borderWidth: 1,\r\n color: '#000',\r\n font: {\r\n //fontFamily: 'TitilliumText22L-Light',\r\n fontSize: 24\r\n },\r\n height: Ti.UI.SIZE,\r\n //height: 400,\r\n //verticalAlign: Ti.UI.TEXT_VERTICAL_ALIGNMENT_TOP,\r\n width: 500\r\n});\r\n{code} \r\n\r\nValues for *verticalAlign* and *height* do not affect the problem.\r\n\r\n* Custom fonts make the problem much worse - whilst this may be the fault of the font, the fact that this occurs on the default font must mean it is the clipping routine at fault.\r\n\r\n* If you use the documented sample code and add only the ATTRIBUTE_BASELINE_OFFSET attribute this also affects the display of the string by truncated the display with ellipsis.\r\n\r\n{code:xml} \r\nvar text = 'Bacon ipsum dolor Appcelerator Titanium rocks! sit amet fatback leberkas salami sausage tongue strip steak.';\r\n\r\nvar attr = Titanium.UI.iOS.createAttributedString({\r\n text: text,\r\n attributes: [\r\n // Underlines text\r\n {\r\n type: Titanium.UI.iOS.ATTRIBUTE_UNDERLINES_STYLE,\r\n value: Titanium.UI.iOS.ATTRIBUTE_UNDERLINE_STYLE_SINGLE,\r\n range: [0, text.length]\r\n },\r\n // Sets a background color\r\n {\r\n type: Titanium.UI.iOS.ATTRIBUTE_BACKGROUND_COLOR,\r\n value: \"red\",\r\n range: [text.indexOf('Appcelerator'), ('Appcelerator').length]\r\n },\r\n {\r\n type: Titanium.UI.iOS.ATTRIBUTE_BACKGROUND_COLOR,\r\n value: \"blue\",\r\n range: [text.indexOf('Titanium'), ('Titanium').length]\r\n },\r\n {\r\n type: Titanium.UI.iOS.ATTRIBUTE_BACKGROUND_COLOR,\r\n value: \"yellow\",\r\n range: [text.indexOf('rocks!'), ('rocks!').length]\r\n },\r\n // Sets a foreground color\r\n {\r\n type: Titanium.UI.iOS.ATTRIBUTE_FOREGROUND_COLOR,\r\n value: \"orange\",\r\n range: [0, text.length]\r\n },\r\n {\r\n type: Titanium.UI.iOS.ATTRIBUTE_FOREGROUND_COLOR,\r\n value: \"black\",\r\n range: [text.indexOf('rocks!'), ('rocks!').length]\r\n },\r\n {\r\n type: Ti.UI.iOS.ATTRIBUTE_BASELINE_OFFSET,\r\n value: 24,\r\n range: [0, text.length]\r\n }\r\n ]\r\n});\r\n\r\nvar label = Titanium.UI.createLabel({\r\n left: 20,\r\n right: 20,\r\n height: Titanium.UI.SIZE,\r\n attributedString: attr\r\n});\r\n{code} ", "attachment": [ { "id": "44273", "filename": "default.jpg", "author": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "created": "2013-11-29T16:42:51.000+0000", "size": 79190, "mimeType": "image/jpeg" }, { "id": "44276", "filename": "mixed.jpg", "author": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "created": "2013-11-29T17:48:46.000+0000", "size": 23814, "mimeType": "image/jpeg" }, { "id": "44274", "filename": "TitilliumText22L-Light.jpg", "author": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "created": "2013-11-29T16:42:51.000+0000", "size": 68337, "mimeType": "image/jpeg" } ], "flagged": false, "summary": "iOS: Titanium.UI.iOS.AttributedString clipping problems when used with ATTRIBUTE_BASELINE_OFFSET", "creator": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "environment": "Mac OSX 10.9\r\nTitanium Studio, build: 3.2.1.201311271927\r\nTitanium SDK version 3.2.0.v20131117001643\r\nCLI version 3.2.0\r\nBuilding using iOS SDK: 7.0\r\nMinimum iOS version: 7.0\r\nBuilding for device family: ipad", "comment": { "comments": [ { "id": "281827", "author": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "body": "Example when used with the sample code from the documentation adding only base_offset", "updateAuthor": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "created": "2013-11-29T17:48:47.000+0000", "updated": "2013-11-29T17:48:47.000+0000" }, { "id": "282027", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Tested with native Objective-C app and also fails. Looks like an iOS 7 bug.\r\n\r\nTested on iPad and iPhone \r\niOS 7 - Fails\r\niOS 6 - Works as expected\r\n{code}\r\n- (void)viewDidLoad\r\n{\r\n [super viewDidLoad];\r\n [[self view] setBackgroundColor:[UIColor whiteColor]];\r\n \r\n NSString *text = @\"We're pleased to announce the beta version of 3.2.0, a major update to our 3.1.0 version of the Titanium SDK and Titanium Studio.\\n\\nVersion 3.2.0 brings numerous fixes and improvements across both products, as well as preliminary support for iOS 7.1 and Android 4.4. Today, we're asking you to help test out the release and provide feedback before it becomes generally available in mid-December.'\";\r\n \r\n CGFloat width = 500;\r\n CGFloat left = self.view.frame.size.width / 2 - width / 2;\r\n \r\n UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(left, 200, width, 500)];\r\n [[label layer] setBorderColor:[UIColor blackColor].CGColor];\r\n [[label layer] setBorderWidth:1];\r\n [label setNumberOfLines:0];\r\n [label setBackgroundColor:[UIColor whiteColor]];\r\n \r\n NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:text];\r\n\r\n [attr addAttribute: NSBaselineOffsetAttributeName\r\n value: [NSNumber numberWithFloat:12]\r\n range: NSMakeRange(0, [text length])\r\n ];\r\n \r\n [attr addAttribute:NSFontAttributeName value:[UIFont fontWithName:@\"TitilliumText22L-Light\" size:24] range:NSMakeRange(0, [text length])];\r\n \r\n\r\n [label setAttributedText:attr];\r\n [[self view] addSubview:label];\r\n [label sizeToFit];\r\n}\r\n\r\n{code}", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-12-03T00:24:41.000+0000", "updated": "2013-12-03T00:24:41.000+0000" }, { "id": "282114", "author": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "body": "@Pedro thanks for the ObjectiveC checks.\r\n\r\nGiven there is now an obvious issue;\r\n\r\n# Will the Titanium documentation be updated to show this failure?\r\n# Do you inform Apple of the problem?\r\n# Do you know if the problem persists in iOS7.1?", "updateAuthor": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "created": "2013-12-03T15:17:05.000+0000", "updated": "2013-12-03T15:17:05.000+0000" }, { "id": "307127", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Tested again, issue persists in iOS 7.1\r\nAgain, it works well in iOS 6.1 but fails in 7.0 and above.", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-05-31T09:51:49.000+0000", "updated": "2014-05-31T09:51:49.000+0000" }, { "id": "307128", "author": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "body": "Thanks for the revisit. Were the tests performed with the ObjectiveC code above? Just wanting to confirm again that the issue is with Apple and not with Titanium. Cheers.", "updateAuthor": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "created": "2014-05-31T11:20:04.000+0000", "updated": "2014-05-31T11:20:04.000+0000" }, { "id": "307130", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Yes, I tested with the Objective-C code on the iPad and iPhone simulator. Both with iOS 6.1 and 7.1", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-05-31T13:07:02.000+0000", "updated": "2014-05-31T13:07:02.000+0000" }, { "id": "307131", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Can we find/file a relate bug with Apple?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-05-31T13:12:16.000+0000", "updated": "2014-05-31T13:12:16.000+0000" }, { "id": "440297", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as \"not our bug\". If you disagree, please reopen.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-06T17:52:09.000+0000", "updated": "2018-08-06T17:52:09.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }