0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【AppleScript+InDesign】InDesignドキュメント上の使用フォントのPDF埋め込み許可を調べる

Posted at

開かれている最前面のInDesignドキュメント上(配置されたInDesignドキュメントも含む)で使用されているフォントのPDF埋め込み許可を検査して、許可されていないフォントが存在した場合は、フォント名の一覧をダイアログに表示します。

InDesignドキュメント内にInDesignドキュメントが配置されている場合、使用フォントをfontsでまとめて取得すると、配置されているドキュメント上の使用フォントが、なぜかひとつだけ取得されるという不思議な挙動が…。(しかも、このフォントへのプロパティ参照はエラー…。)
ということで、フォント数のみを取得して以下の様な処理で回避。

※使用環境にインストールされていないフォントが使用されている場合などは、デフォルトフォントに置き換えられたりして正常に判定ができませんのでご注意を。

on run
	try
		tell application id "com.adobe.InDesign"
			activate
			if (count of documents) is 0 then error "ドキュメントが開かれていません。"
			
			set no_emb to ""
			tell document 1
				repeat with i from 1 to (count of fonts)
					if (allow PDF embedding of font i is false) then set no_emb to no_emb & "\r・" & (full name native of font i)
				end repeat
			end tell
			
			if (no_emb is "") then
				error "すべての使用フォントのPDF埋め込みが、許可されています。"
			else
				error ("以下のフォントのPDF埋め込みが、許可されていません。" & no_emb)
			end if
		end tell
		
	on error err_txt
		activate
		display dialog err_txt buttons {"OK"} default button 1 giving up after 60 * 10
		return
	end try
end run
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?