{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/componentkit/issues/155","labels_url":"https://api.github.com/repos/facebook/componentkit/issues/155/labels{/name}","comments_url":"https://api.github.com/repos/facebook/componentkit/issues/155/comments","events_url":"https://api.github.com/repos/facebook/componentkit/issues/155/events","html_url":"https://github.com/facebook/componentkit/issues/155","id":71698567,"number":155,"title":"Undesired side effects when using lineSpacing and maximumNumberOfLines with CKLabelComponent/CKTextComponent","user":{"login":"sgtsquiggs","id":3420325,"avatar_url":"https://avatars.githubusercontent.com/u/3420325?v=3","gravatar_id":"","url":"https://api.github.com/users/sgtsquiggs","html_url":"https://github.com/sgtsquiggs","followers_url":"https://api.github.com/users/sgtsquiggs/followers","following_url":"https://api.github.com/users/sgtsquiggs/following{/other_user}","gists_url":"https://api.github.com/users/sgtsquiggs/gists{/gist_id}","starred_url":"https://api.github.com/users/sgtsquiggs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgtsquiggs/subscriptions","organizations_url":"https://api.github.com/users/sgtsquiggs/orgs","repos_url":"https://api.github.com/users/sgtsquiggs/repos","events_url":"https://api.github.com/users/sgtsquiggs/events{/privacy}","received_events_url":"https://api.github.com/users/sgtsquiggs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"ocrickard","id":857665,"avatar_url":"https://avatars.githubusercontent.com/u/857665?v=3","gravatar_id":"","url":"https://api.github.com/users/ocrickard","html_url":"https://github.com/ocrickard","followers_url":"https://api.github.com/users/ocrickard/followers","following_url":"https://api.github.com/users/ocrickard/following{/other_user}","gists_url":"https://api.github.com/users/ocrickard/gists{/gist_id}","starred_url":"https://api.github.com/users/ocrickard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocrickard/subscriptions","organizations_url":"https://api.github.com/users/ocrickard/orgs","repos_url":"https://api.github.com/users/ocrickard/repos","events_url":"https://api.github.com/users/ocrickard/events{/privacy}","received_events_url":"https://api.github.com/users/ocrickard/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-04-28T20:47:52Z","updated_at":"2015-04-29T01:54:13Z","closed_at":null,"body":"It seems that setting ```lineSpacing``` causes an extra spacing to be added after the last line of text when using ```maximumNumberOfLines``` and a length of text that would require truncation.\r\n\r\nNormally ```lineSpacing``` only affects spacing between lines, and not before the first line or after the last line.\r\n\r\nIn each test below, I am varying either the ```lineBreakMode``` or ```lineSpacing```. The first three have no ```lineSpacing```, while the last three do.\r\n\r\n```TEST SIX``` has the correct zero-padding between text and edge of text container, but this is due to ```maximumNumberOfLines``` being completely ignored when using ```NSLineBreakByCharWrapping```.\r\n\r\n![ios simulator screen shot apr 28 2015 4 43 29 pm](https://cloud.githubusercontent.com/assets/3420325/7379843/be754bdc-edc5-11e4-8947-1b1427bbc5e8.png)\r\n\r\nIn the above image:\r\n\r\n```TEST ONE```\r\n```objc\r\n[CKLabelComponent\r\n newWithLabelAttributes:{\r\n\t  .font = [UIFont fontWithName:@\"LeituraNews-Roman2\" size:12],\r\n\t  .color = [UIColor blackColor],\r\n\t  .string = @\"TEST ONE two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty\",\r\n\t  .maximumNumberOfLines = 2\r\n }\r\n viewAttributes:{}]\r\n```\r\n```TEST TWO```\r\n```objc\r\n[CKLabelComponent\r\n newWithLabelAttributes:{\r\n\t  .font = [UIFont fontWithName:@\"LeituraNews-Roman2\" size:12],\r\n\t  .color = [UIColor blackColor],\r\n\t  .string = @\"TEST TWO three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty\",\r\n\t  .lineBreakMode = NSLineBreakByWordWrapping,\r\n\t  .maximumNumberOfLines = 2\r\n }\r\n viewAttributes:{}]\r\n```\r\n```TEST THREE```\r\n```objc\r\n[CKLabelComponent\r\n newWithLabelAttributes:{\r\n\t  .font = [UIFont fontWithName:@\"LeituraNews-Roman2\" size:12],\r\n\t  .color = [UIColor blackColor],\r\n\t  .string = @\"TEST THREE four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty\",\r\n\t  .lineBreakMode = NSLineBreakByCharWrapping,\r\n\t  .maximumNumberOfLines = 2\r\n }\r\n viewAttributes:{}]\r\n```\r\n```TEST FOUR```\r\n```objc\r\n[CKLabelComponent\r\n newWithLabelAttributes:{\r\n\t  .font = [UIFont fontWithName:@\"LeituraNews-Roman2\" size:12],\r\n\t  .color = [UIColor blackColor],\r\n\t  .lineSpacing = 5.0f,\r\n\t  .string = @\"TEST FOUR five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty\",\r\n\t  .maximumNumberOfLines = 2\r\n }\r\n viewAttributes:{}]\r\n```\r\n```TEST FIVE```\r\n```objc\r\n[CKLabelComponent\r\n newWithLabelAttributes:{\r\n\t  .font = [UIFont fontWithName:@\"LeituraNews-Roman2\" size:12],\r\n\t  .color = [UIColor blackColor],\r\n\t  .lineSpacing = 5.0f,\r\n\t  .string = @\"TEST FIVE six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty\",\r\n\t  .lineBreakMode = NSLineBreakByWordWrapping,\r\n\t  .maximumNumberOfLines = 2\r\n }\r\n viewAttributes:{}]\r\n```\r\n```TEST SIX```\r\n```objc\r\n[CKLabelComponent\r\n newWithLabelAttributes:{\r\n\t  .font = [UIFont fontWithName:@\"LeituraNews-Roman2\" size:12],\r\n\t  .color = [UIColor blackColor],\r\n\t  .lineSpacing = 5.0f,\r\n\t  .string = @\"TEST SIX seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty\",\r\n\t  .lineBreakMode = NSLineBreakByCharWrapping,\r\n\t  .maximumNumberOfLines = 2\r\n }\r\n viewAttributes:{}]\r\n```"},"comment":{"url":"https://api.github.com/repos/facebook/componentkit/issues/comments/97282359","html_url":"https://github.com/facebook/componentkit/issues/155#issuecomment-97282359","issue_url":"https://api.github.com/repos/facebook/componentkit/issues/155","id":97282359,"user":{"login":"ocrickard","id":857665,"avatar_url":"https://avatars.githubusercontent.com/u/857665?v=3","gravatar_id":"","url":"https://api.github.com/users/ocrickard","html_url":"https://github.com/ocrickard","followers_url":"https://api.github.com/users/ocrickard/followers","following_url":"https://api.github.com/users/ocrickard/following{/other_user}","gists_url":"https://api.github.com/users/ocrickard/gists{/gist_id}","starred_url":"https://api.github.com/users/ocrickard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocrickard/subscriptions","organizations_url":"https://api.github.com/users/ocrickard/orgs","repos_url":"https://api.github.com/users/ocrickard/repos","events_url":"https://api.github.com/users/ocrickard/events{/privacy}","received_events_url":"https://api.github.com/users/ocrickard/received_events","type":"User","site_admin":false},"created_at":"2015-04-29T01:54:13Z","updated_at":"2015-04-29T01:54:13Z","body":"We use the default TextKit for the rendering of these, we don't do these ourselves.  If you render the same elements using UITextView do you get the same result?"}}