Re: Quick ATSUI question

From: Deborah Goldsmith (
Date: Wed Nov 20 2002 - 13:44:40 EST

  • Next message: Carl W. Brown: "Morse coded Unicode(was: Morse code"

    You should always keep ATSUStyle objects around as long as possible.

    Whether it's faster to keep ATSUTextLayout objects persistently or to
    create and then destroy them depends on your application. If you redraw
    the same paragraphs repeatedly, it's to your advantage to retain the
    ATSUTextLayout objects for those paragraphs in a cache. If you draw
    text once and then don't draw it again for a long time, you can either
    recycle the ATSUTextLayout object or create a new one; it's not that
    expensive to create the object.

    The things that are expensive are creating ATSUStyle objects and going
    through the layout process. For more information, see

    I strongly suggest you ask questions like this on the
    Carbon-Development mailing list rather than here on the Unicode list.
    You'll find many more people able and willing to help.

    Deborah Goldsmith
    Manager, Fonts & Unicode
    Apple Computer, Inc.

    On Wednesday, November 20, 2002, at 10:07 AM, Theodore H. Smith wrote:

    > Hi list,
    > I'd like to know which scheme turns out noticably faster. If neither
    > is noticably faster, then thats good to know.
    > 1) Using ATSUCreateTextLayoutWithTextPtr, then disposing the object,
    > and creating a new one for each paragraph. This means I have to reset
    > line controls and layout controls for each object.
    > 2) Using ATSUCreateTextLayout, then setting the styles one by one using
    > ATSUSetRunStyle? I will reuse the line controls and layout controls.
    > Thanks for your answer. I'm guessing the answer will be "1", or "2",
    > or "neither" :o). In other words, I don't need a detailed answer, but
    > if the whim takes you then do so.
    > --
    > Theodore H. Smith - Macintosh Consultant / Contractor.
    > My website: <>

    This archive was generated by hypermail 2.1.5 : Wed Nov 20 2002 - 14:39:31 EST