Altering text size to fit width of text frame

New Here ,
Feb 22, 2021 Feb 22, 2021

Copy link to clipboard

Copied

Hi,

When using a text box to house an article title my desired format is to change the size of the font for each line so that it fits the entire width of the text box but doesn't alter letter spacing. Is there an easy way to do this as I'm currently altering each line of text manually.

Thanks

TOPICS
How to, Type

Views

69

Likes

translate

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 1 Correct Answer

Adobe Community Professional , Feb 22, 2021 Feb 22, 2021
You might be able to script it, select the entire line and run this script:   var doc = app.documents.item(0); var s = doc.selection; var i = .1; if (s[0] == null || s[0].lines.length>1) { alert("Please select a single line of text") }else{ var l = s[0].lines[0] while (s[0].lines.length==1) { l.pointSize = l.pointSize + i } l.pointSize = l.pointSize - i }    

Likes

translate

Translate

Translate
Adobe Community Professional ,
Feb 22, 2021 Feb 22, 2021

Copy link to clipboard

Copied

You might be able to script it, select the entire line and run this script:

 

var doc = app.documents.item(0);
var s = doc.selection;
var i = .1;

if (s[0] == null ||  s[0].lines.length>1) {
	alert("Please select a single line of text")
}else{
    var l = s[0].lines[0]
    while (s[0].lines.length==1) {
       l.pointSize = l.pointSize + i
    }
    l.pointSize = l.pointSize - i
}

 

 

Screen Shot 11.pngScreen Shot 12.png

Likes

translate

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
New Here ,
Feb 22, 2021 Feb 22, 2021

Copy link to clipboard

Copied

Hi Rob,

Thanks for this, it's a big help! It's almost there but it doesn't seem to like when I do it on a sinlge word on a line of it's own, I get the below error and the hgihlighted text disappears:

 

Niall5E7D_0-1614017485799.png

The other issue that highlights is that I can't then undo back to the position prior to running the script.

Thanks again for your help on this

 

Likes

translate

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
Adobe Community Professional ,
Feb 22, 2021 Feb 22, 2021

Copy link to clipboard

Copied

Sorry, it would not work for a single word because the script is checking for the line to break and a single word or character wouldn’t necessarily break. Maybe someone else will have a better idea.

Likes

translate

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
New Here ,
Feb 22, 2021 Feb 22, 2021

Copy link to clipboard

Copied

Ok, thanks for your help it has made a big difference! 

Likes

translate

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