Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Removing ligatures from certain fonts if tracking greater than 0

$
0
0

I'm importing files with certain fonts with tracking set at different sizes. Some fonts with certain ligatures don't work when tracking is set to anything higher than 0 without first turning off Standard Ligatures. I'm using a script that checks to see if those certain fonts are active and if so it then turns off ligatures for that font.

 

My javascript knowledge is very basic and I created this script from mostly copying and pasting and changing things I found in the scripting guide. So I'm sure my code could use some better organizing. I first had it with a bunch of if statements and then found out I could use the || to use multiple values so I thought that might be a better way to write it??

 

I want to add another if statement that first checks to see if these fonts have tracking set to anything greater than 0 and if so then turn the ligatures off, but if not keep them turned on. They work great when the tracking is at 0 and I would like to be able to use them still instead of completely disabling them.

 

var docRef = app.activeDocument;    for (var w = 0; w < docRef.textFrames.length; w++) {        var textRef = docRef.textFrames[w];        if ((textRef.textRange.characterAttributes.textFont == textFonts.getByName('Skitch')) ||            (textRef.textRange.characterAttributes.textFont == textFonts.getByName('AmarelinhaBold')) ||            (textRef.textRange.characterAttributes.textFont == textFonts.getByName('Amarelinha')) ||            (textRef.textRange.characterAttributes.textFont == textFonts.getByName('Zalderdash')) ) {            textRef.textRange.characterAttributes.ligature = false;        }    }

redraw();


 

Again I'm very new to javascript, but I think this should be a pretty simple addition? I'm honestly not even sure if the redraw(); is necessary? I do eventually want to add this to another import script.

 

Thanks for your time!


Viewing all articles
Browse latest Browse all 12845

Trending Articles