Font resizing in JavaScript code

Explorer ,
Nov 28, 2020

Copy link to clipboard

Copied

Hi
I have a code that shows a calculation of round corners of a rectangle in illustrator
I need the result of the calculation to be in a 24-inch font
I attach the code:

 


// select round-cornered rectangle
var points = app.selection[0].pathPoints;
var x1 = points[3].anchor[0], x2 = points[4].anchor[0];
var y1 = points[3].anchor[1], y2 = points[4].anchor[1];
var rect1 = app.activeDocument.pathItems.rectangle(y1 + 20, x2 - 60, 50, 20);
var text2 = app.activeDocument.textFrames.areaText(rect1);
text2.contents = +(Math.round((Math.abs(x2 - x1)*0.352777777)+ "e+3") + "e-3");
text2.contents = "r.=" + text2.contents;

TOPICS
Scripting

Views

66

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
aviel222 AUTHOR
Explorer ,
Nov 28, 2020

Copy link to clipboard

Copied

It is very important that as the size changes, the text box will also grow.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Nov 28, 2020

Copy link to clipboard

Copied

Why do you not simple use the same font size from previous part of the script (specify.jsx)?

…
t.textRange.characterAttributes.size = labelFontInUnits;
…

 

(untestet) as

…
text2.textRange.characterAttributes.size = labelFontInUnits;
…

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
aviel222 AUTHOR
Explorer ,
Nov 28, 2020

Copy link to clipboard

Copied

I sent you a message in private.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Nov 28, 2020

Copy link to clipboard

Copied

Sorry, but unfortunately not at the moment.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more