Lenard Lindstrom avatar Lenard Lindstrom committed e1750e4

releasing freetype module

Comments (0)

Files changed (2)

docs/pygame/genindex.html

   </dt>
 
       
-  <dt><a href="ref/freetype.html#pygame.freetype.Font.ascender">ascender() (pygame.freetype.Font method)</a>
+  <dt><a href="ref/freetype.html#pygame.freetype.Font.ascender">ascender (pygame.freetype.Font attribute)</a>
   </dt>
 
       
   </dt>
 
       
+  <dt><a href="ref/freetype.html#pygame.freetype.Font.fgcolor">fgcolor (pygame.freetype.Font attribute)</a>
+  </dt>
+
+      
   <dt><a href="ref/mask.html#pygame.mask.Mask.fill">fill() (pygame.mask.Mask method)</a>
   </dt>
 
 
       </dl></dd>
       
-  <dt><a href="ref/freetype.html#pygame.freetype.Font.get_sized_ascender">get_sized_ascender (pygame.freetype.Font attribute)</a>
+  <dt><a href="ref/freetype.html#pygame.freetype.Font.get_sized_ascender">get_sized_ascender() (pygame.freetype.Font method)</a>
   </dt>
 
       
   </dt>
 
       
-  <dt><a href="ref/freetype.html#pygame.freetype.Font.get_sized_height">get_sized_height (pygame.freetype.Font attribute)</a>
+  <dt><a href="ref/freetype.html#pygame.freetype.Font.get_sized_height">get_sized_height() (pygame.freetype.Font method)</a>
   </dt>
 
       

docs/pygame/ref/freetype.html

 <td>—</td>
 <td>text rotation in degrees counterclockwise</td>
 </tr>
-<tr class="row-odd"><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.origin">pygame.freetype.Font.origin</a></td>
+<tr class="row-odd"><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.fgcolor">pygame.freetype.Font.fgcolor</a></td>
+<td>—</td>
+<td>default foreground color</td>
+</tr>
+<tr class="row-even"><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.origin">pygame.freetype.Font.origin</a></td>
 <td>—</td>
 <td>Font render to text origin mode</td>
 </tr>
-<tr class="row-even"><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.pad">pygame.freetype.Font.pad</a></td>
+<tr class="row-odd"><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.pad">pygame.freetype.Font.pad</a></td>
 <td>—</td>
 <td>padded boundary mode</td>
 </tr>
-<tr class="row-odd"><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.ucs4">pygame.freetype.Font.ucs4</a></td>
+<tr class="row-even"><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.ucs4">pygame.freetype.Font.ucs4</a></td>
 <td>—</td>
 <td>Enable UCS-4 mode</td>
 </tr>
-<tr class="row-even"><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.resolution">pygame.freetype.Font.resolution</a></td>
+<tr class="row-odd"><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.resolution">pygame.freetype.Font.resolution</a></td>
 <td>—</td>
 <td>Pixel resolution in dots per inch</td>
 </tr>
 points, which will be used when rendering the font. The size can also be
 passed explicitly to each method call. Because of the way the caching
 system works, specifying a default size on the constructor doesn&#8217;t imply a
-performance gain over manually passing the size on each function call.</p>
+performance gain over manually passing the size on each function call.
+If the font is bitmap and no <em>size</em> is given, the default size is set
+to the first available size for the font, if possible.</p>
 <p>If the font file has more than one font, the font to load can be chosen with
 the <em>index</em> argument. An exception is raised for an out-of-range font index
 value.</p>
 <tt class="descname">size</tt><a class="headerlink" href="#pygame.freetype.Font.size" title="Permalink to this definition">¶</a></dt>
 <dd><div class="line-block">
 <div class="line"><span class="summaryline">The default point size used in rendering</span></div>
-<div class="line"><span class="signature">size -&gt; int</span></div>
+<div class="line"><span class="signature">size -&gt; float</span></div>
+<div class="line"><span class="signature">size -&gt; (float, float)</span></div>
 </div>
