Justification attribute to center text in Illustrator API
Why do Justification to aiCenter and Align Center produce different results?
Given myLabel string with at least one line break character in it, when I use JavaScript code like this...
Set myFrame = textGroup.TextFrames.Add
myFrame.TextRange.CharacterAttributes.Size = defaultFontSize
myFrame.TextRange.CharacterAttributes.TextFont = appRef.TextFonts.Item(nameOfFont)
myFrame.Contents = myLabel
myFrame.Paragraphs(1).ParagraphAttributes.Justification = 2 ' aiCenter
myFrame.Position = Array(myXPos, myYPos)
...the lines of text are not centered with respect to each other.
Is there a way, using the JavaScript API, to achieve text-centering of multiple lines in a text frame?
If not, I'd like to request a new paragraph attribute to the JavaScript API to accomplish this function. (The risk of fixing Justification is that it might break implementations that already use it.)
Using Windows 10 Enterprise, and Illustrator 26.5.2.
-
Anonymous commented
CORRECTION to my earlier post - we're using VBscript, not Javascript.
"Given myLabel string with at least one line break character in it, when I use VBscript code like this..."
and
"Is there a way, using the VBscript API, to achieve text-centering of multiple lines in a text frame? If not, I'd like to request a new paragraph attribute to the VBscript API to accomplish this function. -
Related to this bug:
Justification bug, cannot set 'center' in v24.2 using AppleScript
http://illustrator.uservoice.com/forums/908050/suggestions/40869190 -
Anonymous commented
We're using this script to create dozens of figures. For those that require text centering, we must open the (otherwise) finished figure, and center the text.
While that's not time-consuming, there's always a chance that an instance will be missed, and the figure might be published with misaligned text.