- createCharStyle(...)
createCharStyle(...)
Creates a character style. This function takes the following keyword parameters:
- "name" [required] -> name of the char style to create (first parameter)
- "font" [optional] -> name of the font to use (second parameter)
- fontsize [optional] -> font size to set (double) (third parameter)
- "features" [optional] -> nearer typographic details can be defined by a string that might contain the following phrases comma-separated (without spaces!) (fourth parameter - a string):
- inherit
- bold
- italic
- underline
- underlinewords
- strike
- superscript
- subscript
- outline
- shadowed
- allcaps
- smallcaps
- "fillcolor" [optional], fillshade [optional] -> specify fill options (5th parameter: string, 6th parameter: a float 1.0 = 100%)
- "strokecolor" [optional], strokeshade [optional] -> specify stroke options (7th parameter: string, 8th parameter: a float 1.0 = 100%)
- baselineoffset [optional] -> offset of the baseline (ninth parameter)
- shadowxoffset [optional], shadowyoffset [optional] -> offset of the shadow if used (10th and 11th parameters)
- outlinewidth [optional] -> width of the outline if used (12th parameter)
- underlineoffset [optional], underlinewidth [optional] -> underline options if used (13th and 14th parameters)
- strikethruoffset [optional], strikethruwidth [optional] -> strikethru options if used (15th and 16th parameters)
- scaleh [optional], scalev [optional] -> scale of the chars (17th and 18th parameters - float values, 1.0 = 100%)
- tracking [optional] -> tracking of the text (19th parameter - number with odd math, e.g. -50 = -5.0%)
- "language" [optional] -> language code (20th parameter - a string en = English)
- "fontfeatures" [optional] -> a string that contains a comma-separated list of OpenType font features (21th parameter - a string):
- Ligatures:
- -liga: disable common ligatures
- -clig: disable contextual ligatures
- +dlig: enable discretionary ligatures
- +hlig: enable historical ligatures
- Script Position:
- +subs: enable subscript
- +sups: enable superscript
- +ordn: enable ordinals
- Capitals:
- +smcp: enable small capitals
- +c2sc: enable small capitals from capitals
- +pcap: enable petite capitals
- +c2pc: enable petite capitals from capitals
- +unic: enable unicase
- +titl: enable titling
- Numerals:
- +lnum: enable lining figures
- +tnum: enable old style numerals
- Numeral Width:
- +pnum: enable proportional figures
- +tnum: enable tabular figures
- Numeral Fractions:
- +frac: enable diagonal fractions
- +afrc: enable stacked fractions
- Numeral zero:
- +zero: enable slashed zero
- Style sets:
- +ss01: enable 1st style set
- ...
- +ss20: enable 20th style set
Any style attribute not explicitly defined will have its value inherited from default character style.
Due to the important number of arguments of this function, it is strongly advised to use Python keyword syntax when calling this function. For example if a style needs to alter only font size, do not use this syntax:
newStyle = createCharStyle("New Style", "Arial Regular", 12)
but use this syntax instead:
newStyle = createCharStyle("New Style", fontsize=12)
For some guidance on this showing in particular how to set tracking, see the wiki page Text and Text Manipulation.
- createCustomLineStyle(...)
createCustomLineStyle(styleName, style)
Creates the custom line style 'styleName'.
This function takes list of dictionary as parameter for "style". Each dictionary represent one subline within style. Dictionary can have those keys:
- Color [optional] -> name of the color to use (string)
- Dash [optional] -> type of line to use (integer)
- LineEnd [optional] -> type of LineEnd to use (integer)
- LineJoin [optional] -> type of LineJoin to use (integer)
- Shade [optional] -> opacity of line (integer)
- Width [optional] -> width of line (double)
- createParagraphStyle(...)
createParagraphStyle(...)
Creates a paragraph style. This function takes the following keyword parameters:
- "name" [required] -> specifies the name of the paragraphstyle to create
- linespacingmode [optional] -> specifies the linespacing mode; possible modes are:
- fixed linespacing: 0
- automatic linespacing: 1
- baseline grid linespacing: 2
- linespacing [optional] -> specifies the linespacing if using fixed linespacing
- alignment [optional] -> specifies the alignment of the paragraph
- left: 0
- center: 1
- right: 2
- justify: 3
- extend: 4
- leftmargin [optional], rightmargin [optional] -> specify the margin
- gapbefore [optional], gapafter [optional] -> specify the gaps to the heading and following paragraphs
- firstindent [optional] -> the indent of the first line
- hasdropcap [optional] -> specifies if there are caps (1 = yes, 0 = no)
- dropcaplines [optional] -> height (in lines) of the caps if used
- dropcapoffset [optional] -> offset of the caps if used
- "charstyle" [optional] -> char style to use
- "bullet" [optional] -> string to use as bullet
- "tabs" [optional] -> a list of tab definitions
- a tab is defined as a tuple with the following format (position,type,fillchar)
- position [required] -> float value for the position
- type [optional] -> left: 0 [default], right: 1, period: 2, comma: 3, center: 4
- fillchar [optional] -> the char to fill the space; default is none
If you wish to skip a number of settings, unfortunately, this command will not accept null values, i.e., a series of commas. You must put some integer value for each of the potential parameters. For example, imagine you wish to only specify a name for the Paragraph Style, and the Character Style. Your command should be something like:
scribus.createParagraphStyle("MyNewStyle", 0, 0, 0, 0, 0, 0, 0, 0, 0, "MyCharStyle"))
On the other hand, if you only wanted to specify a name and linespacing mode, you can quit whenever after you finished with non-zero data:
scribus.createParagraphStyle("MyOtherNewStyle", 1)
- getAllStyles(...)
getAllStyles() -> list
Deprecated, use getParagraphStyles() instead.
- getCellStyles(...)
getCellStyles() -> list
Return a list of the names of all cell styles in the current document.
- getCharStyles(...)
getCharStyles() -> list
Return a list of the names of all character styles in the current document.
- getLineStyles(...)
getLineStyles() -> list
Return a list of the names of all line styles in the current document.
- getParagraphStyles(...)
getParagraphStyles() -> list
Return a list of the names of all paragraph styles in the current document.
- getTableStyles(...)
getTableStyles() -> list
Return a list of the names of all table styles in the current document.