Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 464 lines (342 sloc) 13.798 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 1st March 2005), see www.w3.org" />

  <title>RMagick 0.0.0: RVG Reference: RVG::Text Class</title>
  <meta http-equiv="Content-Type" content=
  "text/html; charset=us-ascii" />
  <meta name="GENERATOR" content="Quanta Plus" />
  <meta name="Copyright" content=
  "Copyright (C) 2006 by Timothy P. Hunter" />
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
<script type="text/javascript" src="scripts/doc.js">
</script>
<script type="text/javascript">
  //<![CDATA[
  //]]>
</script>
<style type="text/css">
  /*<![CDATA[*/
  .styles_header h3 {
    background-color: #c0c0c0;
    width:100%;
    color: #000;
    margin-top: 0;
  }

  /*]]>*/
</style>
</head>

<body>
  <h6 id="header">RMagick 0.0.0 User's Guide and Reference</h6>

  <div class="nav">
    &laquo;&nbsp;<a href="rvgclip.html">Prev</a> | <a href=
    "index.html">Contents</a> | <a href=
    "rvgtspan.html">Next</a>&nbsp;&raquo;
  </div>

  <h1>class RVG::Text <span class="superclass">&lt;
  Object</span></h1>

  <div id="toc">
    <h2>Table of Contents</h2>

    <h3>class methods</h3>

    <ul>
      <li><a href="#new">new</a></li>
    </ul>

    <h3>instance methods</h3>

    <div>
      <div class="toccol">
        <ul>
          <li><a href="#d">d</a></li>

          <li><a href="#rotate">rotate</a></li>

          <li><a href="#tref">tref</a></li>

          <li><a href="#tspan">tspan</a></li>
        </ul>
      </div>

      <h3>shared methods</h3>

      <p>In addition to the methods listed above, <code>class
      RVG::Text</code> also implements the <a href=
      "rvgstyle.html">styles</a> method.</p>

      <h3>text styles</h3>

      <div class="toccol">
        <ul>
          <li><a href="#basic">basic styles</a></li>

          <li><a href="#advanced">advanced styles</a></li>
        </ul>
      </div>
    </div>
  </div>

  <h2 class="methods">class methods</h2>

  <div class="sig">
    <h3 id="new">new</h3>

    <p>RVG::Text.new(<span class="arg">x</span>=0, <span class=
    "arg">y</span>=0, <span class="arg">text</span>=nil) [
    <span class="arg">{ |text| ...}</span> ] -&gt; aText</p>
  </div>

  <div class="desc">
    <h4>Description</h4>

    <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>

    <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>

    <h4>Arguments</h4>

    <p>All arguments are optional. You can omit all the arguments
    when you just want to use the <code>text</code> object as a
    container for <code>tspans</code>.</p>

    <dl>
      <dt>x, y</dt>

      <dd>The [x, y] coordinate of the initial text position within
      the current user coordinate system. If omitted the default is
      [0, 0].</dd>

      <dt>text</dt>

      <dd>A string. If present, this string is drawn at the initial
      text position. If omitted, only the initial text position is
      established. 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 to override
      this behavior. After the string is rendered, the current text
      position is moved to the end of the string.</dd>
    </dl>

    <h4>Example</h4>

    <p><a href="javascript:popup('text01.rb.html')"><img src=
    "ex/text01.gif" title="Click to see the example script" alt=
    "text example" /></a></p>
  </div>

  <h2 class="methods">instance methods</h2>

  <div class='sig'>
    <h3 id='d'>d</h3>

    <p><span class="arg">text</span>.d(<span class=
    "arg">dx</span>[, <span class="arg">dy</span>=0]) [
    <span class="arg">{ |self| ...}</span> ] -&gt; <span class=
    "arg">self</span></p>
  </div>

  <div class="desc">
    <h4>Description</h4>

    <p>The <span class="arg">dx</span> and <span class=
    "arg">dy</span> arguments are added to the <span class=
    "arg">x</span> and <span class="arg">y</span> <code>text</code>
    arguments to form the initial text position. Yields to a block
    if one is present.</p>

    <h4>Arguments</h4>

    <dl>
      <dt>dx, dy</dt>

      <dd>The distance, in the user coordinate system, to be added
      to the <em>x</em> and <em>y</em> coordinates of the initial
      text position.</dd>
    </dl>

    <h4>Returns</h4>

    <p>self</p>
  </div>

  <div class='sig'>
    <h3 id='rotate'>rotate</h3>

    <p><span class="arg">text</span>.rotate(<span class=
    "arg">degrees</span>) [ <span class="arg">{ |text| ...}</span>
    ] -&gt; <span class="arg">self</span></p>
  </div>

  <div class="desc">
    <h4>Description</h4>

    <p>Rotates the text about the initial text position by the
    specified number of <span class="arg">degrees</span>. Yields to
    a block if one is present.</p>

    <h4>Arguments</h4>

    <dl>
      <dt>degrees</dt>

      <dd>The amount of rotation</dd>
    </dl>

    <h4>Returns</h4>

    <p>self</p>
  </div>

  <div class='sig'>
    <h3 id='tref'>tref</h3>

    <p><span class="arg">text</span>.tref(<span class=
    "arg">tspan</span>, <span class="arg">x</span>=0, <span class=
    "arg">y</span>=0) -&gt; <span class="arg">self</span></p>
  </div>

  <div class="desc">
    <h4>Description</h4>

    <p>Adds the referenced <a href="rvgtspan.html#new">Tspan</a>
    object to the text container.</p>

    <h4>Arguments</h4>

    <dl>
      <dt>tspan</dt>

      <dd>A <code>Tspan</code> object.</dd>

      <dt>x, y</dt>

      <dd>The absolute text position</dd>
    </dl>

    <h4>Example</h4>

    <p><a href="javascript:popup('tref01.rb.html')"><img src=
    "ex/tref01.gif" title="Click to see the example script" alt=
    "tref example" /></a></p>
  </div>

  <div class='sig'>
    <h3 id='tspan'>tspan</h3>

    <p><span class="arg">text</span>.tspan(<span class=
    "arg">string</span>=nil, <span class="arg">x</span>=nil,
    <span class="arg">y</span>=nil) [ <span class="arg">{ |tspan|
    ...}</span> ] -&gt; aTspan</p>
  </div>

  <div class="desc">
    <h4>Description</h4>

    <p>Calls <a href="rvgtspan.html#new">RVG::Tspan.new</a> to
    construct a tspan and adds it to the enclosing RVG::Text
    object. Yields to a block if one is present, passing the new
    tspan as an argument.</p>

    <p><em>Although <code>tspan</code> has the same arguments as
    <code>RVG::Text.new</code> they are not in the same order. The
    <code>tspan</code> method has the <span class=
    "arg">string</span> argument first followed by the
    [<span class="arg">x</span>, <span class="arg">y</span>]
    arguments. The <code>RVG::Text.new</code> arguments are just
    the opposite.</em></p>

    <h4>Arguments</h4>

    <dl>
      <dt>string</dt>

      <dd>A text string.</dd>

      <dt>x, y</dt>

      <dd>The absolute text position</dd>
    </dl>

    <h4>Returns</h4>

    <p>The new tspan, so other <code>RVG::Tspan</code> methods can
    be chained to it.</p>
  </div>

  <h2 class="methods">text styles</h2>

  <div class="styles_header">
    <h3 id="basic">basic styles</h3>
  </div>

  <div class="desc">
    <h4>Description</h4>

    <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>

    <h4>Styles</h4>

    <dl>
      <dt>:font</dt>

      <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>

      <dt>:font_family</dt>

      <dd>font family name, such as "serif" or "courier"</dd>

      <dt>:font_size</dt>

      <dd>the font size in points</dd>

      <dt>:font_stretch</dt>

      <dd>one of the following strings: 'normal',
      'ultra_condensed', 'extra_condensed', 'condensed',
      'semi_condensed', 'semi_expanded', 'expanded',
      'extra_expanded', 'ultra_expanded'</dd>

      <dt>:font_style</dt>

      <dd>one of the following strings: 'normal', 'italic',
      'oblique'</dd>

      <dt>:font_weight</dt>

      <dd>one of the following strings: 'normal', 'bold', 'bolder',
      'lighter', or a multiple of 100 between 100 and 900</dd>

      <dt id='text_anchor'>:text_anchor</dt>

      <dd>one of the following strings: 'start', 'middle',
      'end'</dd>

      <dt>:text_decoration</dt>

      <dd>one of the following strings: 'none', 'underline',
      'overline', 'line_through'</dd>
    </dl>

    <h4>Examples</h4>

    <p><strong>font styles</strong><a href=
    "javascript:popup('font_styles.rb.html')"><img src=
    "ex/font_styles.gif" title="Click to see the example script"
    alt="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>

    <p><strong>text styles</strong><a href=
    "javascript:popup('text_styles.rb.html')"><img src=
    "ex/text_styles.gif" title="Click to see the example script"
    alt="text styles example" /></a></p>
  </div>

  <div class="styles_header">
    <h3 id="advanced">advanced styles</h3>

    <div class="desc">
      <h4>Description</h4>

      <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>

      <h4>Styles</h4>

      <dl>
        <dt>:writing_mode</dt>

        <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>

        <dt>:baseline_shift</dt>

        <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>

        <dt>:letter_spacing</dt>

        <dd>Specifies an amount of space to be added between each
        letter. The default is 0.</dd>

        <dt>:word_spacing</dt>

        <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>

        <dd>RVG uses this statement to separate words:
        <strong>words =
        text.split(::Magick::RVG::WORD_SEP)</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>

        <dt>:glyph_orientation_vertical</dt>

        <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>

        <dt>:glyph_orientation_horizontal</dt>

        <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>
      </dl>

      <h4>Examples</h4>

      <p><strong>:writing_mode='tb'</strong><a href=
      "javascript:popup('writing_mode01.rb.html')"><img src=
      "ex/writing_mode01.gif" title=
      "Click to see the example script" alt=
      "writing mode 'tb' style example" /></a></p>

      <p><strong>:writing_mode='lr'</strong><a href=
      "javascript:popup('writing_mode02.rb.html')"><img src=
      "ex/writing_mode02.gif" title=
      "Click to see the example script" alt=
      "writing mode 'lr' style example" /></a></p>

      <p><strong>:baseline_shift=&gt;'sub'<br />
      :baseline_shift=&gt;'super'</strong><a href=
      "javascript:popup('baseline_shift01.rb.html')"><img src=
      "ex/baseline_shift01.gif" title=
      "Click to see the example script" alt=
      "baseline shift style example" /></a></p>
    </div>
  </div>

  <p class="spacer">&nbsp;</p>

  <div class="nav">
    &laquo; <a href="rvgclip.html">Prev</a> | <a href=
    "index.html">Contents</a> | <a href="rvgtspan.html">Next</a>
    &raquo;
  </div>
</body>
</html>
Something went wrong with that request. Please try again.