0 Replies Latest reply on Mar 29, 2013 8:04 PM by Yuliaart

    Replace document fonts in InDesign CS6, js

    Yuliaart Level 1



      I need to replace document fonts in InDesign. I get the existing fonts with following script, but not sure how to replace let's say Helvetica Regular with Aria Regular:



      for(var counter = 0; counter < document.fonts.length; counter++){

                  //If the <fontFamily> element for this font family does not already exist in the XML, add it.

                  if(counter > 0){


      fontFamilyName = document.fonts.item(counter).fontFamily;

                          fontFamilyName.toString().replace(/\s*\(TT\)$/gi, "");

                          alert (fontFamilyName);

                          fontName = document.fonts.item(counter).name;

                  alert (fontName);

                  fontName = fontName.split("\t");

                  fontStyle = fontName[1];

                  if(fontStyle == "BoldBold"){

                      fontStyle = "Bold";


                  fontName = fontName[0];

                  alert (fontName);





      Thank you.