I want to rotate text.I am using a set of ATSUI API's for the same but it is failing at point (marked with arrow) mentioned below .Could you pls help me out.
void drawInclinedText(WindowRef
windowRef)
{
ATSUStyle myStyle ;
ATSUTextLayout myTextLayout ;
char strTypo = "Typography";
CGContextRef myCGContext ;
OSStatus osErr = 0;
UniCharCount count = 1;
ItemCount itemCount = 1 ;
ATSUAttributeTag theTags[] = {kATSUSizeTag} ;
ATSUAttributeTag theTags Layout[] = {kATSUCGContextTag};
ByteCount theSizes[] = {sizeof(Fixed)};
ByteCount theSizesLayout[] = {sizeof(CGContextRef)};
Fixed atsuSize = 12 ;
ATSUAttributeValuePtr theValues[] = {&atsuSize};
ATSUAttributeValuePtr theValuesLayout[] = {&myCGContext};
osErr = ATSUCreateStyle(&myStyle);
osErr = ATSUSetAttributes(myStyle,
1,theTags,
theSizes,t
heValues);
osErr = ATSUCreateTextLayout(&myTe
xtLayout);
osErr = ATSUSetRunStyle(myTextLayo
ut,myStyle
,1,strlen(
strTypo)-1
); <-------------------------
----------
----------
----------
--->
osErr = ATSUSetLayoutControls(myTe
xtLayout,i
temCount,t
heTagsLayo
ut,theSize
sLayout,th
eValuesLay
out);
osErr = ATSUSetTextPointerLocation
(myTextLay
out,(Unich
ar*)strTyp
o,kATSUFro
mTextBegin
ning,kATSU
ToTextEnd,
strlen(str
Typo));
osErr = QDBeginCGContext(GetWindow
Port(windo
wRef),&myC
GContext);
CGContextRotateCTM(myCGCon
text,60);
osErr = ATSUDrawText(myTextLayout,
kATSUFromT
extBeginni
ng,kATSUto
TextEnd,15
0,150);
CGContextFlush(myCGContext
);
osErr = QDEndCGContext(GetWindowPo
rt(windowR
ef),&myCGC
ontext);
ATSUDisposeStyle(myStyle);
}
The above code fails for the line marked with arrow and the textLayout object is set to invalid.
Start Free Trial