Copy link to clipboard
Copied
Hi 🙂
I am looking for a way to detect if a particular range of text is overflowing.
I have found the "overflows" property on Story and TextFrame, but I am missing something similar on Paragraph / Line / Text / ...
Am I missing something, or does anyone have a good method to check this?
Hi @device cmyk,
Testing whether the last InsertionPoint of the text has no parent text frame should usually work:
function isOverset(/*Text*/tx)
//----------------------------------
// `tx` :: any valid, singular text object (Paragraph, Line, Word, Character...)
// => bool
{
return !(tx.insertionPoints[-1].parentTextFrames||0).length;
}
// Test (assuming the selection has a parent story)
var word = app.selection[0].parentStory.words[-1];
alert( isOverset(word) );
But:
• It may not be the qu
...Copy link to clipboard
Copied
Only a text frame or story overflows. How does a paragraph or line overflow if not in its containing frame? You can always look at a line or paragraphs parent text frames or parent story.
Copy link to clipboard
Copied
Hi @brian_p_dts 🙂 Excuse my imprecise wording.
What I want to check is if the text is visible in the container or not.
I am not interested in checking the state of the container but in the text itself.
I imagine something like "isOverset" – Sort of like the isValid-property.
Copy link to clipboard
Copied
But that's exactly how it needs to be done - and how @Marc Autret code works - checks for existence of a ParentTextFrame.
Copy link to clipboard
Copied
Hi @device cmyk,
Testing whether the last InsertionPoint of the text has no parent text frame should usually work:
function isOverset(/*Text*/tx)
//----------------------------------
// `tx` :: any valid, singular text object (Paragraph, Line, Word, Character...)
// => bool
{
return !(tx.insertionPoints[-1].parentTextFrames||0).length;
}
// Test (assuming the selection has a parent story)
var word = app.selection[0].parentStory.words[-1];
alert( isOverset(word) );
But:
• It may not be the quickest method (?)
• A special treatment is required when tables/cells are involved.
Best,
Marc
Copy link to clipboard
Copied
Hi @Marc Autret.
Thank you for your answer! It's a big help!