summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-pangofont.xml
blob: f1e7bf870cf30a428d8a7e2e1f8c535b43077a6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-pangofont">
  <refnamediv>
    <refname>pango.Font</refname>
    <refpurpose>a rendering-system independent font
representation.</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>pango.Font</classname></ooclass>
      <ooclass><classname><link
linkend="class-gobject">gobject.GObject</link></classname></ooclass>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangofont--describe">describe</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangofont--get-metrics">get_metrics</link></methodname>
	<methodparam><parameter
		       role="keyword">language</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangofont--get-glyph-extents">get_glyph_extents</link></methodname>
	<methodparam><parameter
		       role="keyword">glyph</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
        <methodname><link linkend="method-pangofont--get-font-map">get_font_map</link></methodname>
        <methodparam></methodparam>
      </methodsynopsis>
    </classsynopsis>

<programlisting>
<emphasis role="bold">Functions</emphasis>

<methodsynopsis language="python">
    <methodname><link linkend="function-pango--PIXELS">pango.PIXELS</link></methodname>
    <methodparam><parameter role="keyword">size</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-pango--ASCENT">pango.ASCENT</link></methodname>
    <methodparam><parameter role="keyword">rect</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-pango--DESCENT">pango.DESCENT</link></methodname>
    <methodparam><parameter role="keyword">rect</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-pango--RBEARING">pango.RBEARING</link></methodname>
    <methodparam><parameter role="keyword">rect</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-pango--LBEARING">pango.LBEARING</link></methodname>
    <methodparam><parameter role="keyword">rect</parameter></methodparam>
  </methodsynopsis></programlisting>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-pangofont">pango.Font</link>
</synopsis>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <para>A <link
linkend="class-pangofont"><classname>pango.Font</classname></link> object
represents a font in a rendering-system independent way. A <link
linkend="class-pangofont"><classname>pango.Font</classname></link> is
returned from the <link
linkend="method-pangocontext--load-font"><methodname>pango.Context.load_font</methodname>()</link>, 
<link
linkend="method-pangofontset--get-font"><methodname>pango.FontSet.get_font</methodname>()</link> 
and <link
linkend="method-pangofontmap--load-font"><methodname>pango.FontMap.load_font</methodname>()</link>) 
methods.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-pangofont--describe">
      <title>pango.Font.describe</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>describe</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-pangofontdescription"><classname>pango.FontDescription</classname></link> 
object.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>describe</methodname>() method returns a
description of the font in a <link
linkend="class-pangofontdescription"><classname>pango.FontDescription</classname></link> 
object.</para>

    </refsect2>

    <refsect2 id="method-pangofont--get-metrics">
      <title>pango.Font.get_metrics</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_metrics</methodname>
	  <methodparam><parameter
			 role="keyword">language</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">language</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-pangolanguage"><classname>pango.Language</classname></link>
that determines the script to get the metrics for, or
<literal>None</literal> to get the metrics for the entire
font.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-pangofontmetrics"><classname>pango.FontMetrics</classname></link> 
object.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_metrics</methodname>() method returns a
<link
linkend="class-pangofontmetrics"><classname>pango.FontMetrics</classname></link> 
object containing the metric information for a font using the <link
linkend="class-pangolanguage"><classname>pango.Language</classname></link>
specified by <parameter>language</parameter> to limit the metrics to the
script(s) used by <parameter>language</parameter>. If the value of
<parameter>language</parameter> is <literal>None</literal>, the font metrics
for the entire font is returned.</para>

    </refsect2>

    <refsect2 id="method-pangofont--get-glyph-extents">
      <title>pango.Font.get_glyph_extents</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_glyph_extents</methodname>
	  <methodparam><parameter
			 role="keyword">glyph</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">glyph</parameter>&nbsp;:</term>
	  <listitem><simpara>the glyph index</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a 2-tuple containing two 4-tuples representing
