<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
  Class: RRTF::Font
  
    &mdash; Documentation by YARD 0.9.9
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  pathId = "RRTF::Font";
  relpath = '../';
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div class="nav_wrap">
      <iframe id="nav" src="../class_list.html?1"></iframe>
      <div id="resizer"></div>
    </div>

    <div id="main" tabindex="-1">
      <div id="header">
        <div id="menu">
  
    <a href="../_index.html">Index (F)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../RRTF.html" title="RRTF (module)">RRTF</a></span></span>
     &raquo; 
    <span class="title">Font</span>
  
</div>

        <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">

        <svg width="24" height="24">
          <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
        </svg>
    </a>
  
</div>
        <div class="clear"></div>
      </div>

      <div id="content"><h1>Class: RRTF::Font
  
  
  
</h1>
<div class="box_info">
  
  <dl>
    <dt>Inherits:</dt>
    <dd>
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">RRTF::Font</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
    </dd>
  </dl>
  

  
  
  
  
  

  

  
  <dl>
    <dt>Defined in:</dt>
    <dd>lib/rrtf/font.rb</dd>
  </dl>
  
</div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    
<p>This class represents a font for use with some RTF content.</p>


  </div>
</div>
<div class="tags">
  

</div>
  <h2>Constant Summary</h2>
  <dl class="constants">
    
      <dt id="MODERN-constant" class="">MODERN =
        <div class="docstring">
  <div class="discussion">
    
<p>A declaration for a font family. This family is used for monospaced fonts
(e.g. Courier New).</p>


  </div>
</div>
<div class="tags">
  

</div>
      </dt>
      <dd><pre class="code"><span class='symbol'>:modern</span></pre></dd>
    
      <dt id="ROMAN-constant" class="">ROMAN =
        <div class="docstring">
  <div class="discussion">
    
<p>A declaration for a font family. This family is used for proportionally
spaced serif fonts (e.g. Arial, Times New Roman).</p>


  </div>
</div>
<div class="tags">
  

</div>
      </dt>
      <dd><pre class="code"><span class='symbol'>:roman</span></pre></dd>
    
      <dt id="SWISS-constant" class="">SWISS =
        <div class="docstring">
  <div class="discussion">
    
<p>A declaration for a font family. This family is used for proportionally
spaced sans serif fonts (e.g. Tahoma, Lucida Sans).</p>


  </div>
</div>
<div class="tags">
  

</div>
      </dt>
      <dd><pre class="code"><span class='symbol'>:swiss</span></pre></dd>
    
      <dt id="NIL-constant" class="">NIL =
        <div class="docstring">
  <div class="discussion">
    
<p>A declaration for a font family. This family is used where none of the
other families apply.</p>


  </div>
</div>
<div class="tags">
  

</div>
      </dt>
      <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>nil</span><span class='tstring_end'>&#39;</span></span><span class='period'>.</span><span class='id identifier rubyid_intern'>intern</span></pre></dd>
    
  </dl>




  <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#family-instance_method" title="#family (instance method)">#<strong>family</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Attribute accessor.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#name-instance_method" title="#name (instance method)">#<strong>name</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Attribute accessor.</p>
</div></span>
  
</li>

    
  </ul>




  
    <h2>
      Class Method Summary
      <small><a href="#" class="summary_toggle">collapse</a></small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#from_string-class_method" title="from_string (class method)">.<strong>from_string</strong>(str)  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Format: “&lt;FAMILY_CONSTANT&gt;:&lt;Name&gt;”.</p>
</div></span>
  
</li>

      
    </ul>
  
    <h2>
      Instance Method Summary
      <small><a href="#" class="summary_toggle">collapse</a></small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#==-instance_method" title="#== (instance method)">#<strong>==</strong>(object)  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>This method overloads the equivalence test operator for the Font class to
