Highlighted

variable font progression

New Here ,
Mar 03, 2020

Copy link to clipboard

Copied

Hi all

 

For a school project I need to make a variable font start off in one weight, and then have it gradually transition into another weight as the text progresses. 

 

Kind of like this:

[light] the quick brown fox [somewhere around regular] jumps over the lazy dog [bold]

 

Any idea how i might pull this off in inDesign?

 

Thanks!

TOPICS
How to, Scripting, Type

Views

136

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

variable font progression

New Here ,
Mar 03, 2020

Copy link to clipboard

Copied

Hi all

 

For a school project I need to make a variable font start off in one weight, and then have it gradually transition into another weight as the text progresses. 

 

Kind of like this:

[light] the quick brown fox [somewhere around regular] jumps over the lazy dog [bold]

 

Any idea how i might pull this off in inDesign?

 

Thanks!

TOPICS
How to, Scripting, Type

Views

137

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
Mar 03, 2020 0
New Here ,
Mar 03, 2020

Copy link to clipboard

Copied

I found this online, however i can't seem to get it to work. My font goes from light to bold on a single axis.

 

if (app.documents.length == 0)
{
alert (“No open documents!”);
exit ();
}
selectedText =app.selection[0].characters;
t=selectedText[0];
myDesignAxesName=t.appliedFont.designAxesName;
myDesignAxesRange=t.appliedFont.designAxesRange;
myDesignAxesValues=t.appliedFont.designAxesValues;
range=myDesignAxesRange[0];
w0=range[0];
w1=range[1];
stepping=(w1-w0)/selectedText.length;
for (s=0; s<selectedText.length; s++)
{
myDesignAxesValues[0]=(w0+stepping*s);
selectedText[s].designAxes=myDesignAxesValues;
}
alert(“Done”);

 

 

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
Reply
Loading...
Mar 03, 2020 0
Adobe Community Professional ,
Mar 03, 2020

Copy link to clipboard

Copied

The script only has variables set up for the weight axis. If you want both weight and width try this:

 

app.selection[0].appliedFont = "Acumin Variable Concept	Regular"
var selectedText = app.selection[0].characters;
var t = selectedText[0];
var myDesignAxesName = t.appliedFont.designAxesName;
var myDesignAxesRange = t.appliedFont.designAxesRange;
var myDesignAxesValues = t.appliedFont.designAxesValues;
var wrange = myDesignAxesRange[0];
var w0 = wrange[0];
var w1 = wrange[1];
var wstep = (w1-w0)/selectedText.length;
var crange = myDesignAxesRange[1];
var c0 = crange[0];
var c1 = crange[1];
var cstep = (c1-c0)/selectedText.length;

for (s=0; s<selectedText.length; s++){
    myDesignAxesValues[0]=(w0+wstep*s);
    myDesignAxesValues[1]=(c0+cstep*s);
    selectedText[s].designAxes=myDesignAxesValues;
}

 

Screen Shot 5.png

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
Reply
Loading...
Mar 03, 2020 2
New Here ,
Oct 30, 2020

Copy link to clipboard

Copied

Hi. I'm really interested in this script too. I'm trying to use it on ED Garamond Regular, a variable font from google fonts. When I run Rob's amended script I get an error, see screenshot attached. I'm a real novice with scripts, but is that because EB Garamond only has one variable axis - weight, from 400 to 800? If so, what bit of the script do I need to change to get it to work?

Thanks!

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
Reply
Loading...
Oct 30, 2020 0
New Here ,
Oct 30, 2020

Copy link to clipboard

Copied

Screen Shot 2020-10-30 at 13.58.41.png

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
Reply
Loading...
Oct 30, 2020 0
New Here ,
Oct 30, 2020

Copy link to clipboard

Copied

I've figured it out!

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
Reply
Loading...
Oct 30, 2020 0
New Here ,
Nov 09, 2020

Copy link to clipboard

Copied

I've been playing around with this script and it's really interesting to work with. How would I edit it so that only a selected range of the font's full range is used? For example, the font I'm working with has a weight range from 300 to 800, but I only want to use 300 to 600. Is there a way of doing 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
Reply
Loading...
Nov 09, 2020 0
Adobe Community Professional ,
Nov 09, 2020

Copy link to clipboard

Copied

Rather than getting the axis ranges you should be able to set them as variables:

 

app.selection[0].appliedFont = "Acumin Variable Concept	Regular"
var selectedText = app.selection[0].characters;
var t = selectedText[0];
var myDesignAxesValues = t.appliedFont.designAxesValues;

var w0 = 300;
var w1 = 600;
var c0 = 50;
var c1 = 100;

var wstep = (w1-w0)/selectedText.length;
var cstep = (c1-c0)/selectedText.length;

for (s=0; s<selectedText.length; s++){
    myDesignAxesValues[0]=(w0+wstep*s);
    myDesignAxesValues[1]=(c0+cstep*s);
    selectedText[s].designAxes=myDesignAxesValues;
}

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
Reply
Loading...
Nov 09, 2020 0
MrJL LATEST
New Here ,
Nov 09, 2020

Copy link to clipboard

Copied

Amazing, thank you!

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
Reply
Loading...
Nov 09, 2020 0