/usr/share/gtk-doc/html/pygtk/class-pangofontdescription.html is in python-gtk2-doc 2.24.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>pango.FontDescription</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><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="prev" 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" title="pango.FontDescription"><a name="class-pangofontdescription"></a><div class="titlepage"></div><div class="refnamediv"><h2>pango.FontDescription</h2><p>pango.FontDescription — an object representing a description of a font.</p></div><div class="refsect1" title="Synopsis"><a name="id2895294"></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 class="link" href="class-pangofontdescription.html#constructor-pangofontdescription" title="Constructor">pango.FontDescription</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</code></strong></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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 class="link" 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 class="link" 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 class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-family" title="pango.FontDescription.set_family">set_family</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>family</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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"><strong class="parameter"><code>family</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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 class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-style" title="pango.FontDescription.set_style">set_style</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>style</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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 class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-variant" title="pango.FontDescription.set_variant">set_variant</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>variant</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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 class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-weight" title="pango.FontDescription.set_weight">set_weight</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>weight</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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 class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-stretch" title="pango.FontDescription.set_stretch">set_stretch</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>stretch</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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 class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-size" title="pango.FontDescription.set_size">set_size</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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 class="link" 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 class="link" href="class-pangofontdescription.html#method-pangofontdescription--unset-fields" title="pango.FontDescription.unset_fields">unset_fields</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>to_unset</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangofontdescription.html#method-pangofontdescription--merge" title="pango.FontDescription.merge">merge</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>desc_to_merge</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>replace_existing</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangofontdescription.html#method-pangofontdescription--merge-static" title="pango.FontDescription.merge_static">merge_static</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>desc_to_merge</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>replace_existing</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangofontdescription.html#method-pangofontdescription--better-match" title="pango.FontDescription.better_match">better_match</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>old_match</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>new_match</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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 class="link" href="class-pangofontdescription.html#method-pangofontdescription--to-filename" title="pango.FontDescription.to_filename">to_filename</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-absolute-size" title="pango.FontDescription.set_absolute_size">set_absolute_size</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangofontdescription.html#method-pangofontdescription--get-size-is-absolute" title="pango.FontDescription.get_size_is_absolute">get_size_is_absolute</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" title="Description"><a name="id3078801"></a><h2>Description</h2><p>A <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></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" title="Constructor"><a name="constructor-pangofontdescription"></a><h2>Constructor</h2><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">pango.FontDescription</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>
object.</td></tr></tbody></table><p>Creates a new <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>
object from the representation in the string specified by
<em class="parameter"><code>str</code></em>. The format of the string representation
is:</p><pre class="programlisting">
"[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]"
</pre><p>where <code class="literal">FAMILY-LIST</code> is a comma separated list of
families optionally terminated by a comma, <code class="literal">STYLE_OPTIONS</code>
is a whitespace separated list of words where each <code class="literal">WORD</code>
describes one of style, variant, weight, or stretch, and
<code class="literal">SIZE</code> is an decimal number (size in points). For example
the following are all valid string representations:</p><pre class="programlisting">
"sans bold 12"
"serif,monospace bold italic condensed 16"
"normal 10"
</pre><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><p><span class="term">Normal</span></p></td><td>the font is upright.</td></tr><tr><td><p><span class="term">Oblique</span></p></td><td>the font is slanted, but in a roman style.</td></tr><tr><td><p><span class="term">Italic</span></p></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><p><span class="term">Ultra-Light</span></p></td><td>the ultralight weight (= 200)</td></tr><tr><td><p><span class="term">Light</span></p></td><td>the light weight (=300)</td></tr><tr><td><p><span class="term">Normal</span></p></td><td>the default weight (= 400)</td></tr><tr><td><p><span class="term">Bold</span></p></td><td>the bold weight (= 700)</td></tr><tr><td><p><span class="term">Ultra-Bold</span></p></td><td>the ultra-bold weight (= 800)</td></tr><tr><td><p><span class="term">Heavy</span></p></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><p><span class="term">Normal</span></p></td><td></td></tr><tr><td><p><span class="term">Small-Caps</span></p></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><p><span class="term">Ultra-Condensed</span></p></td><td>the smallest width</td></tr><tr><td><p><span class="term">Extra-Condensed</span></p></td><td></td></tr><tr><td><p><span class="term">Condensed</span></p></td><td></td></tr><tr><td><p><span class="term">Semi-Condensed</span></p></td><td></td></tr><tr><td><p><span class="term">Normal</span></p></td><td>the normal width</td></tr><tr><td><p><span class="term">Semi-Expanded</span></p></td><td></td></tr><tr><td><p><span class="term">Expanded</span></p></td><td></td></tr><tr><td><p><span class="term">Extra-Expanded</span></p></td><td></td></tr><tr><td><p><span class="term">Ultra-Expanded</span></p></td><td>the widest width</td></tr></tbody></table><p></p></div><div class="refsect1" title="Methods"><a name="id3237962"></a><h2>Methods</h2><div class="refsect2" title="pango.FontDescription.copy"><a name="method-pangofontdescription--copy"></a><h3>pango.FontDescription.copy</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">copy</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a></td></tr></tbody></table><p>The <code class="methodname">copy</code>() method returns a new copy of
this font description.</p></div><div class="refsect2" title="pango.FontDescription.copy_static"><a name="method-pangofontdescription--copy-static"></a><h3>pango.FontDescription.copy_static</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">copy_static</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>..</td></tr></tbody></table><p>The <code class="methodname">copy_static</code>() method is like the
<a class="link" href="class-pangofontdescription.html#method-pangofontdescription--copy" title="pango.FontDescription.copy"><code class="methodname">copy</code>()</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" title="pango.FontDescription.hash"><a name="method-pangofontdescription--hash"></a><h3>pango.FontDescription.hash</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">hash</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the hash value.</td></tr></tbody></table><p>The <code class="methodname">hash</code>() method computes and returns
a hash of the <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>.</p></div><div class="refsect2" title="pango.FontDescription.set_family"><a name="method-pangofontdescription--set-family"></a><h3>pango.FontDescription.set_family</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_family</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>family</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>family</code></strong> :</span></p></td><td>a string representing the family
name.</td></tr></tbody></table><p>The <code class="methodname">set_family</code>() method sets the family
name attribute field of the font description to the value specified by
<em class="parameter"><code>family</code></em>. The family name represents a family of
related font styles, and will resolve to a particular <a class="link" href="class-pangofontfamily.html" title="pango.FontFamily"><code class="classname">pango.FontFamily</code></a>.
In some uses of <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>,
it is also possible to use a comma separated list of family names for this
field.</p></div><div class="refsect2" title="pango.FontDescription.set_family_static"><a name="method-pangofontdescription--set-family-static"></a><h3>pango.FontDescription.set_family_static</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_family_static</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>family</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>family</code></strong> :</span></p></td><td>a string representing the family
name.</td></tr></tbody></table><p>The set_family_static() method is like the <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-family" title="pango.FontDescription.set_family"><code class="methodname">set_family</code>()</a>,
except that no copy of <em class="parameter"><code>family</code></em> 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 <em class="parameter"><code>family</code></em> is only needed
temporarily.</p></div><div class="refsect2" title="pango.FontDescription.get_family"><a name="method-pangofontdescription--get-family"></a><h3>pango.FontDescription.get_family</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_family</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the family name or <code class="literal">None</code> if
not previously set.</td></tr></tbody></table><p>The <code class="methodname">get_family</code>() method returns the
family name attribute field of the font description. See the <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-family" title="pango.FontDescription.set_family"><code class="methodname">set_family</code>()</a>
method for more information.</p></div><div class="refsect2" title="pango.FontDescription.set_style"><a name="method-pangofontdescription--set-style"></a><h3>pango.FontDescription.set_style</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_style</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>style</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>style</code></strong> :</span></p></td><td>the style for the font
description</td></tr></tbody></table><p>The <code class="methodname">set_style</code>() method sets the slant
style attribute field of the <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>
to the value specified by <em class="parameter"><code>style</code></em>. The value of
<em class="parameter"><code>style</code></em> must be either
<code class="literal">pango.STYLE_NORMAL</code>,
<code class="literal">pango.STYLE_ITALIC</code>, or
<code class="literal">pango.STYLE_OBLIQUE</code>. 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" title="pango.FontDescription.get_style"><a name="method-pangofontdescription--get-style"></a><h3>pango.FontDescription.get_style</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_style</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the slant style for the font description.
</td></tr></tbody></table><p>The <code class="methodname">get_style</code>() method returns the
slant style attribute field of the <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>.
See the <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-style" title="pango.FontDescription.set_style"><code class="methodname">set_style</code>()</a>
method for more details. Use the <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--get-set-fields" title="pango.FontDescription.get_set_fields"><code class="methodname">get_set_fields</code>()</a>
method to find out if the field was explicitly set.</p></div><div class="refsect2" title="pango.FontDescription.set_variant"><a name="method-pangofontdescription--set-variant"></a><h3>pango.FontDescription.set_variant</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_variant</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>variant</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>variant</code></strong> :</span></p></td><td>the variant type for the font
description.</td></tr></tbody></table><p>The <code class="methodname">set_variant</code>() method sets the
variant attribute field of a font description to the value specified by
<em class="parameter"><code>variant</code></em>. The value of <em class="parameter"><code>variant</code></em>
must be either <code class="literal">pango.VARIANT_NORMAL</code> or
<code class="literal">pango.VARIANT_SMALL_CAPS</code>.</p></div><div class="refsect2" title="pango.FontDescription.get_variant"><a name="method-pangofontdescription--get-variant"></a><h3>pango.FontDescription.get_variant</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_variant</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the variant style of the font
description.</td></tr></tbody></table><p>The <code class="methodname">get_variant</code>() method returns the
variant style of a <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>.
See the <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-variant" title="pango.FontDescription.set_variant"><code class="methodname">set_variant</code>()</a>
method for more information. Use the <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--get-set-fields" title="pango.FontDescription.get_set_fields"><code class="methodname">get_set_fields</code>()</a>
method to find out if the field was explicitly set.</p></div><div class="refsect2" title="pango.FontDescription.set_weight"><a name="method-pangofontdescription--set-weight"></a><h3>pango.FontDescription.set_weight</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_weight</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>weight</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>weight</code></strong> :</span></p></td><td>the weight for the font
description.</td></tr></tbody></table><p>The <code class="methodname">set_weight</code>() method sets the weight
attribute field of a font description to the value specified by
<em class="parameter"><code>weight</code></em>. The value of <em class="parameter"><code>weight</code></em>
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><p><span class="term"><code class="literal">pango.WEIGHT_ULTRALIGHT</code></span></p></td><td>the ultralight weight (= 200)</td></tr><tr><td><p><span class="term"><code class="literal">pango.WEIGHT_LIGHT</code></span></p></td><td>the light weight (=300)</td></tr><tr><td><p><span class="term"><code class="literal">pango.WEIGHT_NORMAL</code></span></p></td><td>the default weight (= 400)</td></tr><tr><td><p><span class="term"><code class="literal">pango.WEIGHT_BOLD</code></span></p></td><td>the bold weight (= 700)</td></tr><tr><td><p><span class="term"><code class="literal">pango.WEIGHT_ULTRABOLD</code></span></p></td><td>the ultrabold weight (= 800)</td></tr><tr><td><p><span class="term"><code class="literal">pango.WEIGHT_HEAVY</code></span></p></td><td>the heavy weight (= 900)</td></tr></tbody></table><p></p></div><div class="refsect2" title="pango.FontDescription.get_weight"><a name="method-pangofontdescription--get-weight"></a><h3>pango.FontDescription.get_weight</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_weight</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the weight field for the font
description.</td></tr></tbody></table><p>The <code class="methodname">get_weight</code>() method returns the
value of the weight attribute of a font description. See the <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-weight" title="pango.FontDescription.set_weight"><code class="methodname">set_weight</code>()</a>
method for more information. Use the <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--get-set-fields" title="pango.FontDescription.get_set_fields"><code class="methodname">get_set_fields</code>()</a>
method to determine if the attribute was explicitly set.</p></div><div class="refsect2" title="pango.FontDescription.set_stretch"><a name="method-pangofontdescription--set-stretch"></a><h3>pango.FontDescription.set_stretch</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_stretch</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>stretch</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>stretch</code></strong> :</span></p></td><td>the stretch for the font
description</td></tr></tbody></table><p>The <code class="methodname">set_stretch</code>() method sets the
stretch attribute field of a font description to the value specified by
<em class="parameter"><code>stretch</code></em>. The value of <em class="parameter"><code>stretch</code></em>
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><p><span class="term"><code class="literal">pango.STRETCH_ULTRA_CONDENSED</code></span></p></td><td>the narrowest width</td></tr><tr><td><p><span class="term"><code class="literal">pango.STRETCH_EXTRA_CONDENSED</code></span></p></td><td></td></tr><tr><td><p><span class="term"><code class="literal">pango.STRETCH_CONDENSED</code></span></p></td><td></td></tr><tr><td><p><span class="term"><code class="literal">pango.STRETCH_SEMI_CONDENSED</code></span></p></td><td></td></tr><tr><td><p><span class="term"><code class="literal">pango.STRETCH_NORMAL</code></span></p></td><td>the normal (base) width</td></tr><tr><td><p><span class="term"><code class="literal">pango.STRETCH_SEMI_EXPANDED</code></span></p></td><td></td></tr><tr><td><p><span class="term"><code class="literal">pango.STRETCH_EXPANDED</code></span></p></td><td></td></tr><tr><td><p><span class="term"><code class="literal">pango.STRETCH_EXTRA_EXPANDED</code></span></p></td><td></td></tr><tr><td><p><span class="term"><code class="literal">pango.STRETCH_ULTRA_EXPANDED</code></span></p></td><td>the widest width</td></tr></tbody></table><p></p></div><div class="refsect2" title="pango.FontDescription.get_stretch"><a name="method-pangofontdescription--get-stretch"></a><h3>pango.FontDescription.get_stretch</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_stretch</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the stretch field for the font
description</td></tr></tbody></table><p>The <code class="methodname">get_stretch</code>() method returns the
stretch attribute field of a font description. See the <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-stretch" title="pango.FontDescription.set_stretch"><code class="methodname">set_stretch</code>()</a>
method for more details. Use the <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--get-set-fields" title="pango.FontDescription.get_set_fields"><code class="methodname">get_set_fields</code>()</a>
method to determine if the field was explicitly set.</p></div><div class="refsect2" title="pango.FontDescription.set_size"><a name="method-pangofontdescription--set-size"></a><h3>pango.FontDescription.set_size</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_size</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>size</code></strong> :</span></p></td><td>the size for the font description in pango
units.</td></tr></tbody></table><p>The <code class="methodname">set_size</code>() method sets the
size attribute field of a font description to the value specified by
<em class="parameter"><code>size</code></em>. The value of <em class="parameter"><code>size</code></em> is
specified in pango units. There are <code class="literal">pango.SCALE</code> (1024)
pango units in one device unit (the device unit is a point for font
sizes).</p></div><div class="refsect2" title="pango.FontDescription.get_size"><a name="method-pangofontdescription--get-size"></a><h3>pango.FontDescription.get_size</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_size</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the size for the font description in pango
units.</td></tr></tbody></table><p>The <code class="methodname">get_size</code>() method returns the value
of the size attribute field of a font description. See the <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--get-size" title="pango.FontDescription.get_size"><code class="methodname">get_size</code>()</a>
method for more information. There are <code class="literal">pango.SCALE</code> pango
units in one device unit (point). If the stretch attribute field has not
previously been set, 0 is returned. Use the <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--get-set-fields" title="pango.FontDescription.get_set_fields"><code class="methodname">get_set_fields</code>()</a>
method to determine if the field was explicitly set.</p></div><div class="refsect2" title="pango.FontDescription.get_set_fields"><a name="method-pangofontdescription--get-set-fields"></a><h3>pango.FontDescription.get_set_fields</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_set_fields</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a bitmask with bits set corresponding to the
font description attribute fields that have been set.</td></tr></tbody></table><p>The <code class="methodname">get_set_fields</code>() 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><p><span class="term"><code class="literal">pango.FONT_MASK_FAMILY</code></span></p></td><td>the font family has been set.</td></tr><tr><td><p><span class="term"><code class="literal">pango.FONT_MASK_STYLE</code></span></p></td><td>the font slant style has been set.</td></tr><tr><td><p><span class="term"><code class="literal">pango.FONT_MASK_VARIANT</code></span></p></td><td>the font variant has been set.</td></tr><tr><td><p><span class="term"><code class="literal">pango.FONT_MASK_WEIGHT</code></span></p></td><td>the font weight has been set.</td></tr><tr><td><p><span class="term"><code class="literal">pango.FONT_MASK_STRETCH</code></span></p></td><td>the font stretch has been set.</td></tr><tr><td><p><span class="term"><code class="literal">pango.FONT_MASK_SIZE</code></span></p></td><td>the font size has been set.</td></tr></tbody></table><p></p></div><div class="refsect2" title="pango.FontDescription.unset_fields"><a name="method-pangofontdescription--unset-fields"></a><h3>pango.FontDescription.unset_fields</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">unset_fields</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>to_unset</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>to_unset</code></strong> :</span></p></td><td>a bitmask of attribute fields in the font
description to unset.</td></tr></tbody></table><p>The <code class="methodname">unset_fields</code>() method unsets the
attribute fields (specified by <em class="parameter"><code>to_unset</code></em>) in the
<a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>.
Note that this merely marks the attribute fields cleared, it does not clear
the settings.</p></div><div class="refsect2" title="pango.FontDescription.merge"><a name="method-pangofontdescription--merge"></a><h3>pango.FontDescription.merge</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">merge</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>desc_to_merge</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>replace_existing</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>desc_to_merge</code></strong> :</span></p></td><td>the <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>
to merge into the font description</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>replace_existing</code></strong> :</span></p></td><td>if <code class="literal">True</code>, replace attribute
fields in the font description with the corresponding values from
<em class="parameter"><code>desc_to_merge</code></em>, even if they are already
exist.</td></tr></tbody></table><p>The <code class="methodname">merge</code>() method merges the attribute
fields that are set in the <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>
specified by <em class="parameter"><code>desc_to_merge</code></em> into the attribute fields
in the font description. If <em class="parameter"><code>replace_existing</code></em> is
<code class="literal">False</code>, only fields in the font description that are not
already set are affected. If <em class="parameter"><code>replace_existing</code></em> is
<code class="literal">True</code>, attribute fields that are already set will also be
replaced.</p></div><div class="refsect2" title="pango.FontDescription.merge_static"><a name="method-pangofontdescription--merge-static"></a><h3>pango.FontDescription.merge_static</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">merge_static</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>desc_to_merge</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>replace_existing</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>desc_to_merge</code></strong> :</span></p></td><td>the <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>
to merge from</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>replace_existing</code></strong> :</span></p></td><td>if <code class="literal">True</code>, replace attribute
fields in the font description with the corresponding values from
<em class="parameter"><code>desc_to_merge</code></em>, even if they are already
exist.</td></tr></tbody></table><p>The <code class="methodname">merge_static</code>() method is similar to
the <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--merge" title="pango.FontDescription.merge"><code class="methodname">merge</code>()</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
<em class="parameter"><code>desc_to_merge</code></em> is modified or freed. This is meant to
be used when the merged font description is only needed temporarily.</p></div><div class="refsect2" title="pango.FontDescription.better_match"><a name="method-pangofontdescription--better-match"></a><h3>pango.FontDescription.better_match</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">better_match</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>old_match</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>new_match</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>old_match</code></strong> :</span></p></td><td>a <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>,
or <code class="literal">None</code></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>new_match</code></strong> :</span></p></td><td>a <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if
<em class="parameter"><code>new_match</code></em> is a better match</td></tr></tbody></table><p>The <code class="methodname">better_match</code>() method determines if
the attributes of the <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>
specified by <em class="parameter"><code>new_match</code></em> are a closer match for the
font description than the <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>
specified by <em class="parameter"><code>old_match</code></em>. If
<em class="parameter"><code>old_match</code></em> is <code class="literal">None</code>, determines if
<em class="parameter"><code>new_match</code></em> 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" title="pango.FontDescription.to_string"><a name="method-pangofontdescription--to-string"></a><h3>pango.FontDescription.to_string</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">to_string</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a string representation of the font
description.</td></tr></tbody></table><p>The <code class="methodname">to_string</code>() method returns a string
representation of the font description. See the <a class="link" 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" title="pango.FontDescription.to_filename"><a name="method-pangofontdescription--to-filename"></a><h3>pango.FontDescription.to_filename</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">to_filename</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a string representation of the font description
as a filename.</td></tr></tbody></table><p>The <code class="methodname">to_filename</code>() method returns a
filename representation of a font description. The filename is identical to
the result from calling the <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--to-string" title="pango.FontDescription.to_string"><code class="methodname">to_string</code>()</a>
method, but underscores replace characters that are not typically used in
filenames, and it is in lower case only.</p></div><div class="refsect2" title="pango.FontDescription.set_absolute_size"><a name="method-pangofontdescription--set-absolute-size"></a><h3>pango.FontDescription.set_absolute_size</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_absolute_size</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>size</code></strong> :</span></p></td><td>the new size, in Pango units. There are
<code class="literal">pango.SCALE</code> Pango units in one device unit. For
an output backend where a device unit is a pixel, a
<em class="parameter"><code>size</code></em> value of 10 * pango.SCALE gives a 10
pixel font.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.10 and above.</p></div><p>Sets the size field of a font description, in device units. This
is mutually exclusive with <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-size" title="pango.FontDescription.set_size"><code class="methodname">pango.FontDescription.set_size()</code></a>.</p></div><div class="refsect2" title="pango.FontDescription.get_size_is_absolute"><a name="method-pangofontdescription--get-size-is-absolute"></a><h3>pango.FontDescription.get_size_is_absolute</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_size_is_absolute</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>whether the size for the font description is in
points or device units. Use <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--get-set-fields" title="pango.FontDescription.get_set_fields"><code class="methodname">pango.FontDescription.get_set_fields()</code></a>
to find out if the size field of the font description was
explicitly set or not.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.10 and above.</p></div><p>Determines whether the size of the font is in points or device
units. See <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-size" title="pango.FontDescription.set_size"><code class="methodname">pango.FontDescription.set_size()</code></a>
and <a class="link" href="class-pangofontdescription.html#method-pangofontdescription--set-absolute-size" title="pango.FontDescription.set_absolute_size"><code class="methodname">pango.FontDescription.set_absolute_size()</code></a>.</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>
|