Thread View: adobe.scripting.indesign
6 messages
6 total messages
Started by SuperMacGuy
Wed, 11 Mar 2009 17:09
[AS CS3] Getting fonts of placed InDd docs (imported pages, or graphics)
Author: SuperMacGuy
Date: Wed, 11 Mar 2009 17:09
Date: Wed, 11 Mar 2009 17:09
4 lines
970 bytes
970 bytes
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
Re: [AS CS3] Getting fonts of placed InDd docs (imported pages, or graphics)
Author: Shane_Stanley
Date: Wed, 11 Mar 2009 21:53
Date: Wed, 11 Mar 2009 21:53
6 lines
1432 bytes
1432 bytes
Such fonts should appear as fonts used by the document itself. As far as I can see, there's no way to distinguish *where* a font has been used. -- Shane Stanley <sstanley@myriad-com.com.au> AppleScript Pro Sessions <http://scriptingmatters.com/aspro>
Re: [AS CS3] Getting fonts of placed InDd docs (imported pages, or graphics)
Author: SuperMacGuy
Date: Thu, 12 Mar 2009 14:00
Date: Thu, 12 Mar 2009 14:00
5 lines
1397 bytes
1397 bytes
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.
Re: [AS CS3] Getting fonts of placed InDd docs (imported pages, or graphics)
Author: Shane_Stanley
Date: Thu, 12 Mar 2009 21:57
Date: Thu, 12 Mar 2009 21:57
39 lines
2715 bytes
2715 bytes
I got similar results when I tried with a slightly more complex document
than before. Assuming the count is correct, and that all you want to know is
whether any are missing, you could get the count, loop through asking for
the names by index, and then check whether all the names are unique.
Something like this:
tell application "Adobe InDesign CS3"
set n to count of fonts of document 1 -- assume reliable
set theFonts to fonts of document 1 -- assume unreliable
if (count of theFonts) is not n then -- mismatch
set fontNames to {}
repeat with i from 1 to n
set end of fontNames to name of font i of document 1
end repeat
-- see if font names are duplicated
repeat with i from 1 to (n - 1)
set oneFont to item 1 of fontNames
set fontNames to rest of fontNames
if fontNames contains oneFont then
-- there's a duplicate
set fontProblem to true
exit repeat
end if
if i = n - 1 then
-- no duplicates found
set fontProblem to false
end if
end repeat
else
-- counts match, so all is well
set fontProblem to true
end if
end tell
return fontProblem
--
Shane Stanley <sstanley@myriad-com.com.au>
AppleScript Pro Sessions <http://scriptingmatters.com/aspro>
Re: [AS CS3] Getting fonts of placed InDd docs (imported pages, or graphics)
Author: SuperMacGuy
Date: Fri, 13 Mar 2009 13:38
Date: Fri, 13 Mar 2009 13:38
10 lines
1260 bytes
1260 bytes
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
Re: [AS CS3] Getting fonts of placed InDd docs (imported pages, or graphics)
Author: Shane_Stanley
Date: Fri, 13 Mar 2009 22:17
Date: Fri, 13 Mar 2009 22:17
21 lines
1980 bytes
1980 bytes
On 14/3/09 12:38 AM, "SuperMacGuy" <member@adobeforums.com> wrote: > Just from the comments, do the last 2 "set fontProblems to" need switched T/F? The last one, yes. > > 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. That'll sink it nicely :-( Have you tried doing something like exporting a PDF to try to force ID to update its list of fonts? -- Shane Stanley <sstanley@myriad-com.com.au> AppleScript Pro Sessions <http://scriptingmatters.com/aspro>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads