Scripting Variable Fonts in Illustrator

New Here ,
May 03, 2018 May 03, 2018

Copy link to clipboard

Copied

Hy there,

How can I set the parameters for a variable font?

The TextFont.axisVector is 'Read Only'

Greetings, Akiem

TOPICS
Scripting

Views

1.1K

Likes

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 ,
May 03, 2018 May 03, 2018

Copy link to clipboard

Copied

by definition, you cannot set read only properties.

I'm not familiar with the axisVector property. what is it and what does it do? What are you trying to change about the font?

Likes

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 ,
May 03, 2018 May 03, 2018

Copy link to clipboard

Copied

Since CC 2018 Illustrator is supporting Variable Fonts, a new version of OpenType. See here:

What You Can Do with Variable Fonts in Illustrator CC | Adobe Blog

So to get a specific weight, you are just choosing one with the slider provided by the character panel.

And after doing this, I can use within a script:

var appliedFont = selection.characters[0].textFont

$.writeln(appliedFont.axisVector)

I get an array with two values (because the font I am using has two axes): 190, 1000

And when I do this:

$.writeln(selection.appliedFont.characters[1].textFont)

I get: DuosInlinePro_190INLI_1000wght

Which actually means: Currently the font DuosInlinePro is used with the variable parameters:

190 for the INLI axis and 1000 for the weight axis

So how can I set the variable font axis by a script???

Likes

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 ,
May 03, 2018 May 03, 2018

Copy link to clipboard

Copied

There is no way by a script at the moment. This feature is to young for the old Illu DOM.

But you can do the following:

Create a new Action set. Give it a name eg Skript-Test2

Create actions and set there several values for axisVektor[1] eg 120, the next 240 and so on …

Give these actions the name what they do eg axisVektor-120

Call the action for the case you want by your script

app.doScript("axisVektor-120","Skript-Test2")

Have fun

Likes

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 ,
May 03, 2018 May 03, 2018

Copy link to clipboard

Copied

Ugh...

That's strange.

Are you 100% sure about that?

Likes

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 ,
May 03, 2018 May 03, 2018

Copy link to clipboard

Copied

up to 99%, sorry.

(but the method I described before - works)

Likes

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 ,
May 03, 2018 May 03, 2018

Copy link to clipboard

Copied

after almost 4 years of scripting illustrator.. i can attest to the fact that there is NOTHING strange about the Illustrator JavaScript API. Because if EVERYTHING is strange, then nothing is strange.

Much of the API appears to be have created in segments by different developers who had no contact with one another. Especially the app.executeMenuCommand() API.... The formatting of available arguments available for that method range from lowercase, to uppercase, to titlecase, to camelCase to title case with spaces... And then after that.. they neglected to provide ANY documentation for the functionality. they literally created a near impossible puzzle, then gave no clues....

There are no surprises when it comes to scripting illustrator anymore. i simply expect the worst, and exhibit bemused surprise when something works as expected.

Likes

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
Engaged ,
May 04, 2018 May 04, 2018

Copy link to clipboard

Copied

to quote Jack Reacher:

Hope for the best, plan for the worst.

Likes

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 ,
May 04, 2018 May 04, 2018

Copy link to clipboard

Copied

OK, 99% aint 100%.

There seems to be a solution... through the SDK.

Once I set the dynamic font name (like Font_190wdth_1000wght) beforehand through the SDK, I can use this within JSX.

So what I need would be a small simple plugin to do this, and then communicate to this plugin from jsx...

Anybody experience with this?

Likes

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 ,
May 07, 2018 May 07, 2018

Copy link to clipboard

Copied

You can push plugin from ExtendScript using sendScriptMessage method.

Likes

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
Enthusiast ,
Dec 24, 2019 Dec 24, 2019

Copy link to clipboard

Copied

There seems to be a solution... through the SDK.

 

=> Can you share this?

 

Likes

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 ,
Nov 02, 2019 Nov 02, 2019

Copy link to clipboard

Copied

Hi all,

Are there any updates regarding this? It would be really handy to make the axisVector property editable, it will open up many interesting possibilities for using Variable Fonts in scripts.

 

Likes

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
Enthusiast ,
Feb 10, 2020 Feb 10, 2020

Copy link to clipboard

Copied

2020: Can you set axisVector  by Script?

Likes

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 11, 2020 Feb 11, 2020

Copy link to clipboard

Copied

Sorry, but OMV Illustrator 24 Type Library says:

axisVector is still (Read Only)

Likes

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 Beginner ,
Jun 26, 2022 Jun 26, 2022

Copy link to clipboard

Copied

LATEST

Has anyone found a way to adjust the axes in variable type via script yet? It's 2022 and the axisVector property is still read-only. I thought maybe I could create a new TextFont object but that doesn't work either since there is no constructor, apparently.

 

I've just made a post on UserVoice about this, so please go there and vote if you want variable font support in Illustrator scripts.

https://illustrator.uservoice.com/forums/908050-illustrator-desktop-sdk-scripting-issues/suggestions...

Likes

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