-<p>Get or set a default point size used by metric or render methods.</p>
+<p>Get or set the default size for text metrics and rendering. It can be
+a single point size, given as an Python <tt class="docutils literal"><span class="pre">int</span></tt> or <tt class="docutils literal"><span class="pre">float</span></tt>, or a
+font ppem (width, height) <tt class="docutils literal"><span class="pre">tuple</span></tt>. Size values are non-negative.
+A zero size or width represents an undefined size. In this case
+the size must be given as a method argument, or an exception is
+raised. A zero width but non-zero height is a ValueError.</p>
+<p>For a scalable font, a single number value is equivalent to a tuple
+with width equal height. A font can be stretched vertically with
+height set greater than width, or horizontally with width set
+greater than height. For embedded bitmaps, as listed by <a class="reference internal" href="#pygame.freetype.Font.get_sizes" title="pygame.freetype.Font.get_sizes"><tt class="xref py py-meth docutils literal"><span class="pre">get_sizes()</span></tt></a>,
+use the nominal width and height to select an available size.</p>
+<p>Font size differs for a non-scalable, bitmap, font. During a
+method call it must match one of the available sizes returned by
+method <a class="reference internal" href="#pygame.freetype.Font.get_sizes" title="pygame.freetype.Font.get_sizes"><tt class="xref py py-meth docutils literal"><span class="pre">get_sizes()</span></tt></a>. If not, an exception is raised.
+If the size is a single number, the size is first matched against the
+point size value. If no match, then the available size with the
+same nominal width and height is chosen.</p>
 </dd></dl>
 
 <dl class="definition method">
 position and bearing at the start of the text.</p>
 <p>If text is a char (byte) string, then its encoding is assumed to be
 <tt class="docutils literal"><span class="pre">LATIN1</span></tt>.</p>
+<p>Optionally, text can be <tt class="xref py py-const docutils literal"><span class="pre">None</span></tt>, which will return the bounding
+rectangle for the text passed to a previous <a class="reference internal" href="#pygame.freetype.Font.get_rect" title="pygame.freetype.Font.get_rect"><tt class="xref py py-meth docutils literal"><span class="pre">get_rect()</span></tt></a>,
+<a class="reference internal" href="#pygame.freetype.Font.render" title="pygame.freetype.Font.render"><tt class="xref py py-meth docutils literal"><span class="pre">render()</span></tt></a>, <a class="reference internal" href="#pygame.freetype.Font.render_to" title="pygame.freetype.Font.render_to"><tt class="xref py py-meth docutils literal"><span class="pre">render_to()</span></tt></a>, <a class="reference internal" href="#pygame.freetype.Font.render_raw" title="pygame.freetype.Font.render_raw"><tt class="xref py py-meth docutils literal"><span class="pre">render_raw()</span></tt></a>, or
+<a class="reference internal" href="#pygame.freetype.Font.render_raw_to" title="pygame.freetype.Font.render_raw_to"><tt class="xref py py-meth docutils literal"><span class="pre">render_raw_to()</span></tt></a> call. See <a class="reference internal" href="#pygame.freetype.Font.render_to" title="pygame.freetype.Font.render_to"><tt class="xref py py-meth docutils literal"><span class="pre">render_to()</span></tt></a> for more
+details.</p>
 </dd></dl>
 
 <dl class="definition method">
 glyphs in the font.</p>
 </dd></dl>
 
-<dl class="definition method">
+<dl class="definition attribute">
 <dt class="title" id="pygame.freetype.Font.ascender">
-<tt class="descname">ascender</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.ascender" title="Permalink to this definition">¶</a></dt>
+<tt class="descname">ascender</tt><a class="headerlink" href="#pygame.freetype.Font.ascender" title="Permalink to this definition">¶</a></dt>
 <dd><div class="line-block">
 <div class="line"><span class="summaryline">The unscaled ascent of the font in font units</span></div>
 <div class="line"><span class="signature">ascender -&gt; int</span></div>
 bottom of the bounding box.</p>
 </dd></dl>
 
-<dl class="definition attribute">
+<dl class="definition method">
 <dt class="title" id="pygame.freetype.Font.get_sized_ascender">
