UIFont fontWithSize method works incorrectly when used on a font returned from systemFontOfSize:weight:
| Originator: | argentumko | ||
| Number: | rdar://22007646 | Date Originated: | 27-Jul-2015 |
| Status: | Closed (Behaves correctly) | Resolved: | |
| Product: | iOS SDK | Product Version: | iOS 8.2+ |
| Classification: | Other Bug | Reproducible: | Always |
Summary: Calling fontWithSize: method on a system font returned from systemFontOfSize:weight: returns a font which has a different font name (and weight) than the original one, unless the weight is Regular or Medium. This affects both iOS 8.2+ and iOS 9 beta 4. Steps to Reproduce: Reproducing on iOS 8.4: 1. Retrieve a system font of weight UIFontWeightLight and size 20. Returned font is ".HelveticaNeueInterface-Light". 2. Call fontWithSize on the returned font to retrieve the same font, but with size 25. Expected Results: fontWithSize returns a font ".HelveticaNeueInterface-Light" with size 25. Actual Results: fontWithSize returns a font ".HelveticaNeueInterface-Regular". Version: iOS 8.2 and newer, including iOS 9 beta 4 Notes: To work around this issue, one can use this instead: newFont = [UIFont fontWithDescriptor:font.fontDescriptor size:25]; where "font" is the original font and 25 is the new point size necessary. Attached project contains a "testbed" of different system fonts passed through fontWithSize and through the workaround above. It shows that on both iOS 8.2+ and iOS 9 beta 4 (which has different system font families) fontWithSize works incorrectly with many system font weights, while the workaround works correctly for all weights. Configuration: Any hardware or simulator Attachments: 'SystemLightFontDemo.zip' was 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!
Apple Developer Relations
Engineering has determined that this issue behaves as intended based on the following information:
This is expected. You cannot manipulate a system font by name. Please see the WWDC 2015 talk on the new system UI font.