allow for Font comparisons.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(family, name)  &#x21d2; Font </a>
    

    
  </span>
  
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>This is the constructor for the Font class.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_rtf-instance_method" title="#to_rtf (instance method)">#<strong>to_rtf</strong>(indent = 0)  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>This method generates the RTF representation for a Font object as it would
appear within a document font table.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong>(indent = 0)  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>This method fetches a textual description for a Font object.</p>
</div></span>
  
</li>

      
    </ul>
  

<div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <h3 class="signature first" id="initialize-instance_method">
  
    #<strong>initialize</strong>(family, name)  &#x21d2; <tt><span class='object_link'><a href="" title="RRTF::Font (class)">Font</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>This is the constructor for the Font class.</p>

<h4 id="label-Parameters">Parameters</h4>
<dl class="rdoc-list note-list"><dt>family
<dd>
<p>The font family for the new font. This should be one of Font::MODERN,
Font::ROMAN, Font::SWISS or Font::NIL.</p>
</dd><dt>name
<dd>
<p>A string containing the font name.</p>
</dd></dl>

<h4 id="label-Exceptions">Exceptions</h4>
<dl class="rdoc-list note-list"><dt>RTFError
<dd>
<p>Generated whenever an invalid font family is specified.</p>
</dd></dl>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


48
49
50
51
52
53
54
55</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/rrtf/font.rb', line 48</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_family'>family</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
   <span class='comment'># Check that a valid family has been provided.
</span>   <span class='kw'>if</span> <span class='op'>!</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="#MODERN-constant" title="RRTF::Font::MODERN (constant)">MODERN</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="#ROMAN-constant" title="RRTF::Font::ROMAN (constant)">ROMAN</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="#SWISS-constant" title="RRTF::Font::SWISS (constant)">SWISS</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="#NIL-constant" title="RRTF::Font::NIL (constant)">NIL</a></span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_family'>family</span><span class='rparen'>)</span>
      <span class='const'><span class='object_link'><a href="RTFError.html" title="RRTF::RTFError (class)">RTFError</a></span></span><span class='op'>::</span><span class='id identifier rubyid_fire'><span class='object_link'><a href="RTFError.html#fire-class_method" title="RRTF::RTFError.fire (method)">fire</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Unknown font family specified for Font object.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
   <span class='kw'>end</span>
   <span class='ivar'>@family</span> <span class='op'>=</span> <span class='id identifier rubyid_family'>family</span>
   <span class='ivar'>@name</span>   <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>

  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id=""></span>
      <div class="method_details first">
  <h3 class="signature first" id="family-instance_method">
  
    #<strong>family</strong>  &#x21d2; <tt>Object</tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Attribute accessor.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


24
25
26</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/rrtf/font.rb', line 24</span>

<span class='kw'>def</span> <span class='id identifier rubyid_family'>family</span>
  <span class='ivar'>@family</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="name-instance_method">
  
    #<strong>name</strong>  &#x21d2; <tt>Object</tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Attribute accessor.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


24
25
26</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/rrtf/font.rb', line 24</span>

<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
  <span class='ivar'>@name</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>


  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="from_string-class_method">
  
    .<strong>from_string</strong>(str)  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Format: “&lt;FAMILY_CONSTANT&gt;:&lt;Name&gt;”</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


28
29
30
31
32
33
34
35</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/rrtf/font.rb', line 28</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_from_string'>from_string</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span>
  <span class='kw'>if</span> <span class='id identifier rubyid_str'>str</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>([a-z]+):(.+)</span><span class='regexp_end'>/i</span></span>
    <span class='id identifier rubyid_parts'>parts</span> <span class='op'>=</span> <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>:</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
    <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../RRTF.html" title="RRTF (module)">RRTF</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Utilities.html" title="RRTF::Utilities (class)">Utilities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_constantize'><span class='object_link'><a href="Utilities.html#constantize-class_method" title="RRTF::Utilities.constantize (method)">constantize</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>RRTF::Font::</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_parts'>parts</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_parts'>parts</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='rparen'>)</span>
  <span class='kw'>else</span>
    <span class='const'><span class='object_link'><a href="RTFError.html" title="RRTF::RTFError (class)">RTFError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_fire'><span class='object_link'><a href="RTFError.html#fire-class_method" title="RRTF::RTFError.fire (method)">fire</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Unreconized string font format &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_str'>str</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39;.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="==-instance_method">
  
    #<strong>==</strong>(object)  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>This method overloads the equivalence test operator for the Font class to
