Subversion Repositories Scribus

Rev

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

Rev Author Line No. Line
10646 cbradney 1
<html>
2
<head>
3
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
4
        <title>Handling Text Frames</title>
5
</head>
6
<body>
597 cbradney 7
<h2>Handling Text Frames</h2>
559 cbradney 8
 
9
<dl>
1041 cbradney 10
 
11224 subik 11
<dt><a name="-dehyphenateText"><strong>dehyphenateText</strong></a>(...)</dt>
12
<dd><code>dehyphenateText(["name"]) -&gt; bool</code>
13
<p>Does dehyphenation on text frame "name". If "name" is not given the currently selected item is used.</p>
14
<p>May raise WrongFrameTypeError if the target frame is not a text frame</p></dd>
15
 
1041 cbradney 16
<dt><a name="-deleteText"><strong>deleteText</strong></a>(...)</dt>
7440 subik 17
<dd><code>deleteText(["name"])</code>
1041 cbradney 18
<p>Deletes any text in the text frame "name". If there is some text selected, only the selected text will be deleted. If "name" is not given the currently selected item is used.</p></dd>
1607 subik 19
 
1041 cbradney 20
<dt><a name="-getAllText"><strong>getAllText</strong></a>(...)</dt>
7440 subik 21
<dd><code>getAllText(["name"]) -&gt; string</code>
1041 cbradney 22
<p>Returns the text of the text frame "name" and of all text frames which are linked with this frame. If this textframe has some text selected, the selected text is returned. If "name" is not given the currently selected item is used.</p></dd></dt>
1607 subik 23
 
1041 cbradney 24
<dt><a name="-getColumnGap"><strong>getColumnGap</strong></a>(...)</dt>
7440 subik 25
<dd><code>getColumnGap(["name"]) -&gt; float</code>
1041 cbradney 26
<p>Returns the column gap size of the text frame "name" expressed in points. If "name" is not given the currently selected item is used.</p></dd>
1607 subik 27
 
1041 cbradney 28
<dt><a name="-getColumns"><strong>getColumns</strong></a>(...)</dt>
7440 subik 29
<dd><code>getColumns(["name"]) -&gt; integer</code>
1607 subik 30
<p>Gets the number of columns of the text frame "name". If "name" is not given the currently selected item is used.</p></dd>
31
 
1041 cbradney 32
<dt><a name="-getFont"><strong>getFont</strong></a>(...)</dt>
7440 subik 33
<dd><code>getFont(["name"]) -&gt; string</code>
1607 subik 34
<p>Returns the font name for the text frame "name". If this text frame has some text selected the value assigned to the first character of the selection is returned. If "name" is not given the currently selected item is used.</p></dd>
35
 
1041 cbradney 36
<dt><a name="-getFontSize"><strong>getFontSize</strong></a>(...)</dt>
7440 subik 37
<dd><code>getFontSize(["name"]) -&gt; float</code>
1041 cbradney 38
<p>Returns the font size in points for the text frame "name". If this text frame has some text selected the value assigned to the first character of the selection is returned. If "name" is not given the currently selected item is used.</p></dd>
1607 subik 39
 
1041 cbradney 40
<dt><a name="-getLineSpacing"><strong>getLineSpacing</strong></a>(...)</dt>
7440 subik 41
<dd><code>getLineSpacing(["name"]) -&gt; float</code>
1041 cbradney 42
<p>Returns the line spacing ("leading") of the text frame "name" expressed in points. If "name" is not given the currently selected item is used.</p></dd>
1607 subik 43
 
1041 cbradney 44
<dt><a name="-getText"><strong>getText</strong></a>(...)</dt>
7440 subik 45
<dd><code>getText(["name"]) -&gt; string</code>
1041 cbradney 46
<p>Returns the text of the text frame "name". If this text frame has some text selected, the selected text is returned. All text in the frame, not just currently visible text, is returned. If "name" is not given the currently selected item is used.</p></dd>
47
 
48
<dt><a name="-getTextColor"><strong>getTextColor</strong></a>(...)</dt>
7440 subik 49
<dd><code>getLineColor(["name"]) -&gt; string</code>
1041 cbradney 50
<p>Returns the name of the line color of the object "name". If "name" is not given the currently selected item is used.</p></dd>
51
 
13059 subik 52
<dt><a name="-getTextDistances"><strong>getTextDistances</strong></a>(...)</dt>
53
<dd><code>getTextDistances(["name"]) -&gt; tuple</code>
54
<p>Returns the text distances of the text frame "name" expressed in points. The
55
distances are returned as a tuple like (left, right, top, bottom). If "name"
56
is not given the currently selected item is used.</p></dd>
57
 
1041 cbradney 58
<dt><a name="-getTextLength"><strong>getTextLength</strong></a>(...)</dt>
7440 subik 59
<dd><code>getTextLength(["name"]) -&gt; integer</code>
1041 cbradney 60
<p>Returns the length of the text in the text frame "name". If "name" is not given the currently selected item is used.</p></dd>
61
 
