Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Variable Font Parameters

Return to Member Forum

  • Author
    Posts
    • #1197033
      ll1324
      Member

      What is the way to access in a script the weight, width, and slant values for a variable opentype font such as Acumin Variable Concept?

      I was flipping through the possibilities looking at the debugger panel in Visual Studio Code; the fontFamily (etc.) appears, but can’t find an entry for (say) slant value. Weight appears for other thing (such as kenten or paragraph rules) but that’s unrelated.

      This is if one is setting these values for (say) a paragraph, word, or a character.

      Anyone has tried this yet?

    • #14323696
      ll1324
      Member

      Bother! After some fiddling around, found it out. Here’s an example of a quick script to change the weight of each character in a selection so that it goes from the lightest weight to the heaviest (the result is the text gets darker and darker the further along you go). Note: you have to already have applied the Acumin Variable Concept font to the selected text, and you also have to select the text itself (it will only do the selected text):

      //

      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”);

      // End.

    • #14323694
      David Blatner
      Keymaster

      Thanks for sharing that!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
Forum Ads