-<tt class="descname">get_sized_ascender</tt><a class="headerlink" href="#pygame.freetype.Font.get_sized_ascender" title="Permalink to this definition">¶</a></dt>
+<tt class="descname">get_sized_ascender</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.get_sized_ascender" title="Permalink to this definition">¶</a></dt>
 <dd><div class="line-block">
 <div class="line"><span class="summaryline">The scaled ascent of the font in pixels</span></div>
-<div class="line"><span class="signature">get_sized_ascender() -&gt; int</span></div>
+<div class="line"><span class="signature">get_sized_ascender(&lt;size&gt;=0) -&gt; int</span></div>
 </div>
 <p>Return the number of units from the font&#8217;s baseline to the top of the
 bounding box. It is not adjusted for strong or rotation.</p>
 <tt class="descname">get_sized_descender</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.get_sized_descender" title="Permalink to this definition">¶</a></dt>
 <dd><div class="line-block">
 <div class="line"><span class="summaryline">The scaled descent of the font in pixels</span></div>
-<div class="line"><span class="signature">get_sized_descender() -&gt; int</span></div>
+<div class="line"><span class="signature">get_sized_descender(&lt;size&gt;=0) -&gt; int</span></div>
 </div>
 <p>Return the number of pixels from the font&#8217;s baseline to the top of the
 bounding box. It is not adjusted for strong or rotation.</p>
 </dd></dl>
 
-<dl class="definition attribute">
+<dl class="definition method">
 <dt class="title" id="pygame.freetype.Font.get_sized_height">
-<tt class="descname">get_sized_height</tt><a class="headerlink" href="#pygame.freetype.Font.get_sized_height" title="Permalink to this definition">¶</a></dt>
+<tt class="descname">get_sized_height</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.get_sized_height" title="Permalink to this definition">¶</a></dt>
 <dd><div class="line-block">
 <div class="line"><span class="summaryline">The scaled height of the font in pixels</span></div>
-<div class="line"><span class="signature">get_sized_height() -&gt; int</span></div>
+<div class="line"><span class="signature">get_sized_height(&lt;size&gt;=0) -&gt; int</span></div>
 </div>
 <p>Read only. Gets the height of the font. This is the average value of all
 glyphs in the font. It is not adjusted for strong or rotation.</p>
 <tt class="descname">get_sized_glyph_height</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.get_sized_glyph_height" title="Permalink to this definition">¶</a></dt>
 <dd><div class="line-block">
 <div class="line"><span class="summaryline">The scaled bounding box height of the font in pixels</span></div>
-<div class="line"><span class="signature">get_sized_glyph_height() -&gt; int</span></div>
+<div class="line"><span class="signature">get_sized_glyph_height(&lt;size&gt;=0) -&gt; int</span></div>
 </div>
 <p>Return the glyph bounding box height of the font in pixels.
 This is the average value of all glyphs in the font.
 <tt class="descname">render</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.render" title="Permalink to this definition">¶</a></dt>
 <dd><div class="line-block">
 <div class="line"><span class="summaryline">Return rendered text as a surface</span></div>
-<div class="line"><span class="signature">render(text, fgcolor, bgcolor=None, style=STYLE_DEFAULT, rotation=0, size=0) -&gt; (Surface, Rect)</span></div>
+<div class="line"><span class="signature">render(text, fgcolor=None, bgcolor=None, style=STYLE_DEFAULT, rotation=0, size=0) -&gt; (Surface, Rect)</span></div>
 </div>
 <p>Returns a new <a class="tooltip reference internal" href="surface.html#pygame.Surface" title=""><tt class="xref py py-mod docutils literal"><span class="pre">pygame.Surface</span></tt><span class="tooltip-content">pygame object for representing images</span></a>, with the text rendered to it
-in the color given by &#8216;fgcolor&#8217;. If <tt class="docutils literal"><span class="pre">bgcolor</span></tt> is given, the surface
+in the color given by &#8216;fgcolor&#8217;. If no foreground color is given,
+the default foreground color, <a class="reference internal" href="#pygame.freetype.Font.fgcolor" title="pygame.freetype.Font.fgcolor"><tt class="xref py py-attr docutils literal"><span class="pre">fgcolor</span></tt></a> is used.
+If <tt class="docutils literal"><span class="pre">bgcolor</span></tt> is given, the surface
 will be filled with this color. If no background color is given,
 the surface is filled with zero alpha opacity. Normally the returned
