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

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

204

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

Votes

Translate

Translate
Advocate , 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é

Votes

Translate

Translate
Adobe
Community Expert ,
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;
};

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
Advocate ,
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é

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