• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Pixel-perfect migration from ATSUI to Core Text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pixel-perfect migration from ATSUI to Core Text


  • Subject: Re: Pixel-perfect migration from ATSUI to Core Text
  • From: Andreas Falkenhahn <email@hidden>
  • Date: Thu, 01 Sep 2016 18:42:24 +0200

On 01.09.2016 at 15:44 Alastair Houghton wrote:

> On 1 Sep 2016, at 14:38, Andreas Falkenhahn <email@hidden> 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:email@hidden


_______________________________________________

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


  • Follow-Ups:
    • Re: Pixel-perfect migration from ATSUI to Core Text
      • From: Quincey Morris <email@hidden>
References: 
 >Re: Pixel-perfect migration from ATSUI to Core Text (From: Alastair Houghton <email@hidden>)
 >Re: Pixel-perfect migration from ATSUI to Core Text (From: Andreas Falkenhahn <email@hidden>)
 >Re: Pixel-perfect migration from ATSUI to Core Text (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Re: Pixel-perfect migration from ATSUI to Core Text
  • Next by Date: Re: Pixel-perfect migration from ATSUI to Core Text
  • Previous by thread: Re: Pixel-perfect migration from ATSUI to Core Text
  • Next by thread: Re: Pixel-perfect migration from ATSUI to Core Text
  • Index(es):
    • Date
    • Thread