Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 465 lines (342 sloc) 13.798 kb
59b1408 New
rmagick authored
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
4 <html xmlns="http://www.w3.org/1999/xhtml">
5 <head>
6 <meta name="generator" content=
7 "HTML Tidy for Linux/x86 (vers 1st March 2005), see www.w3.org" />
8
df65846 Replace version number placeholder "MAJOR.MINOR.TEENY" with "0.0.0"
rmagick authored
9 <title>RMagick 0.0.0: RVG Reference: RVG::Text Class</title>
59b1408 New
rmagick authored
10 <meta http-equiv="Content-Type" content=
11 "text/html; charset=us-ascii" />
12 <meta name="GENERATOR" content="Quanta Plus" />
13 <meta name="Copyright" content=
3829d21 Change copyright date to 2006
rmagick authored
14 "Copyright (C) 2006 by Timothy P. Hunter" />
59b1408 New
rmagick authored
15 <link rel="stylesheet" type="text/css" href="css/doc.css" />
16 <script type="text/javascript" src="scripts/doc.js">
17 </script>
18 <script type="text/javascript">
19 //<![CDATA[
20 //]]>
21 </script>
22 <style type="text/css">
23 /*<![CDATA[*/
fc02c6b latest version
rmagick authored
24 .styles_header h3 {
25 background-color: #c0c0c0;
26 width:100%;
27 color: #000;
28 margin-top: 0;
29 }
30
59b1408 New
rmagick authored
31 /*]]>*/
32 </style>
33 </head>
34
35 <body>
df65846 Replace version number placeholder "MAJOR.MINOR.TEENY" with "0.0.0"
rmagick authored
36 <h6 id="header">RMagick 0.0.0 User's Guide and Reference</h6>
59b1408 New
rmagick authored
37
38 <div class="nav">
39 &laquo;&nbsp;<a href="rvgclip.html">Prev</a> | <a href=
40 "index.html">Contents</a> | <a href=
b2e34b4 Minor edits
rmagick authored
41 "rvgtspan.html">Next</a>&nbsp;&raquo;
59b1408 New
rmagick authored
42 </div>
43
44 <h1>class RVG::Text <span class="superclass">&lt;
45 Object</span></h1>
46
47 <div id="toc">
48 <h2>Table of Contents</h2>
49
50 <h3>class methods</h3>
51
52 <ul>
53 <li><a href="#new">new</a></li>
54 </ul>
55
56 <h3>instance methods</h3>
57
58 <div>
59 <div class="toccol">
60 <ul>
61 <li><a href="#d">d</a></li>
62
63 <li><a href="#rotate">rotate</a></li>
64
65 <li><a href="#tref">tref</a></li>
66
67 <li><a href="#tspan">tspan</a></li>
68 </ul>
69 </div>
70
71 <h3>shared methods</h3>
72
73 <p>In addition to the methods listed above, <code>class
74 RVG::Text</code> also implements the <a href=
75 "rvgstyle.html">styles</a> method.</p>
76
77 <h3>text styles</h3>
78
79 <div class="toccol">
80 <ul>
81 <li><a href="#basic">basic styles</a></li>
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
82
59b1408 New
rmagick authored
83 <li><a href="#advanced">advanced styles</a></li>
84 </ul>
85 </div>
86 </div>
87 </div>
88
89 <h2 class="methods">class methods</h2>
90
91 <div class="sig">
92 <h3 id="new">new</h3>
93
94 <p>RVG::Text.new(<span class="arg">x</span>=0, <span class=
95 "arg">y</span>=0, <span class="arg">text</span>=nil) [
96 <span class="arg">{ |text| ...}</span> ] -&gt; aText</p>
97 </div>
98
fc02c6b latest version
rmagick authored
99 <div class="desc">
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
100 <h4>Description</h4>
101
102 <p>This method is usually invoked indirectly via the text
103 method in the <a href="rvgclip.html#new">RVG::ClipPath</a>,
104 <a href="rvggroup.html#new">RVG::Group</a>, <a href=
105 "rvgpattern.html#new">RVG::Pattern</a>, and <a href=
106 "rvg.html#new">RVG</a> classes.</p>
107
108 <p>Text objects are containers, so this method yields to a
109 block if one is present. A text object can contain <a href=
110 "rvgtspan.html#new">RVG::Tspan</a> objects that are added
111 directly via <a href="#tspan">tspan</a>, or indirectly via
112 <a href="#tref">tref</a>.</p>
113
114 <h4>Arguments</h4>
115
116 <p>All arguments are optional. You can omit all the arguments
117 when you just want to use the <code>text</code> object as a
118 container for <code>tspans</code>.</p>
119
120 <dl>
121 <dt>x, y</dt>
122
123 <dd>The [x, y] coordinate of the initial text position within
124 the current user coordinate system. If omitted the default is
125 [0, 0].</dd>
126
127 <dt>text</dt>
fc02c6b latest version
rmagick authored
128
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
129 <dd>A string. If present, this string is drawn at the initial
130 text position. If omitted, only the initial text position is
131 established. By default the string is positioned with the
132 lower-left corner of the first glyph at [x, y]. Use the
133 <a href="#text_anchor">:text_anchor</a> style to override
73df25b Clarify how the current text position is determined
rmagick authored
134 this behavior. After the string is rendered, the current text
135 position is moved to the end of the string.</dd>
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
136 </dl>
137
138 <h4>Example</h4>
139
140 <p><a href="javascript:popup('text01.rb.html')"><img src=
141 "ex/text01.gif" title="Click to see the example script" alt=
b2e34b4 Minor edits
rmagick authored
142 "text example" /></a></p>
fc02c6b latest version
rmagick authored
143 </div>
144
59b1408 New
rmagick authored
145 <h2 class="methods">instance methods</h2>
146
147 <div class='sig'>
148 <h3 id='d'>d</h3>
149
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
150 <p><span class="arg">text</span>.d(<span class=
b2e34b4 Minor edits
rmagick authored
151 "arg">dx</span>[, <span class="arg">dy</span>=0]) [
152 <span class="arg">{ |self| ...}</span> ] -&gt; <span class=
153 "arg">self</span></p>
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
154 </div>
155
156 <div class="desc">
157 <h4>Description</h4>
158
159 <p>The <span class="arg">dx</span> and <span class=
160 "arg">dy</span> arguments are added to the <span class=
73df25b Clarify how the current text position is determined
rmagick authored
161 "arg">x</span> and <span class="arg">y</span> <code>text</code>
162 arguments to form the initial text position. Yields to a block
163 if one is present.</p>
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
164
165 <h4>Arguments</h4>
166
167 <dl>
168 <dt>dx, dy</dt>
169
170 <dd>The distance, in the user coordinate system, to be added
171 to the <em>x</em> and <em>y</em> coordinates of the initial
172 text position.</dd>
173 </dl>
174
175 <h4>Returns</h4>
176
177 <p>self</p>
59b1408 New
rmagick authored
178 </div>
179
180 <div class='sig'>
181 <h3 id='rotate'>rotate</h3>
182
183 <p><span class="arg">text</span>.rotate(<span class=
b2e34b4 Minor edits
rmagick authored
184 "arg">degrees</span>) [ <span class="arg">{ |text| ...}</span>
185 ] -&gt; <span class="arg">self</span></p>
59b1408 New
rmagick authored
186 </div>
187
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
188 <div class="desc">
189 <h4>Description</h4>
190
191 <p>Rotates the text about the initial text position by the
b2e34b4 Minor edits
rmagick authored
192 specified number of <span class="arg">degrees</span>. Yields to
193 a block if one is present.</p>
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
194
195 <h4>Arguments</h4>
196
197 <dl>
198 <dt>degrees</dt>
199
200 <dd>The amount of rotation</dd>
201 </dl>
202
203 <h4>Returns</h4>
204
205 <p>self</p>
206 </div>
207
59b1408 New
rmagick authored
208 <div class='sig'>
209 <h3 id='tref'>tref</h3>
210
211 <p><span class="arg">text</span>.tref(<span class=
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
212 "arg">tspan</span>, <span class="arg">x</span>=0, <span class=
213 "arg">y</span>=0) -&gt; <span class="arg">self</span></p>
214 </div>
215
216 <div class="desc">
217 <h4>Description</h4>
218
219 <p>Adds the referenced <a href="rvgtspan.html#new">Tspan</a>
220 object to the text container.</p>
221
222 <h4>Arguments</h4>
223
224 <dl>
225 <dt>tspan</dt>
226
227 <dd>A <code>Tspan</code> object.</dd>
228
229 <dt>x, y</dt>
230
231 <dd>The absolute text position</dd>
232 </dl>
d3ea4c5 Add tref01.rb example
rmagick authored
233
234 <h4>Example</h4>
235
236 <p><a href="javascript:popup('tref01.rb.html')"><img src=
237 "ex/tref01.gif" title="Click to see the example script" alt=
238 "tref example" /></a></p>
59b1408 New
rmagick authored
239 </div>
240
241 <div class='sig'>
242 <h3 id='tspan'>tspan</h3>
243
244 <p><span class="arg">text</span>.tspan(<span class=
787b986 Fix tspan.new argument defaults
rmagick authored
245 "arg">string</span>=nil, <span class="arg">x</span>=nil,
246 <span class="arg">y</span>=nil) [ <span class="arg">{ |tspan|
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
247 ...}</span> ] -&gt; aTspan</p>
248 </div>
249
250 <div class="desc">
251 <h4>Description</h4>
252
253 <p>Calls <a href="rvgtspan.html#new">RVG::Tspan.new</a> to
254 construct a tspan and adds it to the enclosing RVG::Text
255 object. Yields to a block if one is present, passing the new
256 tspan as an argument.</p>
257
258 <p><em>Although <code>tspan</code> has the same arguments as
259 <code>RVG::Text.new</code> they are not in the same order. The
260 <code>tspan</code> method has the <span class=
261 "arg">string</span> argument first followed by the
262 [<span class="arg">x</span>, <span class="arg">y</span>]
263 arguments. The <code>RVG::Text.new</code> arguments are just
264 the opposite.</em></p>
265
266 <h4>Arguments</h4>
267
268 <dl>
269 <dt>string</dt>
270
271 <dd>A text string.</dd>
272
273 <dt>x, y</dt>
274
275 <dd>The absolute text position</dd>
276 </dl>
277
278 <h4>Returns</h4>
279
280 <p>The new tspan, so other <code>RVG::Tspan</code> methods can
281 be chained to it.</p>
59b1408 New
rmagick authored
282 </div>
283
284 <h2 class="methods">text styles</h2>
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
285
fc02c6b latest version
rmagick authored
286 <div class="styles_header">
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
287 <h3 id="basic">basic styles</h3>
fc02c6b latest version
rmagick authored
288 </div>
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
289
fc02c6b latest version
rmagick authored
290 <div class="desc">
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
291 <h4>Description</h4>
292
293 <p>The basic styles include font styles and text styles. Note
294 that &times;Magick uses the font styles to select a font from
295 the available fonts. If it cannot find a font that exactly
296 matches it will use the closest matching font. Unlike MS
297 Windows, &times;Magick will <em>not</em> alter a font - by
298 artificially slanting it to to simulate italics, for example -
299 to produce a match.</p>
300
301 <h4>Styles</h4>
302
303 <dl>
304 <dt>:font</dt>
305
306 <dd>font name or font file name, such as
307 "C:/Windows/Fonts/Arial.ttf" or
308 "pfb:-urw-helvetica-medium-o-condensed--0-0-0-0-p-0-iso10646-1"</dd>
309
310 <dt>:font_family</dt>
311
312 <dd>font family name, such as "serif" or "courier"</dd>
313
314 <dt>:font_size</dt>
315
316 <dd>the font size in points</dd>
317
318 <dt>:font_stretch</dt>
319
320 <dd>one of the following strings: 'normal',
321 'ultra_condensed', 'extra_condensed', 'condensed',
322 'semi_condensed', 'semi_expanded', 'expanded',
323 'extra_expanded', 'ultra_expanded'</dd>
324
325 <dt>:font_style</dt>
326
327 <dd>one of the following strings: 'normal', 'italic',
328 'oblique'</dd>
329
330 <dt>:font_weight</dt>
331
332 <dd>one of the following strings: 'normal', 'bold', 'bolder',
333 'lighter', or a multiple of 100 between 100 and 900</dd>
334
335 <dt id='text_anchor'>:text_anchor</dt>
336
337 <dd>one of the following strings: 'start', 'middle',
338 'end'</dd>
339
340 <dt>:text_decoration</dt>
341
342 <dd>one of the following strings: 'none', 'underline',
343 'overline', 'line_through'</dd>
344 </dl>
345
346 <h4>Examples</h4>
347
348 <p><strong>font styles</strong><a href=
349 "javascript:popup('font_styles.rb.html')"><img src=
350 "ex/font_styles.gif" title="Click to see the example script"
351 alt="font styles example" /></a><em>Depending on the fonts that
352 &times;Magick is configured with you may not see the effect of
353 some of the styles used in this example.</em></p>
354
355 <p><strong>text styles</strong><a href=
356 "javascript:popup('text_styles.rb.html')"><img src=
357 "ex/text_styles.gif" title="Click to see the example script"
358 alt="text styles example" /></a></p>
fc02c6b latest version
rmagick authored
359 </div>
451d5fd Add new styles examples
rmagick authored
360
e95fd31 Document d, rotate, text, tspan, tref methods
rmagick authored
361 <div class="styles_header">
362 <h3 id="advanced">advanced styles</h3>
363
364 <div class="desc">
365 <h4>Description</h4>
366
367 <p>These styles are emulated by RVG by orienting and
368 positioning each glyph individually. Consequently any use of
369 a non-default value for one of these styles will probably
370 cause your script to dramatically slow down. If you specify
371 an invalid value for any of these styles RVG ignores the
372 value and uses the default. RVG frequently uses approximate
373 measurements to emulate these styles so the results will not
374 be as precise as when &times;Magick is doing the work.</p>
375
376 <h4>Styles</h4>
377
378 <dl>
379 <dt>:writing_mode</dt>
380
381 <dd>There are two possible values for :writing_mode, 'lr'
382 for left-to-right (most Latin-based documents) and 'tb' for
383 top-to-bottom (or vertical) text such as for column labels.
384 The default is 'lr'.</dd>
385
386 <dt>:baseline_shift</dt>
387
388 <dd>Adjusts the baseline. There are five possible values:
389 'baseline' (the default), 'super', 'sub', a percentage
390 specified as 'NN%', or a number. For the last two choices,
391 positive numbers move the baseline upward. The percentage
392 is a percentage of the line height.</dd>
393
394 <dt>:letter_spacing</dt>
395
396 <dd>Specifies an amount of space to be added between each
397 letter. The default is 0.</dd>
398
399 <dt>:word_spacing</dt>
400
401 <dd>Specifies an amount of space to be added between each
402 word. This amount is added for each blank between words, so
403 if the words are separated by two blanks, for example, then
404 twice the additional space is added. The default is 0.</dd>
405
406 <dd>RVG uses this statement to separate words:
407 <strong>words =
408 text.split(::Magick::RVG::WORD_SEP)</strong> You can change
409 the regular expression that RVG uses to determine word
410 breaks by assigning a new regular expression to the
411 <code>::Magick::RVG::WORD_SEP</code> constant. By default
412 the value of <code>::Magick::RVG::WORD_SEP</code> is
413 <code>/ /</code>.</dd>
414
415 <dt>:glyph_orientation_vertical</dt>
416
417 <dd>Applies only when :writing_mode='tb'. This style can
418 have one of four values: 0, 90, 180, 270. The default is
419 90. This style specifies a rotation on each glyph. With the
420 default value, each glyph is rotated 90 degrees. When
421 :glyph_orientation_vertical=0 each glyph appears in its
422 "normal" (upright) orientation.</dd>
423
424 <dt>:glyph_orientation_horizontal</dt>
425
426 <dd>Applies only when :writing_mode='lr'. This style can
427 have one of four values: 0, 90, 180, 270. The default is 0.
428 This style specifies a rotation on each glyph. With the
429 default value, each glyph appears in its "normal" (upright)
430 orientation.</dd>
431 </dl>
432
433 <h4>Examples</h4>
434
435 <p><strong>:writing_mode='tb'</strong><a href=
436 "javascript:popup('writing_mode01.rb.html')"><img src=
437 "ex/writing_mode01.gif" title=
438 "Click to see the example script" alt=
439 "writing mode 'tb' style example" /></a></p>
440
441 <p><strong>:writing_mode='lr'</strong><a href=
442 "javascript:popup('writing_mode02.rb.html')"><img src=
443 "ex/writing_mode02.gif" title=
444 "Click to see the example script" alt=
445 "writing mode 'lr' style example" /></a></p>
446
447 <p><strong>:baseline_shift=&gt;'sub'<br />
448 :baseline_shift=&gt;'super'</strong><a href=
449 "javascript:popup('baseline_shift01.rb.html')"><img src=
450 "ex/baseline_shift01.gif" title=
451 "Click to see the example script" alt=
452 "baseline shift style example" /></a></p>
451d5fd Add new styles examples
rmagick authored
453 </div>
fc02c6b latest version
rmagick authored
454 </div>
59b1408 New
rmagick authored
455
456 <p class="spacer">&nbsp;</p>
457
458 <div class="nav">
459 &laquo; <a href="rvgclip.html">Prev</a> | <a href=
b2e34b4 Minor edits
rmagick authored
460 "index.html">Contents</a> | <a href="rvgtspan.html">Next</a>
59b1408 New
rmagick authored
461 &raquo;
462 </div>
463 </body>
464 </html>
Something went wrong with that request. Please try again.