7440 subik 62
<dt><a name="-getTextLines"><strong>getTextLines</strong>(...)</a></dt>
63
<dd><code>getTextLines(["name"]) -&gt; integer</code>
64
<p>Returns the number of lines of the text in the text frame "name". If "name" is not given the currently selected item is used.</p></dd>
65
 
1041 cbradney 66
<dt><a name="-getTextShade"><strong>getTextShade</strong></a>(...)</dt>
7440 subik 67
<dd><code>getLineShade(["name"]) -&gt; integer</code>
1041 cbradney 68
<p>Returns the shading value of the line color of the object "name". If "name" is not given the currently selected item is used.</p></dd>
1607 subik 69
 
11224 subik 70
<dt><a name="-hyphenateText"><strong>hyphenateText</strong></a>(...)</dt>
71
<dd><code>hyphenateText(["name"]) -&gt; bool</code>
72
<p>Does hyphenation on text frame "name". If "name" is not given the currently selected item is used.</p>
73
<p>May raise WrongFrameTypeError if the target frame is not a text frame</p></dd>
74
 
17795 jghali 75
<dt><a name="-insertHtmlText"><strong>insertHtmlText</strong></a>(...)</dt>
76
<dd><code>insertHtmlText("text", ["name"])</code>
77
<p>Inserts the text from "file" into the text frame "name". Text must be UTF encoded (see <a href="#-setText">setText</a>() as reference). If "name" is not given the currently selected Item is used.</p>
78
<p>May raise WrongFrameTypeError if the target frame is not a text frame</p></dd>
79
 
1041 cbradney 80
<dt><a name="-insertText"><strong>insertText</strong></a>(...)</dt>
7440 subik 81
<dd><code>insertText("text", pos, ["name"])</code>
82
<p>Inserts the text "text" at the position "pos" into the text frame "name". Text must be UTF encoded (see <a href="#-setText">setText</a>() as reference) The first character has an index of 0. Inserting text at position -1 appends it to the frame. If "name" is not given the currently selected Item is used.</p>
1041 cbradney 83
<p>May throw IndexError for an insertion out of bounds.</p></dd>
1607 subik 84
 
7440 subik 85
<dt><a name="-isPDFBookmark"><strong>isPDFBookmark</strong>(...)</a></dt>
86
<dd><code>isPDFBookmark(["name"]) -&gt; bool</code>
87
<p>Returns true if the text frame "name" is a PDF bookmark. If "name" is not given the currently selected item is used.</p>
88
<p>May raise WrongFrameTypeError if the target frame is not a text frame</p></dd>
89
 
1041 cbradney 90
<dt><a name="-selectText"><strong>selectText</strong></a>(...)</dt>
7440 subik 91
<dd><code>selectText(start, count, ["name"])</code>
1041 cbradney 92
<p>Selects "count" characters of text in the text frame "name" starting from the character "start". Character counting starts at 0. If "count" is zero, any text selection will be cleared.  If "name" is not given the currently selected item is used.</p>
93
<p>May throw IndexError if the selection is outside the bounds of the text.</p></dd>
1607 subik 94
 
1041 cbradney 95
<dt><a name="-setColumns"><strong>setColumns</strong></a>(...)</dt>
7440 subik 96
<dd><code>setColumns(nr, ["name"])</code>
1041 cbradney 97
<p>Sets the number of columns of the text frame "name" to the integer "nr". If "name" is not given the currently selected item is used.</p>
98
<p>May throw ValueError if number of columns is not at least one.</p></dd>
1607 subik 99
 
1041 cbradney 100
<dt><a name="-setColumnGap"><strong>setColumnGap</strong></a>(...)</dt>
7440 subik 101
<dd><code>setColumnGap(size, ["name"])</code>
1041 cbradney 102
<p>Sets the column gap of the text frame "name" to the value "size". If "name" is not given the currently selected item is used.</p>
1607 subik 103
<p>May throw ValueError if the column gap is out of bounds (must be positive).</p></dd>
104
 
1041 cbradney 105
<dt><a name="-setFont"><strong>setFont</strong></a>(...)</dt>
7440 subik 106
<dd><code>setFont("font", ["name"])</code>
1041 cbradney 107
<p>Sets the font of the text frame "name" to "font". If there is some text selected only the selected text is changed.  If "name" is not given the currently selected item is used.</p>
108
<p>May throw ValueError if the font cannot be found.</p></dd>
109
 
110
<dt><a name="-setFontSize"><strong>setFontSize</strong></a>(...)</dt>
7440 subik 111
<dd><code>setFontSize(size, ["name"])</code>
1041 cbradney 112
<p>Sets the font size of the text frame "name" to "size". "size" is treated as a value in points. If there is some text selected only the selected text is changed. "size" must be in the range 1 to 512. If "name" is not given the currently selected item is used.</p>
113
<p>May throw ValueError for a font size that's out of bounds.</p></dd>
1607 subik 114
 
