Subversion Repositories Scribus

Rev

Rev 22948 | Rev 23168 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
22948 jghali 1
<html>
2
<head>
3
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
4
        <title>Creating and Manipulating Styles</title>
5
</head>
6
<style>
7
@import "manual.css";
8
</style>
9
<body>
10
<h2>Creating and Manipulating Styles</h2>
11
 
12
<dl>
13
 
14
<dt><a name="-createCharStyle"><strong>createCharStyle</strong></a>(...)</dt>
15
<dd><code>createCharStyle(...)</code>
16
<p>Creates a character style. This function takes the following keyword parameters:
17
<ul>
18
<li>"name" [required] -> name of the char style to create (first parameter)</li>
19
<li>"font" [optional] -> name of the font to use (second parameter)</li>
20
<li>fontsize [optional] -> font size to set (double) (third parameter)</li>
21
<li>"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):
22
<ul>
23
        <li>inherit</li>
24
        <li>bold</li>
25
        <li>italic</li>
26
        <li>underline</li>
27
        <li>underlinewords</li>
28
        <li>strike</li>
29
        <li>superscript</li>
30
        <li>subscript</li>
31
        <li>outline</li>
32
        <li>shadowed</li>
33
        <li>allcaps</li>
34
        <li>smallcaps</li>
35
</ul>
36
</li>
37
<li>"fillcolor" [optional], fillshade [optional] -> specify fill options (5th parameter: string, 6th parameter: a float 1.0 = 100%)</li>
38
<li>"strokecolor" [optional], strokeshade [optional] -> specify stroke options (7th parameter: string, 8th parameter: a float 1.0 = 100%)</li>
39
<li>baselineoffset [optional] -> offset of the baseline (ninth parameter)</li>
40
<li>shadowxoffset [optional], shadowyoffset [optional] -> offset of the shadow if used (10th and 11th parameters)</li>
41
<li>outlinewidth [optional] -> width of the outline if used (12th parameter)</li>
42
<li>underlineoffset [optional], underlinewidth [optional] -> underline options if used (13th and 14th parameters)</li>
43
<li>strikethruoffset [optional], strikethruwidth [optional] -> strikethru options if used (15th and 16th parameters)</li>
44
<li>scaleh [optional], scalev [optional] -> scale of the chars (17th and 18th parameters - float values, 1.0 = 100%)</li>
45
<li>tracking [optional] -> tracking of the text (19th parameter - number with odd math, e.g. -50 = -5.0%)</li>
46
<li>"language" [optional] -> language code (20th parameter - a string en = English)</li>
47
<li>"fontfeatures" [optional] -> a string that contains a comma-separated list of OpenType font features (21th parameter - a string):
48
<ul>
49
    <li>Ligatures:
50
        <ul>
51
            <li>-liga: disable common ligatures</li>
52
            <li>-clig: disable contextual ligatures</li>
53
            <li>+dlig: enable discretionary ligatures</li>
54
            <li>+hlig: enable historical ligatures</li>
55
        </ul>
56
    </li>
57
    <li>Script Position:
58
        <ul>
59
            <li>+subs: enable subscript</li>
60
            <li>+sups: enable superscript</li>
61
            <li>+ordn: enable ordinals</li>
62
        </ul>
63
    </li>
64
    <li>Capitals:
65
        <ul>
66
            <li>+smcp: enable small capitals</li>
67
            <li>+c2sc: enable small capitals from capitals</li>
68
            <li>+pcap: enable petite capitals</li>
69
            <li>+c2pc: enable petite capitals from capitals</li>
70
            <li>+unic: enable unicase</li>
71
            <li>+titl: enable titling</li>
72
        </ul>
73
    </li>
74
    <li>Numerals:
75
        <ul>
76
            <li>+lnum: enable lining figures</li>
77
            <li>+tnum: enable old style numerals</li>
78
        </ul>
79
    </li>
80
    <li>Numeral Width:
81
        <ul>
82
            <li>+pnum: enable proportional figures</li>
83
            <li>+tnum: enable tabular figures</li>
84
        </ul>
85
    </li>
86
    <li>Numeral Fractions:
87
        <ul>
88
            <li>+frac: enable diagonal fractions</li>
89
            <li>+afrc: enable stacked fractions</li>
90
        </ul>
91
    </li>
92
    <li>Numeral zero:
93
        <ul>
94
            <li>+zero: enable slashed zero</li>
95
        </ul>
96
    </li>
97
    <li>Style sets:
98
        <ul>
99
            <li>+ss01: enable 1st style set</li>
100
            <li>...</li>
101
            <li>+ss20: enable 20th style set</li>
102
        </ul>
