Thursday, September 20, 2018

#1 2018-07-12 01:52:26 am

KRAFTWERK
Member
From:: SWEDEN
Registered: 2004-10-19
Posts: 32

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?

Applescript:

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)

Last edited by KRAFTWERK (2018-07-12 03:15:41 am)

Offline

 

#2 2018-07-12 06:00:05 am

KRAFTWERK
Member
From:: SWEDEN
Registered: 2004-10-19
Posts: 32

Re: Some fonts is not recognized by InDesign

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!

Applescript:

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)

Offline

 

#3 2018-07-17 03:24:31 am

KRAFTWERK
Member
From:: SWEDEN
Registered: 2004-10-19
Posts: 32

Re: Some fonts is not recognized by InDesign

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:



Applescript:

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 roll

Offline

 

#4 2018-07-17 06:22:40 pm

Marc Anthony
Member
From:: Dallas, TX
Registered: 2006-04-27
Posts: 819

Re: Some fonts is not recognized by InDesign

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:

Applescript:

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

Offline

 

#5 2018-07-18 06:35:36 am

KRAFTWERK
Member
From:: SWEDEN
Registered: 2004-10-19
Posts: 32

Re: Some fonts is not recognized by InDesign

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... smile

Thanks for your input Mark!!!
Johan

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)