Copy link to clipboard
Copied
Hi all,
I have some troubles to check if a font is correcty installed. I'm writting a script who use the property character.appliedFont.location.
1) I would like to check if the fonts in the document are correcty installed (The fonts are installed in the document only -> a folder Document fonts with a package).
- But if I check each font in the document -> every font is installed
- Then if I would like to use my property from a textframe object I figure it out that the font isn't installed
I do not understand why the result of font.status is different when I called it from a textframe?
if (document === undefined) {
var document = app.activeDocument;
}
var fonts = document.fonts.everyItem().getElements();
for(var i = 0; i < fonts.length; i++){
if(fonts[i].status !== FontStatus.INSTALLED) {
//return true;
alert('no font are uninstalled');}
}
var textframes = document.pages[0].textFrames;
/**
* @todo ask why this function do not work!!!
*/
for (var i = 0; i < textframes.length; i++) {if (textframes[i].characters[0].appliedFont.status !== FontStatus.INSTALLED) {
alert('every textframe font are unavailable');
}
}
return false;
I advance, thank you for the reply
Best regards.
Copy link to clipboard
Copied
Hi bastieneichenberger ,
this is an old thread and you may have found what the issue is behind your checks with status !== FontStatus.INSTALLED .
Just did some tests with InDesign CC 2019 on Windows 10.
For the same used font in my document:
app.documents[0].fonts[0].status == FontStatus.INSTALLED // returns true
app.selection[0].characters[0].appliedFont.getElements()[0].status == FontStatus.NOT_AVAILABLE // returns true
What's going on here?
The font is available only through the Document fonts folder.
Expected:
app.fonts cannot see this font.
Install the font through e.g. InDesign's Fonts folder in the Application folder and check again:
The value of status is changing to FontStatus.INSTALLED for all three tests:
app.fonts ,
app.documents[0].fonts
app.selection[0].appliedFont
Regards,
Uwe
Copy link to clipboard
Copied