Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Text Measuring Issue



Tomas,

Thanks for the info. I did this another way, without using ATSUI directly,
that fit better into the (short) time I had and the existing architecture.
I'm using a combination of TruncateThemeText, followed by a CFStringTrim to
remove the ellipsis, then a GetThemeTextDimensions and ending with a
DrawThemeTextBox. Once that is complete, I trim the string I just drew from
the original string and start again.

I avoid breaking lines within words by searching backwards in the truncated
string for the first space and then only use what is before that.

I'd rather go with ATSUI directly though, as I suppose it would be faster,
so if I get a chance to rewrite this I'll look more closely at doing so.

Thanks!
brian
_____
Brian M. Criscuolo
DataViz, Inc. Engineering
email@hidden

> From: "Tomas Zahradnicky" <email@hidden>
> Date: Thu, 21 Aug 2003 02:25:46 -0400
> To: "Carbon Developer Forum" <email@hidden>
> Cc: "Brian Criscuolo" <email@hidden>
> Subject: Re: Text Measuring Issue
>
>> The best solution for this would be just to use ATSUI. It can do all of the
>> stuff you're wanting, and TXNDrawCFStringTextBox will eventually call down
>> to those APIs anyway. And, it's supported with older versions of the
>> operating system and CarbonLib, if that may be a concern for you.
>
> You need to create ATSUI layout and pass unicode text to it obrained
> with CFStringGetCharacters. Then create an ATSUI style
> (font,size,(color),qdbold,qditalic,kerning,hanging,justification,etc.)
> and apply that style on that layout. Then set layout's width to
> FIX(rectWidth(rect)) and finally use a loop to break lines to that
> width. After that you can enum lines line by line by getting line
> breaks and using ATSUGetGlyphBounds or ATSUMeasureTextImage (or
> obsolete ATSUMeasureText; puts warning in console).
>
> Download ATSUI sample code. It contains a lot of utility code which
> is really helpful.
>
> -Tomas
> --
> Ing. Tomas Zahradnicky, Jr.
> Production Manager, 24U Software
> Associate Member, Filemaker Solutions Alliance
> mailto:email@hidden
> http://www.24uSoftware.com
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.