Copy link to clipboard
Copied
hi, i have write a javascript to run in indesign cs4. I have loaded 3 font family: Trajan, Helvetica and New Caledonia
As i am step thru' the code to load the font, i encounter strange problem:
---------------------------------------------------------------------------
var sty = doc.paragraphStyles.add({name:styName});
sty.appliedFont = "Trajan"; // -- always ok. It has a "Regular" style. I can use any other font as long as has "Regular" style
// however the immediate code will fail as it complains "The requested font family is not available" .
// It will only work if in Indesign, i select the font type to "New Caledonia" before the step thru the code
sty.appliedFont = "New Caledonia";
// The code will again fail as it complains "The requested font family is not available" UNLESS i select the Font in Indesign as "Helvetica" too
// Very very strange...
sty.appliedFont = "Helvetica";
------------------------------------------------------------------------------
However, if i use the 3 fonts family that has a "Regular" style , the 3 line of code will be ok...
Both the Helvetica and New Caledonia DOES NOT have "Regular" style..
HELP
Copy link to clipboard
Copied
I am using Window version of Indesign CS4...
Copy link to clipboard
Copied
hi Uwe, i think i didnt write clear enuff...
i have installed Trajan, Helvetica and New Caledonia into my PC.
When i launch CS4 , i can see that Trajan has Regular style but not the other 2 ( which i dont know why. I can see it in WinWord)
i step thru my script using ExtendScript ToolKit using the below script snippet to test the 3 font.
---------------------------------------------------------------------------
var sty = doc.paragraphStyles.add({name:styName});
sty.appliedFont = "Trajan";
sty.appliedFont = "New Caledonia";
sty.appliedFont = "Helvetica";
------------------------------------------------------------------------------
When i step to "Trajan" line, it's ok. But the next step will fail, which i dont understand. I have New Caledonia font.
But it complaint "The requested font family is not available"..
Now, before i step thru the script again, i purposely go to ID CS4 to set the font menu to "New Caledonia" ( at the top left hand corner )
Now when i step thru, the "Trajan and "NEw Caledonia" line is ok, BUT the script will fail at the next "Helvetica" line...
Strange enuff...i am lost...
However, if i change to following script, it will step thru successfully...All the below 3 fonts has "Regular" style
sty.appliedFont = "Trajan";
sty.appliedFont = "Times New Roman";
sty.appliedFont = "Arial";
Any advise?? =(
Message was edited by: fuzzyericlim
Copy link to clipboard
Copied
Hi, fuzzyericlim!
Use "fontStyle" for your font weight to define the style as well.
Example:
sty.appliedFont = "Univers";
sty.fontStyle="55 Roman";
Uwe