I promise you that the font _is_ there. :(
OK, so I am having problems dynamically managing fonts in an automated build process.
To be clear;
a) I have a font
b) I really, really, really _know_ that I have this font
c) I checked again, the font _is_ there
Having checked all that, I search for the font using app.fonts.itemByName(fontName) and then try to _use_ the font that I _know_ that I have.
It works for roughly 650 out of 710 fonts.
For the others... I just see "The requested font style is not available."
_WHY_?
_WHY_?
Please, please, please...
Anybody?
Thanks,
G
| found.fontFamily : Baskerville | ||
| found.fontStyleName : Regular | ||
| found.fontStyleNameNative : Regular | ||
| found.fontType : 1718898516(OPENTYPE_TT) | ||
| found.fullName : Baskerville | ||
| found.fullNameNative : Baskerville | ||
| found.index : -1 | ||
| found.isValid : true | ||
| found.location : C:\Program Files\Adobe\Adobe InDesign CC 2014\Fonts\Baskerville.ttf | ||
| found.name : Baskerville | Regular | |
| found.ordering : | ||
| found.parent : [object Application] | ||
| found.platformName : Baskerville | ||
| found.postscriptName : Baskerville | ||
| found.properties : [object Object] | ||
| found.registry : | ||
| found.restrictedPrinting : false | ||
| found.status : 1718831470 (ok) | ||
| found.version : Version 1.00 | ||
| found.writingScript : 0 |
ERROR: {"fileName": "printFinal.jsx", "lineNumber": "368", "templateId": "TEMPLATE", "message": "The requested font style is not available.", "inputArguments": {}}
[code]
var found = app.fonts.itemByName(cleanedFontFamily);
function writeFontType(val) {
switch(val) {
case FontTypes.ATC : return "ATC";
case FontTypes.BITMAP: return "BITMAP";
case FontTypes.CID : return "CID";
case FontTypes.OPENTYPE_CFF : return "OPENTYPE_CFF";
case FontTypes.OPENTYPE_CID : return "OPENTYPE_CID";
case FontTypes.OPENTYPE_TT : return "OPENTYPE_TT";
case FontTypes.TRUETYPE : return "TRUETYPE";
case FontTypes.TYPE_1 : return "TYPE_1";
case FontTypes.UNKNOWN : return "UNKNOWN";
}
return "unknown";
}
this.debug("\tNATIVE:\n\t"+[
"found.fontFamily : "+found.fontFamily,
"found.fontStyleName : "+found.fontStyleName,
"found.fontStyleNameNative : "+found.fontStyleNameNative,
"found.fontType : "+found.fontType+"("+(writeFontType(found.fontType))+")",
"found.fullName : "+found.fullName,
"found.fullNameNative : "+found.fullNameNative,
"found.index : "+found.index,
"found.isValid : "+found.isValid,
"found.location : "+found.location,
"found.name : "+found.name,
"found.ordering : "+found.ordering,
"found.parent : "+found.parent,
"found.platformName : "+found.platformName,
"found.postscriptName : "+found.postscriptName,
"found.properties : "+found.properties,
"found.registry : "+found.registry,
"found.restrictedPrinting : "+found.restrictedPrinting,
"found.status : "+found.status+" ("+(found.status==FontStatus.INSTALLED?"ok":"investigate")+")",
"found.version : "+found.version,
"found.writingScript : "+found.writingScript
].join("\n\t"));
style.appliedFont = found;
[/code]