allow for Font comparisons.</p>

<h4 id="label-Parameters">Parameters</h4>
<dl class="rdoc-list note-list"><dt>object
<dd>
<p>A reference to the object to be compared with.</p>
</dd></dl>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


62
63
64
65
66</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/rrtf/font.rb', line 62</span>

<span class='kw'>def</span> <span class='op'>==</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span>
   <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_instance_of?'>instance_of?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="RRTF::Font (class)">Font</a></span></span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span>
   <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_family'>family</span> <span class='op'>==</span> <span class='ivar'>@family</span> <span class='op'>&amp;&amp;</span>
   <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span>   <span class='op'>==</span> <span class='ivar'>@name</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="to_rtf-instance_method">
  
    #<strong>to_rtf</strong>(indent = 0)  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>This method generates the RTF representation for a Font object as it would
appear within a document font table.</p>

<h4 id="label-Parameters">Parameters</h4>
<dl class="rdoc-list note-list"><dt>indent
<dd>
<p>The number of spaces to prefix to the lines generated by the method.
Defaults to zero.</p>
</dd></dl>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


84
85
86
87</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/rrtf/font.rb', line 84</span>

<span class='kw'>def</span> <span class='id identifier rubyid_to_rtf'>to_rtf</span><span class='lparen'>(</span><span class='id identifier rubyid_indent'>indent</span><span class='op'>=</span><span class='int'>0</span><span class='rparen'>)</span>
   <span class='id identifier rubyid_prefix'>prefix</span> <span class='op'>=</span> <span class='id identifier rubyid_indent'>indent</span> <span class='op'>&gt;</span> <span class='int'>0</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'> </span><span class='tstring_end'>&#39;</span></span> <span class='op'>*</span> <span class='id identifier rubyid_indent'>indent</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
   <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_prefix'>prefix</span><span class='embexpr_end'>}</span><span class='tstring_content'>\\f</span><span class='embexpr_beg'>#{</span><span class='ivar'>@family</span><span class='period'>.</span><span class='id identifier rubyid_id2name'>id2name</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@name</span><span class='embexpr_end'>}</span><span class='tstring_content'>;</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="to_s-instance_method">
  
    #<strong>to_s</strong>(indent = 0)  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>This method fetches a textual description for a Font object.</p>

<h4 id="label-Parameters">Parameters</h4>
<dl class="rdoc-list note-list"><dt>indent
<dd>
<p>The number of spaces to prefix to the lines generated by the method.
Defaults to zero.</p>
</dd></dl>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


73
74
75
76</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/rrtf/font.rb', line 73</span>

<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span><span class='lparen'>(</span><span class='id identifier rubyid_indent'>indent</span><span class='op'>=</span><span class='int'>0</span><span class='rparen'>)</span>
   <span class='id identifier rubyid_prefix'>prefix</span> <span class='op'>=</span> <span class='id identifier rubyid_indent'>indent</span> <span class='op'>&gt;</span> <span class='int'>0</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'> </span><span class='tstring_end'>&#39;</span></span> <span class='op'>*</span> <span class='id identifier rubyid_indent'>indent</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
   <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_prefix'>prefix</span><span class='embexpr_end'>}</span><span class='tstring_content'>Family: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@family</span><span class='period'>.</span><span class='id identifier rubyid_id2name'>id2name</span><span class='embexpr_end'>}</span><span class='tstring_content'>, Name: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@name</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

      <div id="footer">
  Generated on Mon Jul 31 21:48:58 2017 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.9.9 (ruby-2.3.3).
</div>

    </div>
  </body>
</html>