Skip to main content
Underware
Participating Frequently
May 3, 2018
Question

Scripting Variable Fonts in Illustrator

  • May 3, 2018
  • 7 replies
  • 2424 views

Hy there,

How can I set the parameters for a variable font?

The TextFont.axisVector is 'Read Only'

Greetings, Akiem

This topic has been closed for replies.

7 replies

justinpenner
Participating Frequently
June 26, 2022

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/45356026-variable-font-support-in-scripts

pixxxelschubser
Community Expert
Community Expert
February 11, 2020

Sorry, but OMV Illustrator 24 Type Library says:

axisVector is still (Read Only)

daitranthanhoa
Inspiring
February 10, 2020

2020: Can you set axisVector  by Script?

rbtjns
Participant
November 2, 2019

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.

 

Underware
UnderwareAuthor
Participating Frequently
May 4, 2018

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?

Ten A
Community Expert
Community Expert
May 7, 2018

You can push plugin from ExtendScript using sendScriptMessage method.

Underware
UnderwareAuthor
Participating Frequently
May 3, 2018

Ugh...

That's strange.

Are you 100% sure about that?

pixxxelschubser
Community Expert
Community Expert
May 3, 2018

up to 99%, sorry.

(but the method I described before - works)

Disposition_Dev
Legend
May 3, 2018

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?

Underware
UnderwareAuthor
Participating Frequently
May 3, 2018

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???

pixxxelschubser
Community Expert
Community Expert
May 3, 2018

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