Copy link to clipboard
Copied
In ExtendScript, is there a way I can determine if a piece of area text is too small to display all of the text contents? In otherwords, if the copy overflows the shape and is clipped off...
Here's a function I use. Shamelessly stolen from @Silly-V
function isOverset(frame)
{
if (frame.kind == TextType.POINTTEXT)
{
return false;
}
if (frame.lines.length == 1 && frame.paragraphs.length == 1)
{
// single line
if (frame.lines[0].characters.length < frame.characters.length)
{
return true;
}
else
{
return false;
}
}
else
{
// multiline
var lineLength = frame.lines.length;
var allContentArr = frame.contents.split(/[\x03\r\n]/g);
var allContentReturn
...
Bonjour à tous,
Peut-être que je n'ai pas bien compris la demande de jsavage77,
mais voici ma version:
function isOverset1(frame) {
with (frame) {
var nbcarLine = paragraphs.length-1;
for (var i = 0; i < lines.length; i++) {
nbcarLine += lines[i].characters.length;
}
return nbcarLine != characters.length ? true : false;
}
}
René
Copy link to clipboard
Copied
Here's a function I use. Shamelessly stolen from @Silly-V
function isOverset(frame)
{
if (frame.kind == TextType.POINTTEXT)
{
return false;
}
if (frame.lines.length == 1 && frame.paragraphs.length == 1)
{
// single line
if (frame.lines[0].characters.length < frame.characters.length)
{
return true;
}
else
{
return false;
}
}
else
{
// multiline
var lineLength = frame.lines.length;
var allContentArr = frame.contents.split(/[\x03\r\n]/g);
var allContentReturnsLength = allContentArr.length;
var lastLineContent = frame.lines[lineLength - 1].contents;
var lastAllContentContent = allContentArr[allContentReturnsLength - 1];
return !(allContentReturnsLength == lineLength && (lastLineContent == lastAllContentContent));
}
return false;
};
Copy link to clipboard
Copied
Bonjour à tous,
Peut-être que je n'ai pas bien compris la demande de jsavage77,
mais voici ma version:
function isOverset1(frame) {
with (frame) {
var nbcarLine = paragraphs.length-1;
for (var i = 0; i < lines.length; i++) {
nbcarLine += lines[i].characters.length;
}
return nbcarLine != characters.length ? true : false;
}
}
René