-
1. Re: Changing the Font style in a Paragraph Style
secondgradersrule Aug 15, 2011 12:54 PM (in response to RichardM0701)Richard:
I am not an expert in InDesign scripting. But I just opened the Jongware DOM for ID5, and noticed that ParagraphStyle has an appliedFont property, but the style is known as fontStyle.
Dick Conrad
-
2. Re: Changing the Font style in a Paragraph Style
RichardM0701 Aug 15, 2011 1:05 PM (in response to secondgradersrule)As in the DOM is misleading or my code is wrong?
Sorry, kind of new to this stuff...
-
3. Re: Changing the Font style in a Paragraph Style
secondgradersrule Aug 15, 2011 1:18 PM (in response to RichardM0701)Richard:
Did you try it using fontStyle instead of appliedFontStyle? The DOM back to CS2 (at least) uses the shorter name.
Dick Conrad
-
4. Re: Changing the Font style in a Paragraph Style
[Jongware] Aug 15, 2011 1:48 PM (in response to RichardM0701)RichardM0701 wrote:
As in the DOM is misleading or my code is wrong?
Surely not! (That first one, by the way.) Check that same DOM page; ther eis no such thing as "appliedFontStyle" for Paragraphs.
You can hand over a font plus its associated style as either a font object (which you have to look up first), or as a string, but the string has to have a special format:
"family[tab]style"
and since this is Javascript, you must type the tab character as "\t":
myStyle.appliedFont = "Microsoft JhengHei\tBold";
(You also must be sure this font plus style combo actually exists, or else ID will still throw an error.)
This "trick" is not in the DOM command reference, because (uh) Adobe didn't think of mentioning it. But you shouldn't use the command reference for basic syntax, for that you need to read the Javascript Programming Guide from Adobe, and I'm pretty sure it gets mentioned in there.
-
5. Re: Changing the Font style in a Paragraph Style
RichardM0701 Aug 15, 2011 2:24 PM (in response to [Jongware])Thank you, it worked like a charm. I will look in the Scripting Guide to see if it is in there.
This stuff is so much fun
Thanks again,
Rich



