Some fonts is not recognized by InDesign

Hello
I have a strange problem when trying to make Paragraph styles in InDesign.

In the example below, the first “make new paragraph style” (Futura Bold) works fine but the second (Futura Heavy) fails with the error message “The requested font style is not available.” number 15874"…

I have both fonts available in InDesign.

Anyone who has an idea of why this happens?

tell application "Adobe InDesign CC 2014"
	
	tell active document
		make new paragraph style with properties {name:"Futura Bold", applied font:"Futura Std	Bold", font style:"Bold"}
		make new paragraph style with properties {name:"Futura Heavy", applied font:"Futura Std	Heavy", font style:"Heavy"}
	end tell
end tell

Cheers
Johan

EDIT: fixed a typo, font: should be applied font:

Model: Mac Book Pro
AppleScript: 2.8.1 (183.1)
Browser: Safari 537.36
Operating System: Mac OS X (10.11.6)

Hi again, realized that not all of you have the std Futura fonts, so I managed to repro the issue with Copperplate…
Copperplate regular works, but Light gives the same error as in my Futura-example:
“The requested font style is not available.” number 15874"

Happy for any thoughts from you guys!

tell application "Adobe InDesign CC 2014"
	
	tell active document
		make new paragraph style with properties {name:"Copperplate Regular", applied font:"Copperplate	Regular", font style:"Regular"}
		make new paragraph style with properties {name:"Copperplate Light", applied font:"Copperplate	Light", font style:"Light"}
	end tell
end tell

Model: Mac Book Pro
AppleScript: 2.8.1 (183.1)
Browser: Safari 537.36
Operating System: Mac OS X (10.11.6)

Got some help at Adobes scripting forum, thought I should share here…

It seems to be a bug, after checking that the fonts were loaded (they were).

I managed to do a workaround by (on error) saving the value of the original applied font, setting the font to Arial, make the new paragraph style with the properties of the Arial character and then set properties on the new style to the original applied font.

Like this:

 try

  make new paragraph style with properties ThePstyleProps & {name:NewName}

on error

  try

set DaFont to the applied font of character 2 of TheTextFrame

set properties of character 2 of TheTextFrame to {applied font:"Arial Regular"} ---------------------------------------

  set ThePstyleProps to properties of character 2 of text frame i

  make new paragraph style with properties ThePstyleProps & {name:NewName}

  set properties of paragraph style NewName to {applied font:DaFont}

Not the most beautiful workaround, but now it works :rolleyes:

Hi, Johan. Your code relies on font components being accurately user-specified at creation time. There’s a good chance that the font or style isn’t named what you think it is or sensibly should be. This may be a more sound approach:

tell application "Adobe InDesign CS3"
	set isName to (choose from list (fonts's name) as text)'s item 1
	tell (make document) to make new paragraph style with properties {name:isName, applied font:isName}
end tell

Hello Mark.
Well, actually, the “big” scripts takes the properties from the second (for a reason) character in every text frame (ThePstyleProps).

Then I try to apply the properties to the style as you can see in my last post:

make new paragraph style with properties ThePstyleProps & {name:NewName}

…it might be that it has the wrong name also in the properties… anyhow, my workaround in my last post makes it work at the end… :slight_smile:

Thanks for your input Mark!!!
Johan