Bug in 10.12 drawing glyph from labelFont or systemFont with bezier path
Bug in 10.12 drawing glyph from labelFont or systemFont with bezier path
- Subject: Bug in 10.12 drawing glyph from labelFont or systemFont with bezier path
- From: Jerome Krinock <email@hidden>
- Date: Thu, 11 Aug 2016 16:21:08 -0700
If you create a font using -labelFontOfSize: or -systemFontOfSize:, then send it a -glyphWithName message, then pass the resulting glyph and the font to -[NSBezierPath appendBezierPathWithGlyph:font:], the resulting bezier path draws several horizontal bars instead of the expected character glyph.
This code works as expected in 10.11, but fails when run in 10.12 Beta 4 or Beta 5.
NSFont* font = [NSFont labelFontOfSize:100] ;
NSGlyph g = [font glyphWithName:glyphName] ;
NSRect glyphRect = [font boundingRectForGlyph:g] ;
CGFloat offsetX = NSMidX(glyphRect) - halfWidth ;
CGFloat offsetY = NSMidY(glyphRect) - 50 ;
[path moveToPoint:NSMakePoint(-offsetX,-offsetY)] ;
[path appendBezierPathWithGlyph:g
inFont:font] ;
Anything wrong with that?
Workaround is to name font @“Helvetica” using -fontWithName:size:, instead of -labelFontOfSize: or systemFontOfSize:.
Apple Bug 27813593. Demo:
https://github.com/jerrykrinock/SSYVectorImageTester.git
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden