0

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.

user2509945
  • 63
  • 1
  • 9

1 Answers1

1

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

  • Thanks, is it possible for the code to change font style according to incremental style names, i.e. 'Font '1', Font '2', Font '3', and so on (where normally it would be Font 'Light', Font 'Regular', Font 'Medium')? – user2509945 Aug 14 '13 at 08:35