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

Font Size

$
0
0

Hello everyone!

I have a script that replaces sources.

// fonts to replace
var substitutions = [  ['Arial', 'Regular',         'Helvetica Neue LT Std', '45 Light'],
];
//  turn the substitutions into real fonts
var subsRight = [];
var fontCount = textFonts.length;
var subsCount = substitutions.length;
for (var i = 0; i < fontCount; i++) {  var font = textFonts[i];  for (var j = 0; j < subsCount; j++) {    if (substitutions[j][2] == font.family && substitutions[j][3] == font.style) {      subsRight[j] = font;    }  }
}


// replace the font
  var frames = doc.textFrames;  for ( var j = 0; j < frames.length; j++ ) {    var ranges = frames[j].textRanges;    for ( var k = 0; k < ranges.length; k++ ) {      var range = ranges[k];      for (var f = 0; f < subsCount; f++) {        if (range.characterAttributes.textFont.family == substitutions[f][0]          && range.characterAttributes.textFont.style == substitutions[f][1]) {          range.characterAttributes.textFont = subsRight[f];        }      }    }  }  redraw();

 

I must now replace the size. 10 to 9.5pt and from 8 to 6.5pt.

I believe it is possible but I'm still trying.

 

I appreciate if you can help.

Thank's!


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>