The requested font family is not available.
Hello guys, I'm having an error when try to replace a font using InDesign script like this:
function editTextFonts (openDoc, tfEditData, textFrame) {
var lines = textFrame.lines
var firstLine = lines.firstItem()
var oldFont = firstLine.appliedFont
if (!tfEditData.hasOwnProperty('font')) {
return oldFont
}
var font = tfEditData.font
var changeFont = oldFont.postscriptName.indexOf(font) === -1
if (!font || !changeFont) {
return oldFont
}
var newFont = findFontByPostscriptName(font, app.fonts)
if (newFont === null || newFont.status !== FontStatus.INSTALLED) {
return oldFont
}
for (var i = 0; i < lines.length; i++) {
var line = lines[i]
line.appliedFont = newFont.postscriptName
}
When tries to assign newFont.postscriptName in appliedFont I got the error: The requested font family is not available. I have checked and the font is properly installed, even the variable newFont has the status INSTALLED. Any help with this will be really appreciated
