• 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: ATSUI Performance Problem...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ATSUI Performance Problem...


  • Subject: Re: ATSUI Performance Problem...
  • From: "R. Scott Thompson" <email@hidden>
  • Date: Fri, 24 Sep 2004 08:17:35 -0500


On Sep 22, 2004, at 5:42 PM, Scott Pasko wrote:

Scott,

Thanks for your response.

On Sep 22, 2004, at 3:07 PM, R. Scott Thompson wrote:

Why do you say that the penalties are "seemingly artificial"?

I say that because I can create a fully line broken ATSUI layout object (for this big document) many times over FASTER then I can access this information from a single layout. To be clear, I don't need the bounds of each glyph, just the horizontal advance.

If you just need the horizontal advance then you might try ATSUGetGlyphInfo.


ATSUI rarely needs to know the glyph bounds of an entire layout full of text. Most of the time I would imagine it deals with them on a line-by-line basis in the worst case.

I would assume that these horizontal advances are necessary to properly compute line breaks (meaning all characters are mapped to their final glyphs, and kerning and ligatures are taken into account during line breaking). Is that a correct assumption ? If so, then it appears ATSUI can compute all of the advances in a very short amount of time, as it does the line breaking very efficiently.

ATSUGetGlyphBounds has quite a bit more work to do than just determining the the horizontal advance. If I understand the routine correctly it also has to look at the curves of the individual characters... at the very least it has to dig through the glyph tables a bit deeper. That can take a lot longer than simply looking up the horizontal advance. I believe (though I could be wrong) that ATSUI can get by with a lot less information than ATSUGetGlyphBounds returns in order to layout a line of text. It only takes the time to compute that information when you ask for it.


What are you doing with the glyph bounding information once you have it?

I have a C++ cell data structure that allows me to handle all of the rendering, layout, selection, caret interaction, and scrolling issues in a cross platform manner. It also allows me to render other types of media into the layout without involving ATSUI, making all of these features cross platform.

You're fighting upstream pretty hard to replace a lot of the same functionality that ATSUI already handles. Still, if all you need is the horizontal advances of the glyphs then you might look at ATSUGetGlyphInfo. Or...



One thing you might look into is ATSUnicodeDirectAccess.h this allows you to "hook into" the layout mechanism and adjust the layout of the glyphs after they have been set up by ATSUI but before they are actually drawn in the current context.

I will revisit this API. I did consider it once, but was unable to find the values I expected to find. But it has been awhile, I may have overlooked something.

Direct Access is the accepted way to find out about how the text is laid out at various stages. As a bonus you can also change the layout if you find you need to. It is very unlikely that ATSUI is going to lay out text exactly the same way as UniScribe or the layout engines of any other platform and if cross platform compatibility is important you may need Direct Access anyway to help make sure your documents are the same on both platforms.


Unfortunately the documentation is pretty scarce but both the advance deltas and (for caret positioning) device deltas are available through direct access. You should be able to pull out the deltas and cache them off for your own purposes pretty easily. From my (limited) experience with the Direct Access APIs the largest penalty you will play with the direct access API is the overhead of a few routine calls and then whatever your code happens to do.

--
Macintosh Software Engineering Consulting Services
Visit my resume at <http://homepage.mac.com/easco/RSTResume.html>

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: reusable custom views?
  • Next by Date: Re: Add duplicate menu items
  • Previous by thread: Menubar appearence in few OS 10.2.8 machines
  • Next by thread: Newbie:Attributed Text Strings and NSTextView
  • Index(es):
    • Date
    • Thread