103
    </li>
104
</ul>
105
</li>
106
</ul>
107
</p>
22969 jghali 108
<p>Any style attribute not explicitly defined will have its value inherited from default character style.</p>
109
<p>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:
110
<ul style="list-style-type:none">
111
    <li><code>newStyle = createCharStyle("New Style", "Arial Regular", 12)</code></li>
112
</ul></p>
113
<p>but use this syntax instead:
114
<ul style="list-style-type:none">
115
    <li><code>newStyle = createCharStyle("New Style", fontsize=12)</code></li>
116
</ul>
117
</p>
118
<p>For some guidance on this showing in particular how to set tracking, see the wiki page <a href="https://wiki.scribus.net/canvas/Text_and_Text_Manipulation">Text and Text Manipulation</a>.</p>
22948 jghali 119
</dd>
120
 
121
<dt><a name="-createCustomLineStyle"><strong>createCustomLineStyle</strong></a>(...)</dt>
122
<dd><code>createCustomLineStyle(styleName, style)</code>
123
<p>Creates the custom line style 'styleName'.</p>
124
<p>This function takes list of dictionary as parameter for "style". Each dictionary represent one subline within style. Dictionary can have those keys:
125
<ul>
126
<li>Color [optional] -> name of the color to use (string)</li>
127
<li>Dash [optional] -> type of line to use (integer)</li>
128
<li>LineEnd [optional] -> type of LineEnd to use (integer)</li>
129
<li>LineJoin [optional] -> type of LineJoin to use (integer)</li>
130
<li>Shade [optional] -> opacity of line (integer)</li>
131
<li>Width [optional] -> width of line (double)</li>
132
</ul>
133
</p>
134
</dd>
135
 
136
<dt><a name="-createParagraphStyle"><strong>createParagraphStyle</strong></a>(...)</dt>
137
<dd><code>createParagraphStyle(...)</code>
138
<p>Creates a paragraph style. This function takes the following keyword parameters:
139
<ul>
140
<li>"name" [required] -> specifies the name of the paragraphstyle to create</li>
141
<li>linespacingmode [optional] -> specifies the linespacing mode; possible modes are:
142
<ul>
143
        <li>fixed linespacing: 0</li>
144
        <li>automatic linespacing: 1</li>
145
        <li>baseline grid linespacing: 2</li>
146
</ul>
147
</li>
148
<li>linespacing [optional] -> specifies the linespacing if using fixed linespacing</li>
149
<li>alignment [optional] -> specifies the alignment of the paragraph
150
<ul>
151
        <li>left: 0</li>
152
        <li>center: 1</li>
153
        <li>right: 2</li>
154
        <li>justify: 3</li>
155
        <li>extend: 4</li>
156
</ul>
157
</li>
158
<li>leftmargin [optional], rightmargin [optional] -> specify the margin</li>
159
<li>gapbefore [optional], gapafter [optional] -> specify the gaps to the heading and following paragraphs</li>
160
<li>firstindent [optional] -> the indent of the first line</li>
161
<li>hasdropcap [optional] -> specifies if there are caps (1 = yes, 0 = no)</li>
162
<li>dropcaplines [optional] -> height (in lines) of the caps if used</li>
163
<li>dropcapoffset [optional] -> offset of the caps if used</li>
164
<li>"charstyle" [optional] -> char style to use</li>
165
</ul>
166
</p>
167
<p>If you wish to skip a number of settings, unfortunately, this command will not accept null values, i.e., a series of commas. You <i>must</i> 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:</p>
168
<p><strong>scribus.createParagraphStyle("MyNewStyle",0,0,0,0,0,0,0,0,0,"MyCharStyle")</strong></p>
169
<p>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:</p>
170
<p><strong>scribus.createParagraphStyle("MyOtherNewStyle",1)</strong></p>
171
</dd>
172
 
173
<dt><a name="-getAllStyles"><strong>getAllStyles</strong></a>(...)</dt>
174
<dd><code>getAllStyles() -&gt; list</code>
175
<p>Deprecated, use getParagraphStyles() instead.</p></dd>
176
 
177
<dt><a name="-getCharStyles"><strong>getCharStyles</strong></a>(...)</dt>
178
<dd><code>getCharStyles() -&gt; list</code>
179
<p>Return a list of the names of all character styles in the current document.</p></dd>
180
 
181
<dt><a name="-getParagraphStyles"><strong>getParagraphStyles</strong></a>(...)</dt>
182
<dd><code>getParagraphStyles() -&gt; list</code>
183
<p>Return a list of the names of all paragraph styles in the current document.</p></dd>
184
 
185
</dl>
186
</body>
187
</html>