Indesign is capable to access any opentype feature from a script.
Here a script to test a font with Character Variant in Indesign:
if( app.selection.length ) // do we have a selection?
if( app.selection[0].hasOwnProperty("opentypeFeatures") )
if( app.selection[0].opentypeFeatures.toSource()=="[[\"cv01\", 1]]" )
app.selection[0].opentypeFeatures = []; // reset to nothing
else
app.selection[0].opentypeFeatures=[["cv01",1]];
Copy this text to text editor and save wit jsx extension, ex: CV01.jsx.
Copy the file to indesign scripts directory.
Usually this directory in windows is: C:\Program Files\Adobe\Adobe InDesign 2021\Scripts\Scripts Panel\Scripts.
This is a simple script and You need to change the number of the "CVxx features" for every diferent "CVxx" and save with a different name.
This script is for "Character Variant 01"
Clicking one time to CVxx "On" and another to CVxx "Off".
I have test this feature using source code pro:
https://fonts.google.com/specimen/Source+Sans+Pro#standard-styleI know this is a simple script but please tell me what do you think?
Regards
Sami
Comments
Now I change the repository to public, try again, pleae.
Since the repo is a new one, I think the best thing to do would be to rename the repo, which will fix the URL and the reference. You can rename a repo by going into the settings.
It really hard for me making changes in Github.
Sami
Now You can digit the number of the Character Variant (always 2 algarisms) in your text selection.
To remove the feature click again and digit "00" or remove the numbers.
It is still a very simple script but now You don't need to create a script for every Character Variant feature number.
New link:
https://github.com/samiartur/Character-Variant-Java-Script-for-Indesign
Please let me know what you think.
Sami