Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 237 lines (199 sloc) 10.415 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
9 <title>RMagick: RVG Reference: RVG::Text Class</title>
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=
14 "Copyright (C) 2005 by Timothy P. Hunter" />
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>
36 <h6 id="header">RMagick User's Guide and Reference</h6>
37
38 <div class="nav">
39 &laquo;&nbsp;<a href="rvgclip.html">Prev</a> | <a href=
40 "index.html">Contents</a> | <a href=
41 "rvguse.html">Next</a>&nbsp;&raquo;
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>
82 <li><a href="#advanced">advanced styles</a></li>
83 </ul>
84 </div>
fc02c6b latest version
rmagick authored
85
59b1408 New
rmagick authored
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">
100 <h4>Description</h4>
101 <p>This method is usually invoked indirectly via the text method in the <a href="rvgclip.html#new">RVG::ClipPath</a>, <a href="rvggroup.html#new">RVG::Group</a>, <a href="rvgpattern.html#new">RVG::Pattern</a>, and <a href="rvg.html#new">RVG</a> classes.</p>
102 <p>Text objects are containers, so this method yields to a block if one is present. A text object can contain <a href="rvgtspan.html#new">RVG::Tspan</a> objects that are added directly via <a href="#tspan">tspan</a>, or indirectly via <a href="#tref">tref</a>.</p>
103 <h4>Arguments</h4>
104 <p>All arguments are optional. You can
105 omit all the arguments when you just want to use the <code>text</code> object as a container for <code>tspans</code>.</p>
106 <dl>
107 <dt>x, y</dt>
108 <dd>The [x, y] coordinate of the initial text position within the current user coordinate system. If omitted the default is [0, 0]. </dd>
109 <dt>text</dt>
110 <dd>A string. If present, this string is drawn at the initial text position. If omitted, only the initial text position is established.
111 By default the string is positioned with the lower-left corner of the first glyph at [x, y]. Use the <a href="#text_anchor">:text_anchor</a> style
112 to override this behavior.</dd>
113 </dl>
114 <h4>Example</h4>
115 <p><a href=
116 "javascript:popup('text01.rb.html')"><img src=
117 "ex/text01.gif" title=
118 "Click to see the example script" alt=
119 "preserve_aspect_ratio example" /></a></p>
120
121 </div>
122
59b1408 New
rmagick authored
123 <h2 class="methods">instance methods</h2>
124
125 <div class='sig'>
126 <h3 id='d'>d</h3>
127
128 <p><span class="arg">text</span>.d(<span class="arg">x</span>,
129 <span class="arg">y</span>=nil) -&gt; <span class=
130 "arg">self</span></p>
131 </div>
132
133 <div class='sig'>
134 <h3 id='rotate'>rotate</h3>
135
136 <p><span class="arg">text</span>.rotate(<span class=
137 "arg">degrees</span>) -&gt; <span class="arg">self</span></p>
138 </div>
139
140 <div class='sig'>
141 <h3 id='tref'>tref</h3>
142
143 <p><span class="arg">text</span>.tref(<span class=
144 "arg">tspan</span>, <span class="arg">x</span>=nil,
145 <span class="arg">y</span>=nil) -&gt; <span class=
146 "arg">self</span></p>
147 </div>
148
149 <div class='sig'>
150 <h3 id='tspan'>tspan</h3>
151
152 <p><span class="arg">text</span>.tspan(<span class=
153 "arg">text</span>=nil, <span class="arg">x</span>=nil,
154 <span class="arg">y</span>=nil) [ <span class="arg">{ |text|
155 ...}</span> ] -&gt; self</p>
156 </div>
157
158 <h2 class="methods">text styles</h2>
fc02c6b latest version
rmagick authored
159 <div class="styles_header">
160 <h3 id="basic">basic styles</h3>
161 </div>
162 <div class="desc">
163 <h4>Description</h4>
164 <p>The basic styles include font styles and text styles. Note that &times;Magick uses the font styles to select a font from the available fonts. If it cannot find a font that exactly matches it will use the closest matching font. Unlike MS Windows, &times;Magick will <em>not</em> alter a font - by artificially slanting it to to simulate italics, for example - to produce a match.</p>
165 <h4>Styles</h4>
166 <dl>
167 <dt>:font</dt>
168 <dd>font name or font file name, such as "C:/Windows/Fonts/Arial.ttf" or "pfb:-urw-helvetica-medium-o-condensed--0-0-0-0-p-0-iso10646-1"</dd>
169 <dt>:font_family</dt>
170 <dd>font family name, such as "serif" or "courier"</dd>
171 <dt>:font_size</dt>
172 <dd>the font size in points</dd>
173 <dt>:font_stretch</dt>
174 <dd>one of the following strings: 'normal', 'ultra_condensed', 'extra_condensed', 'condensed', 'semi_condensed', 'semi_expanded', 'expanded', 'extra_expanded', 'ultra_expanded'</dd>
175 <dt>:font_style</dt>
176 <dd>one of the following strings: 'normal', 'italic', 'oblique'</dd>
177 <dt>:font_weight</dt>
178 <dd>one of the following strings: 'normal', 'bold', 'bolder', 'lighter', or a multiple of 100 between 100 and 900</dd>
179 <dt id='text_anchor'>:text_anchor</dt>
180 <dd>one of the following strings: 'start', 'middle', 'end'</dd>
181 <dt>:text_decoration</dt>
182 <dd>one of the following strings: 'none', 'underline', 'overline', 'line_through'</dd>
183 </dl>
184 <h4>Examples</h4>
451d5fd Add new styles examples
rmagick authored
185 <p><strong>font styles</strong><a href="javascript:popup('font_styles.rb.html')"><img src=
712c5b8 Minor updates
rmagick authored
186 "ex/font_styles.gif" title="Click to see the example script" alt=
451d5fd Add new styles examples
rmagick authored
187 "font styles example" /></a><em>Depending on the fonts that &times;Magick is configured with you may not see the effect of some of the styles used in this example.</em></p>
188 <p><strong>text styles</strong><a href="javascript:popup('text_styles.rb.html')"><img src=
189 "ex/text_styles.gif" title="Click to see the example script" alt=
190 "text styles example" /></a></p>
fc02c6b latest version
rmagick authored
191 </div>
192 <div class="styles_header">
193 <h3 id="advanced">advanced styles</h3>
194 <div class="desc">
195 <h4>Description</h4>
451d5fd Add new styles examples
rmagick authored
196 <p>These styles are emulated by RVG by orienting and positioning each glyph individually. Consequently any use of a non-default value for one of these styles will probably cause your script to dramatically slow down. If you specify an invalid value for any of these styles RVG ignores the value and uses the default. RVG frequently uses approximate measurements to emulate these styles so the results will not be as precise as when &times;Magick is doing the work.</p>
fc02c6b latest version
rmagick authored
197 <h4>Styles</h4>
198 <dl>
199 <dt>:writing_mode</dt>
200 <dd>There are two possible values for :writing_mode, 'lr' for left-to-right (most Latin-based documents) and 'tb' for top-to-bottom (or vertical) text such as for column labels. The default is 'lr'.</dd>
201 <dt>:baseline_shift</dt>
202 <dd>Adjusts the baseline. There are five possible values: 'baseline' (the default), 'super', 'sub', a percentage specified as 'NN%', or a number. For the last two choices, positive numbers move the baseline upward. The percentage is a percentage of the line height.</dd>
203 <dt>:letter_spacing</dt>
204 <dd>Specifies an amount of space to be added between each letter. The default is 0.</dd>
205 <dt>:word_spacing</dt>
206 <dd>Specifies an amount of space to be added between each word. This amount is added for each blank between words, so if the words are separated by two blanks, for example, then twice the additional space is added. The default is 0.</dd>
207 <dd>RVG uses this statement to separate words: <strong>words = text.split(::Magick::RVG::WORD_SEP)
451d5fd Add new styles examples
rmagick authored
208 </strong>You can change the regular expression that RVG uses to determine word breaks by assigning a new regular expression to the <code>::Magick::RVG::WORD_SEP</code> constant. By default the value of <code>::Magick::RVG::WORD_SEP</code> is <code>/ /</code>.</dd>
fc02c6b latest version
rmagick authored
209 <dt>:glyph_orientation_vertical</dt>
210 <dd>Applies only when :writing_mode='tb'. This style can have one of four values: 0, 90, 180, 270. The default is 90. This style specifies a rotation on each glyph. With the default value, each glyph is rotated 90 degrees. When :glyph_orientation_vertical=0 each glyph appears in its "normal" (upright) orientation.</dd>
211 <dt>:glyph_orientation_horizontal</dt>
212 <dd>Applies only when :writing_mode='lr'. This style can have one of four values: 0, 90, 180, 270. The default is 0. This style specifies a rotation on each glyph. With the default value, each glyph appears in its "normal" (upright) orientation.</dd>
213 </dl>
214 <h4>Examples</h4>
451d5fd Add new styles examples
rmagick authored
215 <p><strong>:writing_mode='tb'</strong><a href="javascript:popup('writing_mode01.rb.html')"><img src=
216 "ex/writing_mode01.gif" title="Click to see the example script" alt=
217 "writing mode 'tb' style example" /></a></p>
218 <p><strong>:writing_mode='lr'</strong><a href="javascript:popup('writing_mode02.rb.html')"><img src=
219 "ex/writing_mode02.gif" title="Click to see the example script" alt=
220 "writing mode 'lr' style example" /></a></p>
221 <p><strong>:baseline_shift=>'sub'<br />:baseline_shift=>'super'</strong><a href="javascript:popup('baseline_shift01.rb.html')"><img src=
222 "ex/baseline_shift01.gif" title="Click to see the example script" alt=
223 "baseline shift style example" /></a></p>
224
225 </div>
fc02c6b latest version
rmagick authored
226 </div>
59b1408 New
rmagick authored
227
228 <p class="spacer">&nbsp;</p>
229
230 <div class="nav">
231 &laquo; <a href="rvgclip.html">Prev</a> | <a href=
232 "index.html">Contents</a> | <a href="rvguse.html">Next</a>
233 &raquo;
234 </div>
235 </body>
236 </html>
Something went wrong with that request. Please try again.