> On 16 Dec 2015, at 19:02, eric g <[email protected] 
> <mailto:[email protected]>> wrote:
> 
> I was expecting the emoji to be drawn in the lower left corner and do not
> understand why is the character drawn so high. Why is the emoji drawn
> where it is drawn?

The horizontal padding is caused by the text containers lineFragmentPadding.

Concerning the vertical offset, you can find the following in the docs of 
-drawGlyphsForGlyphRange:atPoint:
"This method expects the coordinate system of the view to be flipped."

I'm not sure how to make your context flipped, the following works but is 
deprecated:
NSGraphicsContext.setCurrentContext(NSGraphicsContext(CGContext: 
binContext.CGContext, flipped: true))

But then you also need to change the current transformation matrix to make the 
end result upright:
let t = NSAffineTransform()
t.translateXBy(0, yBy: kSquareSize)
t.scaleXBy(1, yBy: -1)
t.concat()

I assume that probably it would be easier to use Core Text for drawing to a 
Bitmap Context.

Jakob

_______________________________________________

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