1 Reply Latest reply on May 13, 2008 7:59 AM by (Dave_Saunders)

    Replace Fonts Issue-Need Help! JS

      I need to replace an existing font in my document with an existing font that is not included in the document, but that I have on my system.

      I need something from here

      app.fonts.

      to replace something here

      app.activeDocument.fonts.

      I have a ton of files with fonts that don't have the necessary glyphs for central east languages. I use the find font/ replace with, but I'd love to declare and map out predefined substitutes....

      is this possible using Javascript? I'm stumped
        • 1. Re: Replace Fonts Issue-Need Help! JS
          Level 1
          Fonts do not replace themselves in the fashion your message seems to be envisaging.

          You can do some thing like this:

          myNewFont = app.fonts.item("FontName");
          myOldFont = app.activeDocument.fonts("OtherFont");

          but now you're going to have to search through all objects in your document to compare the appliedFont with myOldFont and if it is the same change to myNewFont.

          If character styles are involved, things get dicey because appliedFont returns a string in that case, which is the name of the font family only.

          If you in fact want to change the font family, you're still going to have to go through the same process, but now looking for the font family name instead (appliedFont.fontFamily).

          Can be messy if you're going to look in every nook and cranny.

          Dave