.jsx solution to list missing document fonts
Hi, as part of a larger script I'm tryng to capture a list of missing document fonts for InDesign2022.
I have what I think should work, something like this:
var doc = app.activeDocument;
var missingfonts = [];
for (var i=0; i < doc.fonts.length; i++) {
var doc_fontname = doc.fonts.item(i).name;
// var doc_fontname = doc.fonts[i].name; // <- alt def. of above line
var fontStatus = app.fonts.itemByName(doc_fontname).status.toString();
if (fontStatus == "NOT_AVAILABLE") {
missingfonts.push(doc_fontname);
}
}
$.writeln(missingfonts);
However: either way I define doc_fontname above, its value includes a repeat of the variant name after the fontname, eg: "Minion Pro ItalicItalic"; for every font except the font that is actually missing (which shows correctly, "Bodoni 72 Italic". Because of this, the names being wrong, all items show up as NOT_AVAILABLE.
I've seen this font.name issue in two other discussions, but not resolved, here and here.
Regardless, I'm really just looking for a way to get names of missing document fonts, so am open to other methods. Thank you!
