3 Replies Latest reply on Sep 12, 2008 7:08 AM by (Dave_Saunders)

    [JS CS3] Referencing a missing font in a paragraph style

    KeithGilbert Level 1
      I'm stuck on trying to figure out how to reference a font name in a paragraph style if the font is missing. I've got:<br /><br />for (myCounter=0; myCounter<app.documents.item(0).paragraphStyles.length; myCounter ++) {<br />   myParagraphStyle=app.documents.item(0).paragraphStyles.item(myCounter);<br />   if (myParagraphStyle.name.indexOf("[")!=0){<br />      if (myParagraphStyle.appliedFont.name == myFindFontName){<br />         myParagraphStyle.appliedFont = app.fonts.item(myChangeFontName);                            }}}<br /><br />The "myParagraphStyle.appliedFont.name" reference works properly as long as the font used in the paragraph style is present on the system. If the font is missing, then InDesign doesn't seem to "know" its name for me to reference in this manner.<br /><br />Does anyone know a way to do this? Thanks.
        • 1. Re: [JS CS3] Referencing a missing font in a paragraph style
          Peter Kahrel Adobe Community Professional & MVP
          >Does anyone know a way to do this?

          There isn't, unfortunately. What I do in such cases is to create a dummy font with the name of the missing font so that you can at least work with it. You need a font editor for that, but nothing fancy. Fontlab do a cheap font editor that you can use for that purpose.

          Peter
          • 2. Re: [JS CS3] Referencing a missing font in a paragraph style
            KeithGilbert Level 1
            Bummer! Thanks for letting me know, so I can stop banging my head against the wall trying to figure it out.

            Your approach with the dummy font is clever, but won't help me in this case. I'm trying to automate the "Find Font" process for a group of users. They've used a particular group of fonts for thousands of files, and are switching to a different family of fonts. They want to have ONLY the new family installed. So I wanted to create a script they could run the first time they open each file that would find each old font and replace it with the new font. My script works great for all the text in the file, but not the Paragraph and Character styles.

            Can anyone think of another approach? I'm out of ideas on this one.
            • 3. Re: [JS CS3] Referencing a missing font in a paragraph style
              Level 1
              You can get the information one of two ways I know of. Both of them involve exporting a text file and parsing it.

              Either, export some text that uses the style tagged text and parse that,
              or, export the document to .inx and parse that.

              Dave