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 protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to