Skip to main content
Inspiring
December 14, 2022
Question

Detect missing font with script

  • December 14, 2022
  • 2 replies
  • 613 views

You can find the name of a font with 

app.fonts.getByName(myLayer.textItem.font).name;

However, if the font is missing it'll throw an error. So we use try/catch

displayDialogs = DialogModes.NO; // OFF

var myLayer = app.activeDocument.activeLayer;
var msg = "";

try
{
var myFont = app.fonts.getByName(myLayer.textItem.font).name;
msg += "my font name: " + myFont;
}
catch(eek)
{
var myFont = undefined;
msg += "my font name: " + myFont;
}
alert(msg);

 

Is there another try/catch method I can use to determine if they are either:

(A) typekit/Adobe fonts

or

(B) fonts that have just been uninstalled?

 

Cheers

 

 

 

 

This topic has been closed for replies.

2 replies

Legend
December 14, 2022

Determine if font is type kit font 

List of missing fonts in Photoshop (.psd images)

 

You already asked a question about TypeKit fonts. In short, it's easy to get a list of installed TypeKit fonts on Windows, but the names of the fonts in the catalog are not always 100% the same as their PostScript names.

Out of the scope of the discussion, I tried to use the Levenshtein algorithm to evaluate the similarity of font names, however a) with a large number of installed fonts it works slowly b) false positives are still possible

Inspiring
December 14, 2022

Same problem. Different question. Different angle, different approach. - if that makes sense 😉

Legend
December 14, 2022

However, the answer remains the same - Photoshop doesn't provide any additional information to separate the system font from the typeKit font. Especially if the font is removed.

 

The only way is to interact with the list of fonts at fonts.adobe.com. You can collect the names of all available fonts manually or write a standalone program that will interact with this site. In any case, this is already beyond the capabilities of scripts.

Participating Frequently
December 14, 2022

InDesign, Photoshop, and Illustrator have Adobe Fonts (previously named Typekit) fully integrated with the desktop software. When you open a file that uses fonts which aren't available on your computer, the missing fonts window will show which of those fonts are included with your Creative Cloud subscription.

More info is here: https://helpx.adobe.com/in/fonts/kb/resolve-missing-fonts.html/Wellcare.com

 

 

Thanks,