Copy link to clipboard
Copied
Hello -
I was wondering how I could change the texte size of a button.
I tried already sveral "things" but nothing seems to work.
// PALETTE
// =======
var myPalette = new Window("palette");
myPalette.text = "DC TOOLS";
myPalette.orientation = "column";
myPalette.alignChildren = ["center","top"];
myPalette.spacing = 5;
myPalette.margins = 5;
var button1 = myPalette.add("button", undefined, "3D", {name: "button1"});
button1.graphics.font = ScriptUI.newFont ("Helvetica", "Bold", 30); // <— From p78 https://www.daube.ch/docu/fm-documentation/ExtendScript/ScriptUI_for_Dummies-%5BPeterKahrel%5D.pdf
// button1.pointSize = 30; —> Doesn't work, at least doesn't change anything
// button2.text.font.size = "30pt"; —> Doesn't work, at least doesn't change anything
// button2.text.characterAttributes.size = 30; —> Doesn't work, at least doesn't change anything
button2.alignment = ["left","top"];
myPalette.frameLocation = [ 1850, 70 ];
myPalette.show();
1 Correct answer
Hi Dimitri, I can confirm there's a problem with it. The below code works fine in the ESTK but it does nothing when run in Illustrator.
b.graphics.font = ScriptUI.newFont ("Minion Pro", "Italic", 60);
Explore related tutorials & articles
Copy link to clipboard
Copied
I don't understand the question. Why not just use another ScriptUI.newFont() with a another font size?
Copy link to clipboard
Copied
Hello -
Isn't what I have done here (or at least tried to do)?
button1.graphics.font = ScriptUI.newFont ("Helvetica", "Bold", 30);
Copy link to clipboard
Copied
Yes, that line should set font size to 30. Is it not working?
Copy link to clipboard
Copied
button1.graphics.font = ScriptUI.newFont ("Helvetica", "Bold", 30);
By dimitri_cas
that should work, have you tried with different fonts?
Copy link to clipboard
Copied
Hey Carlos -
Hey femkeblanco -
Thanks for your reply…
Nope, even with that line of code it doesn't change anything.
I tried "Verdana", "Tahoma", "Courier", …
Nothing changed
Copy link to clipboard
Copied
What about this
var font = "dialog"; // default font
var size1 = "30";
var size2 = "60";
var w = new Window("dialog");
var button1 = w.add("button", undefined, "button1");
button1.graphics.font = font + ":" + size1;
var button2 = w.add("button", undefined, "button2");
button2.graphics.font = font + ":" + size2;
w.show();
Copy link to clipboard
Copied
Hello again femkeblanco -
Strangely enough it looks exactly the same (cfr. screenshot).
I work on Mac PRO, OS Catalina (last available update), Illustrator 2022 (last update).
Copy link to clipboard
Copied
Hi Dimitri, I can confirm there's a problem with it. The below code works fine in the ESTK but it does nothing when run in Illustrator.
b.graphics.font = ScriptUI.newFont ("Minion Pro", "Italic", 60);
Copy link to clipboard
Copied
Hey Carlos 🙂
Thank you again for your reply.
I thought I had gone mad (or even ore than currently 😉 )
Any chance Adobe will take a look at it?
Have a great day…
- Dimitri
Copy link to clipboard
Copied
I think there is 99% chances they won't 🙂
Copy link to clipboard
Copied
OK… Thank you Carlos

