On 01.09.2016 at 15:44 Alastair Houghton wrote: > 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). I know but currently I'm just trying to replicate the exact ATSUI look and on ATSUI I use ATSURightwardCursorPosition() so I think CTLineGetOffsetForStringIndex() or CTRunGetAdvances() are the appropriate Core Text equivalents here. > Have you tried getting the CTRun using CTLineGetGlyphRuns() and > using CTRunGetPositions/CTRunGetAdvances()? Yes. CTRunGetPositions() obviously returns just 0 for the "W" string and CTRunGetAdvances() returns exactly the same as CTLineGetOffsetForStringIndex(), i.e. 36.81005859375 but ATSUI gives me 38. -- Best regards, Andreas Falkenhahn mailto:andr...@falkenhahn.com _______________________________________________ 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