Skip to main content
Inspiring
May 30, 2022
Answered

How to set the width of an AIArtHandle (textFrame) object

  • May 30, 2022
  • 1 reply
  • 256 views

I have the following code that creates "labels" (adds text to my document). That all works. What I want to do is to make the "labels" a uniformed width so that I can align them. The result will be that they all end at the same place when justified. Any suggestions? I was trying to use GetArtBounds(), GetArtTransformBounds() to set the width but no luck.

AIRealPoint anchor = { frmX, frmY };
AIArtHandle textFrame = NULL;
error = sAITextFrame->NewPointText(kPlaceAboveAll, NULL, kHorizontalTextOrientation, anchor, &textFrame);

//Create the ATE range
ATE::TextRangeRef textRangeRef = NULL;
error = sAITextFrame->GetATETextRange(textFrame, &textRangeRef);
ATE::ITextRange textRange(textRangeRef);

ATE::ICharFeatures features;
features.SetFontSize(fontSize);
features.SetFillColor(fontColor);
textRange.SetLocalCharFeatures(features);

// Set the contents of the text range.
textRange.InsertAfter(ai::UnicodeString(frmText).as_ASUnicode().c_str());

 

This topic has been closed for replies.
Correct answer Kazon23752888nou4

I was able to figure this one out.

1 reply

Kazon23752888nou4AuthorCorrect answer
Inspiring
July 4, 2022

I was able to figure this one out.