5 Replies Latest reply on Mar 13, 2009 2:17 PM by sstanleyau

    [AS CS3] Getting fonts of placed InDd docs (imported pages, or graphics)

    Level 1
      I need to get the status of fonts that are in InDd documents placed inside another InDd document. I can see the fonts in the "Find Font" window, and it shows me if the font is OK or missing. How would I get that information via script?
      Opening all the child documents is not really an option.
      Thanks,
      Chris
        • 1. Re: [AS CS3] Getting fonts of placed InDd docs (imported pages, or graphics)
          sstanleyau Level 4
          Such fonts should appear as fonts used by the document itself. As far as I<br />can see, there's no way to distinguish *where* a font has been used.<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Sessions <a href=http://scriptingmatters.com/aspro>
          • 2. Re: [AS CS3] Getting fonts of placed InDd docs (imported pages, or graphics)
            Level 1
            I tried "get every font" and that only lists the fonts native to the first document, not placed documents. "Count of fonts" gives the correct number of fonts used and also in imported documents. I can get the font name and status if I reference each font by a number, like "get name of font 23" or "get status of font 23". But, if any of those fonts from the imported page are missing, the script returns a different font's name and status. Such as, font 6 in my doc is missing, but it returns font 5's name and status.

            I'm gonna guess that this might be a bug, since only in the 5.04 patch was getting a missing font's name fixed (I believe).

            Really I only care if fonts are missing, not what their name is or anything else. But it seems like I can't find that out.
            • 3. Re: [AS CS3] Getting fonts of placed InDd docs (imported pages, or graphics)
              sstanleyau Level 4
              I got similar results when I tried with a slightly more complex document<br />than before. Assuming the count is correct, and that all you want to know is<br />whether any are missing, you could get the count, loop through asking for<br />the names by index, and then check whether all the names are unique.<br /><br />Something like this:<br /><br />tell application "Adobe InDesign CS3"<br />    set n to count of fonts of document 1 -- assume reliable<br />    set theFonts to fonts of document 1 -- assume unreliable<br />    if (count of theFonts) is not n then -- mismatch<br />        set fontNames to {}<br />        repeat with i from 1 to n<br />            set end of fontNames to name of font i of document 1<br />        end repeat<br />        -- see if font names are duplicated<br />        repeat with i from 1 to (n - 1)<br />            set oneFont to item 1 of fontNames<br />            set fontNames to rest of fontNames<br />            if fontNames contains oneFont then<br />                -- there's a duplicate<br />                set fontProblem to true<br />                exit repeat<br />            end if<br />            if i = n - 1 then<br />                -- no duplicates found<br />                set fontProblem to false<br />            end if<br />        end repeat<br />    else<br />        -- counts match, so all is well<br />        set fontProblem to true<br />    end if<br />end tell<br />return fontProblem<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Sessions <a href=http://scriptingmatters.com/aspro>
              • 4. Re: [AS CS3] Getting fonts of placed InDd docs (imported pages, or graphics)
                Level 1
                Shane,
                that's pretty nice! That's a pretty elegant solution.... I think.

                Just from the comments, do the last 2 "set fontProblems to" need switched T/F?

                Also, I'm seeing a problem that I don't know if it can be resolved. In our documents, we have placed many other documents. Many of them use the same font. I see a listing of fonts that contains 3 or 10 of the same font names in a row. Let's say all 10 placed documents use "Helvetica Regular" then it shows up 10 times. So perhaps this solution won't really work.

                But I really appreciate you putting the effort into making this.

                Chris
                • 5. Re: [AS CS3] Getting fonts of placed InDd docs (imported pages, or graphics)
                  sstanleyau Level 4
                  On 14/3/09 12:38 AM, "SuperMacGuy" <member@adobeforums.com> wrote:<br /><br />> Just from the comments, do the last 2 "set fontProblems to" need switched T/F?<br /><br />The last one, yes.<br />> <br />> Also, I'm seeing a problem that I don't know if it can be resolved. In our<br />> documents, we have placed many other documents. Many of them use the same<br />> font. I see a listing of fonts that contains 3 or 10 of the same font names in<br />> a row. Let's say all 10 placed documents use "Helvetica Regular" then it shows<br />> up 10 times. So perhaps this solution won't really work.<br /><br />That'll sink it nicely :-(<br /><br />Have you tried doing something like exporting a PDF to try to force ID to<br />update its list of fonts?<br /><br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Sessions <a href=http://scriptingmatters.com/aspro>