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

Font resizing in JavaScript code

Explorer ,
Nov 28, 2020 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

148

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
Explorer ,
Nov 28, 2020 Nov 28, 2020

Copy link to clipboard

Copied

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

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
Community Expert ,
Nov 28, 2020 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;
…

 

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
Explorer ,
Nov 28, 2020 Nov 28, 2020

Copy link to clipboard

Copied

I sent you a message in private.

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
Community Expert ,
Nov 28, 2020 Nov 28, 2020

Copy link to clipboard

Copied

LATEST

Sorry, but unfortunately not at the moment.

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