[scribus] createCharStyle: is this syntax right?
gregp_ky at yahoo.com
Fri Aug 26 00:00:45 UTC 2011
On 08/25/2011 03:49 PM, Fred Zimmerman wrote:
> One problem I am having with the Scripter documentation as a newbie is the
> absence of valid syntax examples with the function definitions. For
> Creates a character style. This function takes the following keyword
> leaves me guessing as to whether this is the right format:
> createCharStyle("Cover_Default", font= "LTC Italian Old Style", features =
> bold,smallcaps, strokecolor = "White")
> createParagraphStyle("Title", linespacingmode=1, alignment=1)
> createParagraphStyle("Body", linespacingmode=1, alignment=3)
I was thinking when I saw this the other day that the "documentation"
for this command is decidedly minimalist.
Here is the method I am using to sort this out:
Write a minimalist script that creates a style but doesn't apply it.
Start at the left hand end of these commands, beginning with one, then
gradually add them, one by one as you have success.
If the script runs, try applying the style and/or looking at it under
Edit > Styles.
Here is what I have learned so far.
A valid command might look something like this:
1. all you need is the value of the parameter, i.e., not
'name="experimental"', just "experimental".
2. the name of the font must conform to what Scribus lists in File >
Preferences, so in this case using the Cantarell font, your only valid
choices are "Cantarell Bold" or "Cantarell Regular". You *cannot* just
specify "Cantarell", and then in the features variable say "bold" --
doesn't work. I suspect that putting "bold" in features will have no
effect (or maybe cause an error).
3. font size is a float, therefore just use a number without parenteses.
4. Although you can stop with specifications at any time, you cannot
skip them. Let's say I didn't want to specify 'underline' here:
..."Cantarell Bold",10.5,,"Red"... is invalid
..."Cantarell Bold",10.5,"","Red"... is valid
5. Although it's not indicated in the online manual, the fillshade is a
float, and it's a decimal not a percentage, i.e., if you want 80%, you
specify '0.8'. Again, you can't skip this parameter if you want to
specify something later, so put in 1.0 if you don't want anything less
than 100% shade. [If you specify 100 for shade, Scribus crashes as soon
as you either apply the style or look at its parameters in Edit > Styles.]
This is about as far as I have gotten, so there may be more notes. Once
I get this sorted, I will write a wiki article.
More information about the scribus