How can I gradually change font across a text frame in InDesign?

1.4k Views Asked by At

I would like to change the Typeface or Font Weight across a text frame gradually either by character, word, line, sentance or so on (basically any grep function).

I am generating (or interpolating) fonts so that I have a font family with the weights 1,2,3,4,5,6,7 which would change in the above fashion.

Unfortunately I do not have the scripting skills at the moment... Basil.JS looks promising though. Any help would be appreciated.

1

There are 1 best solutions below

1
On

this should do the trick to change the font sizes of a characters, words and lines ...

for a sentence based interpolation you have to parse the content of the text frame according to '.' ... and then iterate in a second step over the individual groups of characters for each sentence. sadly indesign doesn't have a built-in collection for sentences.

hope that helps.

#includepath "~/Documents/;%USERPROFILE%Documents";
#include "basiljs/bundle/basil.js";

function draw() {
  var lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pellentesque ultrices dolor, vitae venenatis erat.";

  var tf = b.text(lorem, 0, 0, 300, b.height);

  // replace words with characters/words/lines/
  for (var i = 0; i < tf.words.length; i++) {
    tf.words[i].pointSize = b.map(i, 0,tf.words.length, 5,30);
  };
}

b.go();

see also the typography related basil.js examples: https://github.com/basiljs/basil.js/tree/master/examples/typography