1041 cbradney 115
<dt><a name="-setLineSpacing"><strong>setLineSpacing</strong></a>(...)</dt>
7440 subik 116
<dd><code>setLineSpacing(size, ["name"])</code>
1041 cbradney 117
<p>Sets the line spacing ("leading") of the text frame "name" to "size". "size" is a value in points. If "name" is not given the currently selected item is used.</p>
118
<p>May throw ValueError if the line spacing is out of bounds.</p></dd>
1607 subik 119
 
14427 jghali 120
<dt><a name="-setLineSpacingMode"><strong>setLineSpacingMode</strong></a>(...)</dt>
121
<dd><code>setLineSpacingMode(mode, ["name"])</code>
122
<p>Sets the line spacing mode of the text frame "name" to "mode". If "name" is not given the currently selected item is used. Mode values are the same as in createParagraphStyle.</p>
123
<p>May throw ValueError if the line spacing mode is out of bounds.</p></dd>
124
 
7440 subik 125
<dt><a name="-setPDFBookmark"><strong>setPDFBookmark</strong>(...)</a></dt>
126
<dd><code>setPDFBookmark("toggle", ["name"])</code>
127
<p>Sets wether (toggle = 1) the text frame "name" is a bookmark nor not. If "name" is not given the currently selected item is used.</p>
128
<p>May raise WrongFrameTypeError if the target frame is not a text frame</p></dd>
129
 
1041 cbradney 130
<dt><a name="-setText"><strong>setText</strong></a>(...)</dt>
7440 subik 131
<dd><code>setText("text", ["name"])</code>
1041 cbradney 132
<p>Sets the text of the text frame "name" to the text of the string "text". Text must be UTF8 encoded - use e.g. unicode(text, 'iso-8859-2'). See the FAQ for more details. If "name" is not given the currently selected item is used.</p></dd>
133
 
134
<dt><a name="-setTextAlignment"><strong>setTextAlignment</strong></a>(...)</dt>
7440 subik 135
<dd><code>setTextAlignment(align, ["name"])</code>
1607 subik 136
<p>Sets the text alignment of the text frame "name" to the specified alignment. If "name" is not given the currently selected item is used. "align" should be one of the ALIGN_ constants defined in this module - see dir(scribus).</p>
1041 cbradney 137
<p>May throw ValueError for an invalid alignment constant.</p></dd>
138
 
13059 subik 139
<dt><a name="-setTextDistances"><strong>setTextDistances</strong></a>(...)</dt>
140
<dd><code>setTextDistances(left, right, top, bottom, ["name"])</code>
141
<p>Sets the text distances of the text frame "name" to the values "left"
142
"right", "top" and "bottom". If "name" is not given the currently
143
selected item is used.</p>
144
<p>May throw ValueError if any of the distances are out of bounds (must be positive).</p></dd>
145
 
13199 jghali 146
<dt><a name="-setTextScalingH"><strong>setTextScalingH</strong></a>(...)</dt>
147
<dd><code>setTextScalingH(scale, ["name"]))</code>
148
<p>Sets the horizontal character scaling of the object "name" to "scale" in percent. If "name" is not given the currently selected item is used.</p></dd>
149
 
150
<dt><a name="-setTextScalingV"><strong>setTextScalingV</strong></a>(...)</dt>
151
<dd><code>setTextScalingV(scale, ["name"]))</code>
152
<p>Sets the vertical character scaling of the object "name" to "scale" in percent. If "name" is not given the currently selected item is used.</p></dd>
153
 
154
<dt><a name="-setTextColor"><strong>setTextColor</strong></a>(...)</dt>
155
<dd><code>setTextColor("color", ["name"])</code>
156
<p>Sets the text color of the text frame "name" to the color "color". If there is some text selected only the selected text is changed. If "name" is not given the currently selected item is used.</p></dd>
157
 
1041 cbradney 158
<dt><a name="-setTextShade"><strong>setTextShade</strong></a>(...)</dt>
7440 subik 159
<dd><code>setTextShade(shade, ["name"])</code>
1041 cbradney 160
<p>Sets the shading of the text color of the object "name" to "shade". If there is some text selected only the selected text is changed. "shade" must be an integer value in the range from 0 (lightest) to 100 (full color intensity). If "name" is not given the currently selected item is used.</p></dd>
161
 
162
<dt><a name="-setTextStroke"><strong>setTextStroke</strong></a>(...)</dt>
7440 subik 163
<dd><code>setTextStroke("color", ["name"])</code>
1041 cbradney 164
<p>Set "color" of the text stroke. If "name" is not given the currently selected item is used.</p></dd>
165
 
1420 subik 166
<dt><a name="-textOverflows"><strong>textOverflows</strong></a>(...)</dt>
7440 subik 167
<dd><code>textOverflows(["name", nolinks]) -&gt; integer</code>
17330 jghali 168
<p>Returns 1 if there are overflowing characters in text frame "name", 0 if not. If is nolinks set to non zero value it takes only one frame - it doesn't use text frame linking. Without this parameter it search all linking chain.</p>
1420 subik 169
<p>May raise WrongFrameTypeError if the target frame is not an text frame</p></dd>
170
 
597 cbradney 171
</dl>
10646 cbradney 172
</body>
173
</html>