Question
X Scale value of character
I want the scale attribute of selected text.<br />I m using the following code:<br /> UID myID;<br /> InDesign::TextRange range(textFocus);<br /> rangeData = range.GetRange();<br /> <br /> // Query the compose scanner to access text attributes<br /> InterfacePtr<IComposeScanner> composeScanner(textModel, UseDefaultIID());<br /> if (composeScanner == nil) <br /> {<br /> ASSERT(composeScanner); return;<br /> }<br /> <br /> // Query attribute report interface<br /> int32 attrLen = 0;<br /> InterfacePtr<const IAttrReport> attrReport(composeScanner->QueryAttributeAt(rangeData, kTextAttrXGlyphScaleBoss, &attrLen));<br /> if (attrReport == nil) <br /> {<br /> return;<br /> }<br /> <br /> // Query the attribute interface<br /> InterfacePtr<ITextAttrUID> attr(attrReport, ITextAttrUID::kDefaultIID);<br /> if (attr == nil) <br /> {<br /> PMString msgrl("attr is nil");<br /> msgrl.SetTranslated();<br /> CAlert::InformationAlert(msgrl); <br /> return;//break;<br /> }<br /> <br /> // Get the attribute value.<br /> const ITextAttrUID::ValueType tempValue = attr->Get();<br /> myID = tempValue;<br /> IDataBase* db = ::GetDataBase(textModel);<br /> InterfacePtr<const ITextAttrRealNumber> attr1(db, myID, IID_ITEXTATTRREALNUMBER);<br /> if(attr1){<br /> PMReal rXScale = attr1->GetRealNumber();<br /> PMString msgrl("a");<br /> msgrl.AppendNumber(rXScale);<br /> msgrl.SetTranslated();<br /> CAlert::InformationAlert(msgrl); <br /> }<br /><br />I found value of attr is returned nil.