Using createParagraphStyle: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
As in the companion piece, quotes around a parameter indicate it is a string surrounded by quotes, and the absence of quotes indicates a numerical value. | As in the companion piece, quotes around a parameter indicate it is a string surrounded by quotes, and the absence of quotes indicates a numerical value. | ||
=== | ===Command Elements=== | ||
: '''name''' – a string with the name of the style. Technically, this is only required element, but if you only want some of the options, then you must have an element for all the intervening ones. | |||
: '''linespacingmode''' – numeric integer value, which must be one of the following: | |||
:: 0 = fixed linespacing | |||
:: 1 = automatic linespacing | |||
:: 2 = align to baseline grid | |||
: '''linespacing''' – only applies for fixed linespacing. '''''Must be an integer''''', ''in fact, all of the numerical values in createParagraphStyle must be integers.'' | |||
: '''alignment''' – one of the following: | |||
:: 0 = left justification | |||
:: 1 = center justification | |||
:: 2 = right justification | |||
:: 3 = fully justified | |||
:: 4 = extend | |||
: '''leftmargin''' – indentation of the body of the paragraph. | |||
: '''rightmargin''' – indentation of the body of the paragraph. | |||
: '''gapbefore''' – we might also say ''gap above'' the paragraph. | |||
: '''gapafter''' – we might also say ''gap below'' the paragraph. | |||
: '''firstindent''' – indentation of the first line. ''This can be a negative value for a hanging indent, but make sure '''leftmargin''' has a larger absolute value or Scribus will hang when you apply this.'' | |||
: '''hasdropcap''' | |||
:: 0 = no | |||
:: 1 = yes | |||
: '''dropcaplines''' – the number of lines the dropcap will take up. | |||
: '''dropcapoffset''' – this is the space between the right edge of the drop cap and the first line(s) of text. | |||
: '''charstyle''' – a string with the name of the character style you wish to use in this paragraph style. |
Latest revision as of 00:53, 4 September 2011
This is something of a companion to Using createCharStyle.
Although in Scribus there is an implicit character style whenever you create a paragraph style, in Scripter these are two distinct commands, but we'll see how the two can be linked.
Here is the overall picture of syntax:
scribus.createParagraphStyle("name", linespacingmode, linespacing, alignment, leftmargin, rightmargin, gapbefore, gapafter, firstindent, hasdropcap, dropcaplines, dropcapoffset, "charstyle")
As in the companion piece, quotes around a parameter indicate it is a string surrounded by quotes, and the absence of quotes indicates a numerical value.
Command Elements
- name – a string with the name of the style. Technically, this is only required element, but if you only want some of the options, then you must have an element for all the intervening ones.
- linespacingmode – numeric integer value, which must be one of the following:
- 0 = fixed linespacing
- 1 = automatic linespacing
- 2 = align to baseline grid
- linespacing – only applies for fixed linespacing. Must be an integer, in fact, all of the numerical values in createParagraphStyle must be integers.
- alignment – one of the following:
- 0 = left justification
- 1 = center justification
- 2 = right justification
- 3 = fully justified
- 4 = extend
- leftmargin – indentation of the body of the paragraph.
- rightmargin – indentation of the body of the paragraph.
- gapbefore – we might also say gap above the paragraph.
- gapafter – we might also say gap below the paragraph.
- firstindent – indentation of the first line. This can be a negative value for a hanging indent, but make sure leftmargin has a larger absolute value or Scribus will hang when you apply this.
- hasdropcap
- 0 = no
- 1 = yes
- dropcaplines – the number of lines the dropcap will take up.
- dropcapoffset – this is the space between the right edge of the drop cap and the first line(s) of text.
- charstyle – a string with the name of the character style you wish to use in this paragraph style.