• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

[JSX] Creating outlines of text path - different behavior of UI vs script

Community Expert ,
May 29, 2022 May 29, 2022

Copy link to clipboard

Copied

Hi all,

 

I have Ovals with a half circle path on them. I am trying to measure if the text exceeds half of the oval. My solution to that was to convert the path to an outline and measure its position relative to the halfway point of the circle. If I have the Oval selected in InDesign, and click Type >> Create Outlines, it converts the type path to a single Page Item with correct dimensions. Oval itself has no method .createOutlines();

However, I can't seem to mimic this behavior in script. I've tried variations of the following on the Oval object: 

oval.textPaths[0].texts[0].createOutlines();

oval.textPaths[0].parentStory.createOutlines();

 

If I run either of those two commands, each character is outlined separately as anchored objects on the path, and they get condensed as such. Please see attached screenshots for the oval object, and the outcomes from running the outline through InDesign vs. running it on the parent story of the text path via script. Thanks.

 

PS, if anyone has better ideas about how I might measure whether the text is longer than half way around its path, I'm all ears.  

TOPICS
Scripting

Views

342

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

correct answers 2 Correct answers

Community Expert , May 30, 2022 May 30, 2022

Hi Brian,

it's not the most exact method, but I would exploit the values for baseline and horizontalOffset of the first and the last insertion point. Hm, looking at your issue with creating outlines: know, that there is an argument to the method. Try to do a duplicated outline of the text and leave the original editable one alone.

 

oval.textPaths[0].texts[0].createOutlines( false );

 

From the DOM description about the argument:

"If true, deletes the original text. If false, creates the outline

...

Votes

Translate

Translate
Guru , May 30, 2022 May 30, 2022

Hi Brian,

Off the top of my head, as Uwe suggested we can set the deleteOriginal parameter to off. And then delete the original text object if necessary and/or reference to the outlined text for measurements.

Alternatively, as a workaround, we can select the object in question and invoke the menu item, like so:

app.menuActions.itemByID(61405).invoke();

2022-05-30_11-02-10.png

 

Votes

Translate

Translate
Community Expert ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

Hi Brian,

it's not the most exact method, but I would exploit the values for baseline and horizontalOffset of the first and the last insertion point. Hm, looking at your issue with creating outlines: know, that there is an argument to the method. Try to do a duplicated outline of the text and leave the original editable one alone.

 

oval.textPaths[0].texts[0].createOutlines( false );

 

From the DOM description about the argument:

"If true, deletes the original text. If false, creates the outlines as separate object(s) on top of the text. (Optional) (default: true)"

 

Regards,
Uwe Laubender
( Adobe Community Professional )

 

Votes

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
Guru ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

Hi Brian,

Off the top of my head, as Uwe suggested we can set the deleteOriginal parameter to off. And then delete the original text object if necessary and/or reference to the outlined text for measurements.

Alternatively, as a workaround, we can select the object in question and invoke the menu item, like so:

app.menuActions.itemByID(61405).invoke();

2022-05-30_11-02-10.png

 

Votes

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
Community Expert ,
Jun 06, 2022 Jun 06, 2022

Copy link to clipboard

Copied

LATEST

Thank you both for the replies, and apologies for the delay; this project got put on the backburner. Using (false) definitely did the trick, though I found it easier just to use Uwe's suggestion for getting the baseline of the insertion points for an approximate measurement. 

Votes

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