NSLayoutManager -boundingRectForGlyphRange: returning incorrect values
| Originator: | danielrhammond | ||
| Number: | rdar://15154377 | Date Originated: | 8/4/2013 |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 7.0 |
| Classification: | Reproducible: | Always |
Summary:
NSlayoutManager -boundingRectForGlyphRange:inTextContainer: does not return the correct value for glyph ranges that include part of a glyph that has been adjusted due to the automated font kerning.
For example (in sample project) calculating the bounding rect of the first glyph in the string "Te" when rendered with the system font on iOS generates a rect that does not contain the entirety of "T".
Calculating the rect of the second glyph includes part of the top of the "T" that was left out of the first rect. Which I think is expected because that space is required to fully bound the second glyph.
But it definitely seems to be a bug to have the first rect not fully contain the T. Alternatively, maybe it makes sense to adjust the glyph range returned from glyphRangeForCharacterRange:actualCharacterRange:
Steps to Reproduce:
1. Create a UITextView with the string "Te" and using the system font on iOS 7
2. Ask for the layout manager for the glyph range for the character range (glyphRangeForCharacterRange:actualCharacterRange:) {0,1}
3. Ask the layout manager for boundingRectForGlyphRange:inTextContainer: for that glyph range
Expected Results:
It is expected that the bounding rect returned is "enclosing all glyphs and other marks drawn in the given text container for the given glyph range..."
Actual Results:
The bounding rect only includes a portion of the glyph and taking a snapshot based on this rect will result in a truncated glyph.
Version:
7.0
Notes:
Configuration:
Attachments:
'BoundingRectKernExperiment.zip' was successfully uploaded.
Mirror: https://github.com/danielrhammond/layoutmanager-kerning-bug
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!