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
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>pango.FontDescription</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="pango-class-reference.html" title="The pango Class Reference"><link rel="previous" href="class-pangofont.html" title="pango.Font"><link rel="next" href="class-pangofontface.html" title="pango.FontFace"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">pango.FontDescription</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-pangofont.html">Prev</a></td><th width="60%" align="center">The pango Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-pangofontface.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-pangofontdescription"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>pango.FontDescription</h2><p>pango.FontDescription — an object representing a description of a font.</p></div><div class="refsect1" lang="en"><a name="id3165544"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">pango.FontDescription</span></span>(<span class="ooclass"><span class="classname">gobject.GBoxed</span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a href="class-pangofontdescription.html#constructor-pangofontdescription" title="Constructor">pango.FontDescription</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>str</tt></b></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--copy" title="pango.FontDescription.copy">copy</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--copy-static" title="pango.FontDescription.copy_static">copy_static</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--hash" title="pango.FontDescription.hash">hash</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--set-family" title="pango.FontDescription.set_family">set_family</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>family</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--set-family-static" title="pango.FontDescription.set_family_static">set_family_static</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>family</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--get-family" title="pango.FontDescription.get_family">get_family</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--set-style" title="pango.FontDescription.set_style">set_style</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>style</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--get-style" title="pango.FontDescription.get_style">get_style</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--set-variant" title="pango.FontDescription.set_variant">set_variant</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>variant</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--get-variant" title="pango.FontDescription.get_variant">get_variant</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--set-weight" title="pango.FontDescription.set_weight">set_weight</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>weight</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--get-weight" title="pango.FontDescription.get_weight">get_weight</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--set-stretch" title="pango.FontDescription.set_stretch">set_stretch</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>stretch</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--get-stretch" title="pango.FontDescription.get_stretch">get_stretch</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--set-size" title="pango.FontDescription.set_size">set_size</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--get-size" title="pango.FontDescription.get_size">get_size</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--get-set-fields" title="pango.FontDescription.get_set_fields">get_set_fields</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--unset-fields" title="pango.FontDescription.unset_fields">unset_fields</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>to_unset</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--merge" title="pango.FontDescription.merge">merge</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>desc_to_merge</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>replace_existing</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--merge-static" title="pango.FontDescription.merge_static">merge_static</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>desc_to_merge</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>replace_existing</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--better-match" title="pango.FontDescription.better_match">better_match</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>old_match</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>new_match</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--to-string" title="pango.FontDescription.to_string">to_string</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangofontdescription.html#method-pangofontdescription--to-filename" title="pango.FontDescription.to_filename">to_filename</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3301826"></a><h2>Description</h2><p>A <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>
represents the description of an ideal font. They are used to both specify
the characteristics of a font to load and to list the available fonts on the
system.</p></div><div class="refsect1" lang="en"><a name="constructor-pangofontdescription"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">pango.FontDescription</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>
object.</td></tr></tbody></table><p>Creates a new <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>
object from the representation in the string specified by
<i class="parameter"><tt>str</tt></i>. The format of the string representation
is:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
"[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]"
</pre></td></tr></table><p>where <tt class="literal">FAMILY-LIST</tt> is a comma separated list of
families optionally terminated by a comma, <tt class="literal">STYLE_OPTIONS</tt>
is a whitespace separated list of words where each <tt class="literal">WORD</tt>
describes one of style, variant, weight, or stretch, and
<tt class="literal">SIZE</tt> is an decimal number (size in points). For example
the following are all valid string representations:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
"sans bold 12"
"serif,monospace bold italic condensed 16"
"normal 10"
</pre></td></tr></table><p>The commonly available font families are: Normal, Sans, Serif and
Monospace. The available styles are:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term">Normal</span></td><td>the font is upright.</td></tr><tr><td><span class="term">Oblique</span></td><td>the font is slanted, but in a roman style.</td></tr><tr><td><span class="term">Italic</span></td><td>the font is slanted in an italic style. </td></tr></tbody></table><p>The available weights are:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term">Ultra-Light</span></td><td>the ultralight weight (= 200)</td></tr><tr><td><span class="term">Light</span></td><td>the light weight (=300)</td></tr><tr><td><span class="term">Normal</span></td><td>the default weight (= 400)</td></tr><tr><td><span class="term">Bold</span></td><td>the bold weight (= 700)</td></tr><tr><td><span class="term">Ultra-Bold</span></td><td>the ultra-bold weight (= 800)</td></tr><tr><td><span class="term">Heavy</span></td><td>the heavy weight (= 900)</td></tr></tbody></table><p>The available variants are:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term">Normal</span></td><td></td></tr><tr><td><span class="term">Small-Caps</span></td><td></td></tr></tbody></table><p>The available stretch styles are:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term">Ultra-Condensed</span></td><td>the smallest width</td></tr><tr><td><span class="term">Extra-Condensed</span></td><td></td></tr><tr><td><span class="term">Condensed</span></td><td></td></tr><tr><td><span class="term">Semi-Condensed</span></td><td></td></tr><tr><td><span class="term">Normal</span></td><td>the normal width</td></tr><tr><td><span class="term">Semi-Expanded</span></td><td></td></tr><tr><td><span class="term">Expanded</span></td><td></td></tr><tr><td><span class="term">Extra-Expanded</span></td><td></td></tr><tr><td><span class="term">Ultra-Expanded</span></td><td>the widest width</td></tr></tbody></table><p></p></div><div class="refsect1" lang="en"><a name="id3135996"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-pangofontdescription--copy"></a><h3>pango.FontDescription.copy</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">copy</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a></td></tr></tbody></table><p>The <tt class="methodname">copy</tt>() method returns a new copy of
this font description.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--copy-static"></a><h3>pango.FontDescription.copy_static</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">copy_static</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>..</td></tr></tbody></table><p>The <tt class="methodname">copy_static</tt>() method is like the
<a href="class-pangofontdescription.html#method-pangofontdescription--copy" title="pango.FontDescription.copy"><tt class="methodname">copy</tt>()</a>
method, but only a shallow copy is made of the family name and other
allocated attribute fields. The result can only be used until the original
font description is modified or freed. This is meant to be used when the
copy is only needed temporarily.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--hash"></a><h3>pango.FontDescription.hash</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">hash</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the hash value.</td></tr></tbody></table><p>The <tt class="methodname">hash</tt>() method computes and returns
a hash of the <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--set-family"></a><h3>pango.FontDescription.set_family</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_family</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>family</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>family</tt></b>:</span></td><td>a string representing the family
name.</td></tr></tbody></table><p>The <tt class="methodname">set_family</tt>() method sets the family
name attribute field of the font description to the value specified by
<i class="parameter"><tt>family</tt></i>. The family name represents a family of
related font styles, and will resolve to a particular <a href="class-pangofontfamily.html" title="pango.FontFamily"><tt class="classname">pango.FontFamily</tt></a>.
In some uses of <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>,
it is also possible to use a comma separated list of family names for this
field.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--set-family-static"></a><h3>pango.FontDescription.set_family_static</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_family_static</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>family</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>family</tt></b>:</span></td><td>a string representing the family
name.</td></tr></tbody></table><p>The set_family_static() method is like the <a href="class-pangofontdescription.html#method-pangofontdescription--set-family" title="pango.FontDescription.set_family"><tt class="methodname">set_family</tt>()</a>,
except that no copy of <i class="parameter"><tt>family</tt></i> is made. The caller
must make sure that the string passed in stays around until the font
description is no longer needed or the family name is set again. This method
can be used if <i class="parameter"><tt>family</tt></i> is only needed
temporarily.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--get-family"></a><h3>pango.FontDescription.get_family</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_family</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the family name or <tt class="literal">None</tt> if
not previously set.</td></tr></tbody></table><p>The <tt class="methodname">get_family</tt>() method returns the
family name attribute field of the font description. See the <a href="class-pangofontdescription.html#method-pangofontdescription--set-family" title="pango.FontDescription.set_family"><tt class="methodname">set_family</tt>()</a>
method for more information.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--set-style"></a><h3>pango.FontDescription.set_style</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_style</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>style</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>style</tt></b>:</span></td><td>the style for the font
description</td></tr></tbody></table><p>The <tt class="methodname">set_style</tt>() method sets the slant
style attribute field of the <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>
to the value specified by <i class="parameter"><tt>style</tt></i>. The value of
<i class="parameter"><tt>style</tt></i> must be either
<tt class="literal">pango.STYLE_NORMAL</tt>,
<tt class="literal">pango.STYLE_ITALIC</tt>, or
<tt class="literal">pango.STYLE_OBLIQUE</tt>. Most fonts will either have a italic
style or an oblique style, but not both, and font matching in Pango will
match italic specifications with oblique fonts and vice-versa if an exact
match is not found.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--get-style"></a><h3>pango.FontDescription.get_style</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_style</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the slant style for the font description.
</td></tr></tbody></table><p>The <tt class="methodname">get_style</tt>() method returns the
slant style attribute field of the <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>.
See the <a href="class-pangofontdescription.html#method-pangofontdescription--set-style" title="pango.FontDescription.set_style"><tt class="methodname">set_style</tt>()</a>
method for more details. Use the <a href="class-pangofontdescription.html#method-pangofontdescription--get-set-fields" title="pango.FontDescription.get_set_fields"><tt class="methodname">get_set_fields</tt>()</a>
method to find out if the field was explicitly set.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--set-variant"></a><h3>pango.FontDescription.set_variant</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_variant</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>variant</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>variant</tt></b>:</span></td><td>the variant type for the font
description.</td></tr></tbody></table><p>The <tt class="methodname">set_variant</tt>() method sets the
variant attribute field of a font description to the value specified by
<i class="parameter"><tt>variant</tt></i>. The value of <i class="parameter"><tt>variant</tt></i>
must be either <tt class="literal">pango.VARIANT_NORMAL</tt> or
<tt class="literal">pango.VARIANT_SMALL_CAPS</tt>.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--get-variant"></a><h3>pango.FontDescription.get_variant</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_variant</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the variant style of the font
description.</td></tr></tbody></table><p>The <tt class="methodname">get_variant</tt>() method returns the
variant style of a <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>.
See the <a href="class-pangofontdescription.html#method-pangofontdescription--set-variant" title="pango.FontDescription.set_variant"><tt class="methodname">set_variant</tt>()</a>
method for more information. Use the <a href="class-pangofontdescription.html#method-pangofontdescription--get-set-fields" title="pango.FontDescription.get_set_fields"><tt class="methodname">get_set_fields</tt>()</a>
method to find out if the field was explicitly set.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--set-weight"></a><h3>pango.FontDescription.set_weight</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_weight</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>weight</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>weight</tt></b>:</span></td><td>the weight for the font
description.</td></tr></tbody></table><p>The <tt class="methodname">set_weight</tt>() method sets the weight
attribute field of a font description to the value specified by
<i class="parameter"><tt>weight</tt></i>. The value of <i class="parameter"><tt>weight</tt></i>
specifies how bold or light the font should be in a range from 100 to 900.
The predefined values of weight are:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><tt class="literal">pango.WEIGHT_ULTRALIGHT</tt></span></td><td>the ultralight weight (= 200)</td></tr><tr><td><span class="term"><tt class="literal">pango.WEIGHT_LIGHT</tt></span></td><td>the light weight (=300)</td></tr><tr><td><span class="term"><tt class="literal">pango.WEIGHT_NORMAL</tt></span></td><td>the default weight (= 400)</td></tr><tr><td><span class="term"><tt class="literal">pango.WEIGHT_BOLD</tt></span></td><td>the bold weight (= 700)</td></tr><tr><td><span class="term"><tt class="literal">pango.WEIGHT_ULTRABOLD</tt></span></td><td>the ultrabold weight (= 800)</td></tr><tr><td><span class="term"><tt class="literal">pango.WEIGHT_HEAVY</tt></span></td><td>the heavy weight (= 900)</td></tr></tbody></table><p></p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--get-weight"></a><h3>pango.FontDescription.get_weight</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_weight</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the weight field for the font
description.</td></tr></tbody></table><p>The <tt class="methodname">get_weight</tt>() method returns the
value of the weight attribute of a font description. See the <a href="class-pangofontdescription.html#method-pangofontdescription--set-weight" title="pango.FontDescription.set_weight"><tt class="methodname">set_weight</tt>()</a>
method for more information. Use the <a href="class-pangofontdescription.html#method-pangofontdescription--get-set-fields" title="pango.FontDescription.get_set_fields"><tt class="methodname">get_set_fields</tt>()</a>
method to determine if the attribute was explicitly set.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--set-stretch"></a><h3>pango.FontDescription.set_stretch</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_stretch</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>stretch</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>stretch</tt></b>:</span></td><td>the stretch for the font
description</td></tr></tbody></table><p>The <tt class="methodname">set_stretch</tt>() method sets the
stretch attribute field of a font description to the value specified by
<i class="parameter"><tt>stretch</tt></i>. The value of <i class="parameter"><tt>stretch</tt></i>
specifies how narrow or wide the font should be relative to the base width
of the font family:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><tt class="literal">pango.STRETCH_ULTRA_CONDENSED</tt></span></td><td>the narrowest width</td></tr><tr><td><span class="term"><tt class="literal">pango.STRETCH_EXTRA_CONDENSED</tt></span></td><td></td></tr><tr><td><span class="term"><tt class="literal">pango.STRETCH_CONDENSED</tt></span></td><td></td></tr><tr><td><span class="term"><tt class="literal">pango.STRETCH_SEMI_CONDENSED</tt></span></td><td></td></tr><tr><td><span class="term"><tt class="literal">pango.STRETCH_NORMAL</tt></span></td><td>the normal (base) width</td></tr><tr><td><span class="term"><tt class="literal">pango.STRETCH_SEMI_EXPANDED</tt></span></td><td></td></tr><tr><td><span class="term"><tt class="literal">pango.STRETCH_EXPANDED</tt></span></td><td></td></tr><tr><td><span class="term"><tt class="literal">pango.STRETCH_EXTRA_EXPANDED</tt></span></td><td></td></tr><tr><td><span class="term"><tt class="literal">pango.STRETCH_ULTRA_EXPANDED</tt></span></td><td>the widest width</td></tr></tbody></table><p></p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--get-stretch"></a><h3>pango.FontDescription.get_stretch</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_stretch</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the stretch field for the font
description</td></tr></tbody></table><p>The <tt class="methodname">get_stretch</tt>() method returns the
stretch attribute field of a font description. See the <a href="class-pangofontdescription.html#method-pangofontdescription--set-stretch" title="pango.FontDescription.set_stretch"><tt class="methodname">set_stretch</tt>()</a>
method for more details. Use the <a href="class-pangofontdescription.html#method-pangofontdescription--get-set-fields" title="pango.FontDescription.get_set_fields"><tt class="methodname">get_set_fields</tt>()</a>
method to determine if the field was explicitly set.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--set-size"></a><h3>pango.FontDescription.set_size</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_size</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>size</tt></b>:</span></td><td>the size for the font description in pango
units.</td></tr></tbody></table><p>The <tt class="methodname">set_size</tt>() method sets the
size attribute field of a font description to the value specified by
<i class="parameter"><tt>size</tt></i>. The value of <i class="parameter"><tt>size</tt></i> is
specified in pango units. There are <tt class="literal">pango.SCALE</tt> (1024)
pango units in one device unit (the device unit is a point for font
sizes).</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--get-size"></a><h3>pango.FontDescription.get_size</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_size</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the size for the font description in pango
units.</td></tr></tbody></table><p>The <tt class="methodname">get_size</tt>() method returns the value
of the size attribute field of a font description. See the <a href="class-pangofontdescription.html#method-pangofontdescription--get-size" title="pango.FontDescription.get_size"><tt class="methodname">get_size</tt>()</a>
method for more information. There are <tt class="literal">pango.SCALE</tt> pango
units in one device unit (point). If the stretch attribute field has not
previously been set, 0 is returned. Use the <a href="class-pangofontdescription.html#method-pangofontdescription--get-set-fields" title="pango.FontDescription.get_set_fields"><tt class="methodname">get_set_fields</tt>()</a>
method to determine if the field was explicitly set.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--get-set-fields"></a><h3>pango.FontDescription.get_set_fields</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_set_fields</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a bitmask with bits set corresponding to the
font description attribute fields that have been set.</td></tr></tbody></table><p>The <tt class="methodname">get_set_fields</tt>() method returns a
value that indicates which attribute fields in a font description have been
set. The value returned is a combination of:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><tt class="literal">pango.FONT_MASK_FAMILY</tt></span></td><td>the font family has been set.</td></tr><tr><td><span class="term"><tt class="literal">pango.FONT_MASK_STYLE</tt></span></td><td>the font slant style has been set.</td></tr><tr><td><span class="term"><tt class="literal">pango.FONT_MASK_VARIANT</tt></span></td><td>the font variant has been set.</td></tr><tr><td><span class="term"><tt class="literal">pango.FONT_MASK_WEIGHT</tt></span></td><td>the font weight has been set.</td></tr><tr><td><span class="term"><tt class="literal">pango.FONT_MASK_STRETCH</tt></span></td><td>the font stretch has been set.</td></tr><tr><td><span class="term"><tt class="literal">pango.FONT_MASK_SIZE</tt></span></td><td>the font size has been set.</td></tr></tbody></table><p></p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--unset-fields"></a><h3>pango.FontDescription.unset_fields</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">unset_fields</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>to_unset</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>to_unset</tt></b>:</span></td><td>a bitmask of attribute fields in the font
description to unset.</td></tr></tbody></table><p>The <tt class="methodname">unset_fields</tt>() method unsets the
attribute fields (specified by <i class="parameter"><tt>to_unset</tt></i>) in the
<a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>.
Note that this merely marks the attribute fields cleared, it does not clear
the settings.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--merge"></a><h3>pango.FontDescription.merge</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">merge</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>desc_to_merge</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>replace_existing</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>desc_to_merge</tt></b>:</span></td><td>the <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>
to merge into the font description</td></tr><tr><td><span class="term"><b class="parameter"><tt>replace_existing</tt></b>:</span></td><td>if <tt class="literal">TRUE</tt>, replace attribute
fields in the font description with the corresponding values from
<i class="parameter"><tt>desc_to_merge</tt></i>, even if they are already
exist.</td></tr></tbody></table><p>The <tt class="methodname">merge</tt>() method merges the attribute
fields that are set in the <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>
specified by <i class="parameter"><tt>desc_to_merge</tt></i> into the attribute fields
in the font description. If <i class="parameter"><tt>replace_existing</tt></i> is
<tt class="literal">FALSE</tt>, only fields in the font description that are not
already set are affected. If <i class="parameter"><tt>replace_existing</tt></i> is
<tt class="literal">TRUE</tt>, attribute fields that are already set will also be
replaced.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--merge-static"></a><h3>pango.FontDescription.merge_static</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">merge_static</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>desc_to_merge</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>replace_existing</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>desc_to_merge</tt></b>:</span></td><td>the <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>
to merge from</td></tr><tr><td><span class="term"><b class="parameter"><tt>replace_existing</tt></b>:</span></td><td>if <tt class="literal">TRUE</tt>, replace attribute
fields in the font description with the corresponding values from
<i class="parameter"><tt>desc_to_merge</tt></i>, even if they are already
exist.</td></tr></tbody></table><p>The <tt class="methodname">merge_static</tt>() method is similar to
the <a href="class-pangofontdescription.html#method-pangofontdescription--merge" title="pango.FontDescription.merge"><tt class="methodname">merge</tt>()</a>
method, but only a shallow copy is made of the family name and other
allocated fields. The font description can only be used until
<i class="parameter"><tt>desc_to_merge</tt></i> is modified or freed. This is meant to
be used when the merged font description is only needed temporarily.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--better-match"></a><h3>pango.FontDescription.better_match</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">better_match</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>old_match</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>new_match</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>old_match</tt></b>:</span></td><td>a <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>,
or <tt class="literal">None</tt></td></tr><tr><td><span class="term"><b class="parameter"><tt>new_match</tt></b>:</span></td><td>a <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if
<i class="parameter"><tt>new_match</tt></i> is a better match</td></tr></tbody></table><p>The <tt class="methodname">better_match</tt>() method determines if
the attributes of the <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>
specified by <i class="parameter"><tt>new_match</tt></i> are a closer match for the
font description than the <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>
specified by <i class="parameter"><tt>old_match</tt></i>. If
<i class="parameter"><tt>old_match</tt></i> is <tt class="literal">None</tt>, determines if
<i class="parameter"><tt>new_match</tt></i> is a match at all. The weight and style
attribute need only match approximately but the other attributes must match
exactly.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--to-string"></a><h3>pango.FontDescription.to_string</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">to_string</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a string representation of the font
description.</td></tr></tbody></table><p>The <tt class="methodname">to_string</tt>() method returns a string
representation of the font description. See the <a href="class-pangofontdescription.html#constructor-pangofontdescription" title="Constructor">pango.FontDescription</a>()
constructor for a description of the format of the string representation.
The family list in the string description will only have a terminating comma
if the last word of the list is a valid style option.</p></div><div class="refsect2" lang="en"><a name="method-pangofontdescription--to-filename"></a><h3>pango.FontDescription.to_filename</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">to_filename</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a string representation of the font description
as a filename.</td></tr></tbody></table><p>The <tt class="methodname">to_filename</tt>() method returns a
filename representation of a font description. The filename is identical to
the result from calling the <a href="class-pangofontdescription.html#method-pangofontdescription--to-string" title="pango.FontDescription.to_string"><tt class="methodname">to_string</tt>()</a>
method, but underscores replace characters that are not typically used in
filenames, and it is in lower case only.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-pangofont.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="pango-class-reference.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="class-pangofontface.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">pango.Font</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">pango.FontFace</td></tr></table></div></body></html>
|