summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-pangofontmetrics.xml
blob: 31dd2403817582ed62f3c3c7a447766c221c6a1d (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
<?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-pangofontmetrics">
  <refnamediv>
    <refname>pango.FontMetrics</refname>
    <refpurpose>an object containing overall metric information for a
font.</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>pango.FontMetrics</classname></ooclass>
      <ooclass><classname>gobject.GBoxed</classname></ooclass>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangofontmetrics--get-ascent">get_ascent</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangofontmetrics--get-descent">get_descent</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangofontmetrics--get-approximate-char-width">get_approximate_char_width</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangofontmetrics--get-approximate-digit-width">get_approximate_digit_width</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <para>A <link
linkend="class-pangofontmetrics"><classname>pango.FontMetrics</classname></link> 
object holds the overall metric information for a font. A <link
linkend="class-pangofontmetrics"><classname>pango.FontMetrics</classname></link> 
object is returned from the following methods:</para>

    <itemizedlist>
      <listitem>
	<simpara><link
linkend="method-pangocontext--get-metrics"><methodname>pango.Context.get_metrics</methodname>()</link></simpara>
      </listitem>
      <listitem>
	<simpara><link
linkend="method-pangofont--get-metrics"><methodname>pango.Font.get_metrics</methodname>()</link></simpara>
      </listitem>
      <listitem>
	<simpara><link
linkend="method-pangofontset--get-metrics"><methodname>pango.Fontset.get_metrics</methodname>()</link></simpara>
      </listitem>
    </itemizedlist>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-pangofontmetrics--get-ascent">
      <title>pango.FontMetrics.get_ascent</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_ascent</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the ascent in pango units. (1 point ==
<literal>pango.SCALE</literal> pango units.)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_ascent</methodname>() method returns the
font ascent in pango units where one font point is equal to pango.SCALE
(1024) pango units. The ascent is the distance from the baseline to the
logical top of a line of text. (The logical top may be above or below the
top of the actual drawn ink. It is necessary to lay out the text to figure
where the ink will be.)</para>

    </refsect2>

    <refsect2 id="method-pangofontmetrics--get-descent">
      <title>pango.FontMetrics.get_descent</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_descent</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the descent in pango units. (1 point ==
<literal>pango.SCALE</literal> pango units.)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_descent</methodname>() method returns the
font descent in pango units where one font point is equal to pango.SCALE
(1024) pango units. The descent is the distance from the baseline to the
logical bottom of a line of text. (The logical bottom may be above or below
the bottom of the actual drawn ink. It is necessary to lay out the text to
figure where the ink will be.)</para>

    </refsect2>

    <refsect2 id="method-pangofontmetrics--get-approximate-char-width">
      <title>pango.FontMetrics.get_approximate_char_width</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_approximate_char_width</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the character width in pango units. (1 point ==
<literal>pango.SCALE</literal> pango units.)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_approximate_char_width</methodname>() method
returns the approximate character width for a font in pango units where one
font point is equal to pango.SCALE (1024) pango units. This is merely a
representative value that is useful, for example, for determining the
initial size for a window. Actual characters in text will be wider and
narrower than this.</para>

    </refsect2>

    <refsect2 id="method-pangofontmetrics--get-approximate-digit-width">
      <title>pango.FontMetrics.get_approximate_digit_width</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_approximate_digit_width</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the digit width in pango units. (1 point ==
<literal>pango.SCALE</literal> pango units.)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_approximate_digit_width</methodname>()
method returns the approximate digit width for a font in pango units where
one font point is equal to pango.SCALE (1024) pango units. This is merely a
representative value that is useful, for example, for determining the
initial size for a window. Actual digits in text can be wider and narrower
than this, though this value is generally somewhat more accurate than the
result of the <link
linkend="method-pangofontmetrics--get-approximate-char-width"><methodname>get_approximate_char_width</methodname>()</link> 
method.</para>

    </refsect2>

  </refsect1>

</refentry>