the ink and logical rectangles used to store the extents of
<parameter>glyph</parameter> as drawn.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_glyph_extents</methodname>() method returns a
2-tuple containing two 4-tuples representing the values of the logical and
ink extent rectangles of the specified <parameter>glyph</parameter> within a
font. The coordinate system for each rectangle has its origin at the base
line and horizontal origin of the character with increasing coordinates
extending to the right and down. The <function>pango.ASCENT()</function>,
<function>pango.DESCENT()</function>, <function>pango.LBEARING()</function>,
and <function>pango.RBEARING</function> functions can be used to convert
from the extents rectangle to more traditional font metrics. The units of
the rectangles are in <literal>1/pango.SCALE</literal> of a device
unit.</para>

    </refsect2>

    <refsect2 id="method-pangofont--get-font-map">
      <title>pango.Font.get_font_map</title>
 
      <programlisting><methodsynopsis language="python">
        <methodname>get_font_map</methodname>
        <methodparam></methodparam>
      </methodsynopsis></programlisting>
 
      <variablelist>
        <varlistentry>
          <term><emphasis>Returns</emphasis>&nbsp;:</term>
          <listitem><simpara>the <link
          linkend="class-pangofontmap"><classname>pango.FontMap</classname></link>
          for the font</simpara></listitem>
        </varlistentry>
      </variablelist>
 
      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>
 
      <para>Gets the font map for which the font was created.</para>
 
    </refsect2>
 
  </refsect1>

  <refsect1>
    <title>Functions</title>

    <refsect2 id="function-pango--PIXELS">
      <title>pango.PIXELS</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>pango.PIXELS</methodname>
	  <methodparam><parameter
			 role="keyword">size</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">size</parameter>&nbsp;:</term>
	  <listitem><simpara>the integer value to convert to pango
pixels</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the pixel value</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>pango.PIXELS</function>() function converts and
returns the integer value specified by <parameter>size</parameter> to pango
pixels.</para>

    </refsect2>

    <refsect2 id="function-pango--ASCENT">
      <title>pango.ASCENT</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>pango.ASCENT</methodname>
	  <methodparam><parameter
			 role="keyword">rect</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">rect</parameter>&nbsp;:</term>
	  <listitem><simpara>a 4-tuple representing an extent rectangle's
(x, y, width, height) value</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the ascent value of
<parameter>rect</parameter></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>pango.ASCENT</function>() function returns the
ascent value of the extent rectangle specified by
<parameter>rect</parameter>.</para>

    </refsect2>

    <refsect2 id="function-pango--DESCENT">
      <title>pango.DESCENT</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>pango.DESCENT</methodname>
	  <methodparam><parameter
			 role="keyword">rect</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">rect</parameter>&nbsp;:</term>
	  <listitem><simpara>a 4-tuple representing an extent rectangle's
(x, y, width, height) value</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the descent value of
<parameter>rect</parameter></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>pango.DESCENT</function>() function returns the
descent value of the extent rectangle specified by
<parameter>rect</parameter>.</para>

    </refsect2>

    <refsect2 id="function-pango--RBEARING">
      <title>pango.RBEARING</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>pango.RBEARING</methodname>
	  <methodparam><parameter
			 role="keyword">rect</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">rect</parameter>&nbsp;:</term>
	  <listitem><simpara>a 4-tuple representing an extent rectangle's
(x, y, width, height) value</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the right bearing value of
<parameter>rect</parameter></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>pango.RBEARING</function>() function returns the
right bearing value of the extent rectangle specified by
<parameter>rect</parameter>.</para>

    </refsect2>

    <refsect2 id="function-pango--LBEARING">
      <title>pango.LBEARING</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>pango.LBEARING</methodname>
	  <methodparam><parameter
			 role="keyword">rect</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">rect</parameter>&nbsp;:</term>
	  <listitem><simpara>a 4-tuple representing an extent rectangle's
(x, y, width, height) value</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the left bearing value of
<parameter>rect</parameter></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>pango.LBEARING</function>() function returns the
left bearing value of the extent rectangle specified by
<parameter>rect</parameter>.</para>

    </refsect2>

  </refsect1>

</refentry>