Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Find area text with clipped copy?

Engaged ,
Nov 18, 2021 Nov 18, 2021

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...

TOPICS
Scripting, Type

Views

74

Likes

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

Adobe Community Professional , Nov 18, 2021 Nov 18, 2021
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...

Likes

Translate

Translate
Enthusiast , Nov 19, 2021 Nov 19, 2021
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é

Likes

Translate

Translate
Adobe Community Professional ,
Nov 18, 2021 Nov 18, 2021

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;
};

Likes

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
Enthusiast ,
Nov 19, 2021 Nov 19, 2021

Copy link to clipboard

Copied

LATEST

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é

Likes

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