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.
2 Correct answers
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
...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();
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 )
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();
Copy link to clipboard
Copied
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.

