Core Text ignores paragraph spacing when using frame setters with custom shapes on iOS 7
| Originator: | speedup | ||
| Number: | rdar://15378681 | Date Originated: | 03-Nov-2013 01:40 PM |
| Status: | Resolved: | ||
| Product: | iOS SDK | Product Version: | 7 |
| Classification: | Reproducible: | Always |
Frederic Sagnes 03-Nov-2013 01:40 PM Summary: When sizing or drawing text paragraphs with Core Text using custom shapes created with CGPathCreateMutable (CGPathCreateWithRect will not trigger the issue), paragraph spacing parameters set with kCTParagraphStyleSpecifierParagraphSpacingBefore will be ignored. In my testing, even specifying an identical rectangular shape created with CGPathCreateMutable will trigger the issue. Sizing and drawing work fine when avoiding custom shapes or using CGPathCreateWithRect to create a rectangular shape. The behavior is correct on iOS 6 but fails on iOS 7. Steps to Reproduce: See the demo project that goes through these steps: * create a sample string @"First paragraph\u2029Second paragraph" * add a kCTParagraphStyleSpecifierParagraphSpacingBefore of 10 * measure it with CTFramesetterSuggestFrameSizeWithConstraints on a rect with width 320, it will return 40 (15 per line plus 10 for the paragraph spacing) * create a rectangular custom shape with CGPathCreateMutable and measure it by calling CTLineGetTypographicBounds on the last line, it will return 30 (15 per line, the paragraph spacing is ignored) * draw the text in both configuration, see that the paragraph has no spacing in the second case Expected Results: Both computations should return 40, and the paragraph spacing should appear in the second case, like it does on iOS 6 Actual Results: First computation returns 40, second returns 30, paragraph spacing does not appear in the second case Version: iOS 7.0.3 Notes: Workaround is to add a @"\n\n" string with text size 6 to emulate paragraph spacing Configuration: iOS 6.1 and iOS 7.0.3 simulator and devices on iPhone and iPad Attachments: 'CoreTextIssue-a00dc81.tar.gz', 'iOS 7.0 Paragraph Spacing Issue.png' and 'iOS 6.1 Paragraph Spacing Issue.png' were successfully uploaded.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!