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



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.

References: 
 >Re: Text Measuring Issue (From: "Gary L. Wade" <email@hidden>)



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.