-surface has a 32 bit pixel size. However, if <tt class="docutils literal"><span class="pre">bgcolor</span></tt> is <tt class="docutils literal"><span class="pre">None</span></tt>
+surface has a 32 bit pixel size. However, if <tt class="docutils literal"><span class="pre">bgcolor</span></tt> is <tt class="xref py py-const docutils literal"><span class="pre">None</span></tt>
 and anti-aliasing is disabled a two color 8 bit surface with colorkey
 set for the background color is returned.</p>
 <p>The return value is a tuple: the new surface and the bounding
 rectangle giving the size and origin of the rendered text.</p>
 <p>If an empty string is passed for text then the returned Rect is zero
-width and the height of the font. If dest is None the returned surface is
-the same dimensions as the boundary rect. The rect will test False.</p>
+width and the height of the font. If dest is <tt class="xref py py-const docutils literal"><span class="pre">None</span></tt> the returned
+surface is the same dimensions as the boundary rect.
+The rect will test False.</p>
 <p>The rendering is done using the font&#8217;s default size in points and its
 default style, without any rotation, and taking into account fonts which
 are set to be drawn vertically via the <a class="reference internal" href="#pygame.freetype.Font.vertical" title="pygame.freetype.Font.vertical"><tt class="xref py py-attr docutils literal"><span class="pre">vertical</span></tt></a> attribute.
 <a class="reference internal" href="#pygame.freetype.Font.rotation" title="pygame.freetype.Font.rotation"><tt class="xref py py-attr docutils literal"><span class="pre">rotation</span></tt></a>, and <a class="reference internal" href="#pygame.freetype.Font.style" title="pygame.freetype.Font.style"><tt class="xref py py-attr docutils literal"><span class="pre">style</span></tt></a> attributes.</p>
 <p>If text is a char (byte) string, then its encoding is assumed to be
 <tt class="docutils literal"><span class="pre">LATIN1</span></tt>.</p>
+<p>Optionally, text can be None, which will return the bounding
+rectangle for the text passed to a previous <a class="reference internal" href="#pygame.freetype.Font.get_rect" title="pygame.freetype.Font.get_rect"><tt class="xref py py-meth docutils literal"><span class="pre">get_rect()</span></tt></a>,
+<a class="reference internal" href="#pygame.freetype.Font.render" title="pygame.freetype.Font.render"><tt class="xref py py-meth docutils literal"><span class="pre">render()</span></tt></a>, <a class="reference internal" href="#pygame.freetype.Font.render_to" title="pygame.freetype.Font.render_to"><tt class="xref py py-meth docutils literal"><span class="pre">render_to()</span></tt></a>, <a class="reference internal" href="#pygame.freetype.Font.render_raw" title="pygame.freetype.Font.render_raw"><tt class="xref py py-meth docutils literal"><span class="pre">render_raw()</span></tt></a>, or
+<a class="reference internal" href="#pygame.freetype.Font.render_raw_to" title="pygame.freetype.Font.render_raw_to"><tt class="xref py py-meth docutils literal"><span class="pre">render_raw_to()</span></tt></a> call. See <a class="reference internal" href="#pygame.freetype.Font.render_to" title="pygame.freetype.Font.render_to"><tt class="xref py py-meth docutils literal"><span class="pre">render_to()</span></tt></a> for more
+details.</p>
 </dd></dl>
 
 <dl class="definition method">
 <tt class="descname">render_to</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.render_to" title="Permalink to this definition">¶</a></dt>
 <dd><div class="line-block">
 <div class="line"><span class="summaryline">Render text onto an existing surface</span></div>
-<div class="line"><span class="signature">render(surf, dest, text, fgcolor, bgcolor=None, style=STYLE_DEFAULT, rotation=0, size=0) -&gt; Rect</span></div>
+<div class="line"><span class="signature">render_to(surf, dest, text, fgcolor=None, bgcolor=None, style=STYLE_DEFAULT, rotation=0, size=0) -&gt; Rect</span></div>
 </div>
 <p>Renders the string &#8216;text&#8217; to a <a class="tooltip reference internal" href="surface.html#pygame.Surface" title=""><tt class="xref py py-mod docutils literal"><span class="pre">pygame.Surface</span></tt><span class="tooltip-content">pygame object for representing images</span></a> &#8216;surf&#8217;,
