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

New Here ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

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());

 

TOPICS
SDK

Views

30

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation