+
+ OSStatus status = noErr ;
+ ATSUTextLayout atsuLayout ;
+
+ wxMacUniCharBuffer unibuf( str ) ;
+ UniCharCount chars = unibuf.GetChars() ;
+
+ status = ::ATSUCreateTextLayoutWithTextPtr( unibuf.GetBuffer() , 0 , chars , chars , 1 ,
+ &chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
+
+ wxASSERT_MSG( status == noErr , wxT("couldn't create the layout of the text") );
+
+ status = ::ATSUSetTransientFontMatching( atsuLayout , true ) ;
+ wxASSERT_MSG( status == noErr , wxT("couldn't setup transient font matching") );
+
+ ATSLineLayoutOptions layoutOptions = kATSLineNoLayoutOptions ;
+
+ if (m_font.GetNoAntiAliasing())
+ {
+ layoutOptions |= kATSLineNoAntiAliasing ;
+ }
+
+ ATSUAttributeTag atsuTags[] =
+ {
+ kATSULineLayoutOptionsTag ,
+ } ;
+
+ ByteCount atsuSizes[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
+ {
+ sizeof( ATSLineLayoutOptions ) ,
+ } ;
+
+ ATSUAttributeValuePtr atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
+ {
+ &layoutOptions ,
+ } ;
+
+ status = ::ATSUSetLayoutControls(atsuLayout , sizeof(atsuTags)/sizeof(ATSUAttributeTag) ,
+ atsuTags, atsuSizes, atsuValues ) ;
+
+ ATSUTextMeasurement textBefore, textAfter ;
+ ATSUTextMeasurement textAscent, textDescent ;
+
+ status = ::ATSUGetUnjustifiedBounds( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
+ &textBefore , &textAfter, &textAscent , &textDescent );
+