-using the color &#8216;fgcolor&#8217;.</p>
+using the color &#8216;fgcolor&#8217;, if given, or the default foreground
+color, <a class="reference internal" href="#pygame.freetype.Font.fgcolor" title="pygame.freetype.Font.fgcolor"><tt class="xref py py-attr docutils literal"><span class="pre">fgcolor</span></tt></a>, otherwise.</p>
 <p>Argument &#8216;dest&#8217; is an (x, y) surface coordinate pair. If either x
 or y is not an integer it is converted to one if possible.
-Any sequence, including Rect, for which the first two elements are
-positions x and y is accepted.</p>
+Any sequence, including <tt class="xref py py-class docutils literal"><span class="pre">Rect</span></tt>, for which the first
+two elements are positions x and y is accepted.</p>
 <p>If a background color is given, the surface is first filled with that
 color. The text is blitted next. Both the background fill and text
 rendering involve full alpha blits. That is, the alpha values of
 destination surface if it has per-pixel alpha.</p>
 <p>The return value is a rectangle giving the size and position of the
 rendered text within the surface.</p>
-<p>If an empty string is passed for text then the returned Rect is zero
-width and the height of the font. The rect will test False.</p>
+<p>If an empty string is passed for text then the returned <tt class="xref py py-class docutils literal"><span class="pre">Rect</span></tt>
+is zero width and the height of the font. The rect will test False.</p>
+<p>Optionally, text can be set <tt class="xref py py-const docutils literal"><span class="pre">None</span></tt>, which will re-render text
+passed to a previous <a class="reference internal" href="#pygame.freetype.Font.render_to" title="pygame.freetype.Font.render_to"><tt class="xref py py-meth docutils literal"><span class="pre">render_to()</span></tt></a>, <a class="reference internal" href="#pygame.freetype.Font.get_rect" title="pygame.freetype.Font.get_rect"><tt class="xref py py-meth docutils literal"><span class="pre">get_rect()</span></tt></a>, <a class="reference internal" href="#pygame.freetype.Font.render" title="pygame.freetype.Font.render"><tt class="xref py py-meth docutils literal"><span class="pre">render()</span></tt></a>,
+<a class="reference internal" href="#pygame.freetype.Font.render_raw" title="pygame.freetype.Font.render_raw"><tt class="xref py py-meth docutils literal"><span class="pre">render_raw()</span></tt></a>, or <a class="reference internal" href="#pygame.freetype.Font.render_raw_to" title="pygame.freetype.Font.render_raw_to"><tt class="xref py py-meth docutils literal"><span class="pre">render_raw_to()</span></tt></a> call. Primarily, this
+feature is an aid to using <a class="reference internal" href="#pygame.freetype.Font.render_to" title="pygame.freetype.Font.render_to"><tt class="xref py py-meth docutils literal"><span class="pre">render_to()</span></tt></a> in combination with
+<a class="reference internal" href="#pygame.freetype.Font.get_rect" title="pygame.freetype.Font.get_rect"><tt class="xref py py-meth docutils literal"><span class="pre">get_rect()</span></tt></a>. An example:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">word_wrap</span><span class="p">(</span><span class="n">surf</span><span class="p">,</span> <span class="n">text</span><span class="p">,</span> <span class="n">font</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)):</span>
+    <span class="n">font</span><span class="o">.</span><span class="n">origin</span> <span class="o">=</span> <span class="bp">True</span>
+    <span class="n">words</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39; &#39;</span><span class="p">)</span>
+    <span class="n">width</span><span class="p">,</span> <span class="n">height</span> <span class="o">=</span> <span class="n">surf</span><span class="o">.</span><span class="n">get_size</span><span class="p">()</span>
+    <span class="n">line_spacing</span> <span class="o">=</span> <span class="n">font</span><span class="o">.</span><span class="n">get_sized_height</span><span class="p">()</span> <span class="o">+</span> <span class="mi">2</span>
+    <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">line_spacing</span>
+    <span class="n">space</span> <span class="o">=</span> <span class="n">font</span><span class="o">.</span><span class="n">get_rect</span><span class="p">(</span><span class="s">&#39; &#39;</span> <span class="o">*</span> <span class="mi">2</span><span class="p">)</span>  <span class="c"># second space given width 0</span>
+    <span class="k">for</span> <span class="n">word</span> <span class="ow">in</span> <span class="n">words</span><span class="p">:</span>
+        <span class="n">bounds</span> <span class="o">=</span> <span class="n">font</span><span class="o">.</span><span class="n">get_rect</span><span class="p">(</span><span class="n">word</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">x</span> <span class="o">+</span> <span class="n">bounds</span><span class="o">.</span><span class="n">width</span> <span class="o">+</span> <span class="n">bounds</span><span class="o">.</span><span class="n">x</span> <span class="o">&gt;=</span> <span class="n">width</span><span class="p">:</span>
+            <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">y</span> <span class="o">+</span> <span class="n">line_spacing</span>
+        <span class="k">if</span> <span class="n">x</span> <span class="o">+</span> <span class="n">bounds</span><span class="o">.</span><span class="n">width</span> <span class="o">+</span> <span class="n">bounds</span><span class="o">.</span><span class="n">x</span> <span class="o">&gt;=</span> <span class="n">width</span><span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;word too wide for the surface&quot;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">y</span> <span class="o">+</span> <span class="n">bounds</span><span class="o">.</span><span class="n">height</span> <span class="o">-</span> <span class="n">bounds</span><span class="o">.</span><span class="n">y</span> <span class="o">&gt;=</span> <span class="n">height</span><span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;text to long for the surface&quot;</span><span class="p">)</span>
+        <span class="n">font</span><span class="o">.</span><span class="n">render_to</span><span class="p">(</span><span class="n">surf</span><span class="p">,</span> <span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">),</span> <span class="bp">None</span><span class="p">,</span> <span class="n">color</span><span class="p">)</span>
+        <span class="n">x</span> <span class="o">+=</span> <span class="n">bounds</span><span class="o">.</span><span class="n">width</span> <span class="o">+</span> <span class="n">space</span><span class="o">.</span><span class="n">width</span>
+    <span class="k">return</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span>
+</pre></div>
+</div>
+<p>When <a class="reference internal" href="#pygame.freetype.Font.render_to" title="pygame.freetype.Font.render_to"><tt class="xref py py-meth docutils literal"><span class="pre">render_to()</span></tt></a> is called with the same
+font properties ― <a class="reference internal" href="#pygame.freetype.Font.size" title="pygame.freetype.Font.size"><tt class="xref py py-attr docutils literal"><span class="pre">size</span></tt></a>, <a class="reference internal" href="#pygame.freetype.Font.style" title="pygame.freetype.Font.style"><tt class="xref py py-attr docutils literal"><span class="pre">style</span></tt></a>, <a class="reference internal" href="#pygame.freetype.Font.strength" title="pygame.freetype.Font.strength"><tt class="xref py py-attr docutils literal"><span class="pre">strength</span></tt></a>,
+<a class="reference internal" href="#pygame.freetype.Font.wide" title="pygame.freetype.Font.wide"><tt class="xref py py-attr docutils literal"><span class="pre">wide</span></tt></a>, <tt class="xref py py-attr docutils literal"><span class="pre">antialiase</span></tt>, <a class="reference internal" href="#pygame.freetype.Font.vertical" title="pygame.freetype.Font.vertical"><tt class="xref py py-attr docutils literal"><span class="pre">vertical</span></tt></a>, <a class="reference internal" href="#pygame.freetype.Font.rotation" title="pygame.freetype.Font.rotation"><tt class="xref py py-attr docutils literal"><span class="pre">rotation</span></tt></a>,
+<a class="reference internal" href="#pygame.freetype.Font.kerning" title="pygame.freetype.Font.kerning"><tt class="xref py py-attr docutils literal"><span class="pre">kerning</span></tt></a>, and <a class="reference internal" href="#pygame.freetype.Font.use_bitmap_strikes" title="pygame.freetype.Font.use_bitmap_strikes"><tt class="xref py py-attr docutils literal"><span class="pre">use_bitmap_strikes</span></tt></a> ― as <a class="reference internal" href="#pygame.freetype.Font.get_rect" title="pygame.freetype.Font.get_rect"><tt class="xref py py-meth docutils literal"><span class="pre">get_rect()</span></tt></a>,
+<a class="reference internal" href="#pygame.freetype.Font.render_to" title="pygame.freetype.Font.render_to"><tt class="xref py py-meth docutils literal"><span class="pre">render_to()</span></tt></a> will use the layout calculated by <a class="reference internal" href="#pygame.freetype.Font.get_rect" title="pygame.freetype.Font.get_rect"><tt class="xref py py-meth docutils literal"><span class="pre">get_rect()</span></tt></a>.
+Otherwise, <a class="reference internal" href="#pygame.freetype.Font.render_to" title="pygame.freetype.Font.render_to"><tt class="xref py py-meth docutils literal"><span class="pre">render_to()</span></tt></a> will recalculate the layout if called
+with a text string or one of the above properties has changed
+after the <a class="reference internal" href="#pygame.freetype.Font.get_rect" title="pygame.freetype.Font.get_rect"><tt class="xref py py-meth docutils literal"><span class="pre">get_rect()</span></tt></a> call.</p>
 <p>By default, the point size and style set for the font are used
 if not passed as arguments. The text is unrotated unless a non-zero
 rotation value is given.</p>
 <div class="line"><span class="summaryline">Return rendered text as a string of bytes</span></div>
 <div class="line"><span class="signature">render_raw(text, style=STYLE_DEFAULT, rotation=0, size=0, invert=False) -&gt; (bytes, (int, int))</span></div>
 </div>
-<p>Like <tt class="docutils literal"><span class="pre">Font.render()</span></tt> but the tuple returned is an 8 bit
+<p>Like <a class="reference internal" href="#pygame.freetype.Font.render" title="pygame.freetype.Font.render"><tt class="xref py py-meth docutils literal"><span class="pre">render()</span></tt></a> but the tuple returned is an 8 bit
 monochrome string of bytes and its size. The foreground color is 255, the
 background 0, useful as an alpha mask for a foreground pattern.</p>
 </dd></dl>
 </div>
 <p>Render to an array object exposing an array struct interface. The array
 must be two dimensional with integer items. The default dest value, None,
-is equivalent to (0, 0).</p>
+is equivalent to (0, 0). See <a class="reference internal" href="#pygame.freetype.Font.render_to" title="pygame.freetype.Font.render_to"><tt class="xref py py-meth docutils literal"><span class="pre">render_to()</span></tt></a>.</p>
 </dd></dl>
 
 <dl class="definition attribute">
 </dd></dl>
 
 <dl class="definition attribute">
+<dt class="title" id="pygame.freetype.Font.fgcolor">
+<tt class="descname">fgcolor</tt><a class="headerlink" href="#pygame.freetype.Font.fgcolor" title="Permalink to this definition">¶</a></dt>
+<dd><div class="line-block">
+<div class="line"><span class="summaryline">default foreground color</span></div>
+<div class="line"><span class="signature">fgcolor -&gt; Color</span></div>
+</div>
+<p>Get or set the default glyph rendering color. It is initially opaque
+black ― (0, 0, 0, 255). Applies to <a class="reference internal" href="#pygame.freetype.Font.render" title="pygame.freetype.Font.render"><tt class="xref py py-meth docutils literal"><span class="pre">render()</span></tt></a> and <a class="reference internal" href="#pygame.freetype.Font.render_to" title="pygame.freetype.Font.render_to"><tt class="xref py py-meth docutils literal"><span class="pre">render_to()</span></tt></a>.</p>
+</dd></dl>
+
+<dl class="definition attribute">
 <dt class="title" id="pygame.freetype.Font.origin">
 <tt class="descname">origin</tt><a class="headerlink" href="#pygame.freetype.Font.origin" title="Permalink to this definition">¶</a></dt>
 <dd><div class="line-block">
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.