On 1 Sep 2016, at 14:38, Andreas Falkenhahn <andr...@falkenhahn.com> wrote: > > The problem is most likely that the “W” doesn’t start at x = 0 >> (have you tried calling CTLineGetOffsetForStringIndex(line, 0, NULL)?) > > That returns 0, that's why I was using 1.
Hmmm. OK, well looking at the documentation I suppose that makes sense (that’s apparently supposed to be used for caret positioning, so it might not even equal the advance width in general; in particular, ligature glyphs may well cause you problems). Have you tried getting the CTRun using CTLineGetGlyphRuns() and using CTRunGetPositions/CTRunGetAdvances()? Kind regards, Alastair. -- http://alastairs-place.net _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com