NSStringDrawingContext actualScaleFactor returns wrong value when NSParagraphStyle is used in an NSAttributedString
| Originator: | adamfischer1987 | ||
| Number: | rdar://26575435 | Date Originated: | 2016-June-01 |
| Status: | Duplicate/16754822 | Resolved: | |
| Product: | iOS SDK | Product Version: | iOS 8 and iOS 9 |
| Classification: | Reproducible: | yes |
Summary:
The method actualScaleFactor returns an incorrect value.
Steps to Reproduce:
Example code:
NSParagraphStyle *paragraphStyle = [NSParagraphStyle defaultParagraphStyle];
NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:20],
NSParagraphStyleAttributeName: paragraphStyle};
NSAttributedString *attributedString = [[NSAttributedString alloc]initWithString:@"Some long string. Some long string. Some long string." attributes:attributes];
NSStringDrawingContext *context = [[NSStringDrawingContext alloc]init];
context.minimumScaleFactor = 0.1;
[attributedString boundingRectWithSize:CGSizeMake(20, 100) options:NSStringDrawingUsesLineFragmentOrigin context:context];
CGFloat actualScaleFactor = context.actualScaleFactor;
Expected Results:
The text doesn't fit into the provided size, so actualScaleFactor shouldn't be 1, but a smaller number.
Actual Results:
If NSParagraphSyle is set, then the value of actualScaleFactor is always 1.
If NSParagraphSyle is not set, then actualScaleFactor works correctly, and shows a number less than 1.
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!