summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-pangocairocairofontmap.xml
blob: e7504f6ba5b6955fe6d2d27dabf0b1502d132956 (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
<?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-pangocairocairofontmap">
  <refnamediv>
    <refname>pangocairo.CairoFontMap</refname>
    <refpurpose>object providing support for using font maps with
Cairo (new in PyGTK 2.8)</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>pangocairo.CairoFontMap</classname></ooclass>
      <ooclass><classname><link
linkend="class-pangocairocairofontmap">pangocairo.CairoFontMap</link></classname></ooclass>

      <constructorsynopsis language="python">
        <methodname><link linkend="constructor-pangocairocairofontmap">pangocairo.CairoFontMap</link></methodname>
      </constructorsynopsis>
      <methodsynopsis language="python">
        <methodname><link linkend="method-pangocairocairofontmap--set-resolution">set_resolution</link></methodname>
        <methodparam><parameter role="keyword">dpi</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
        <methodname><link linkend="method-pangocairocairofontmap--get-resolution">get_resolution</link></methodname>
      </methodsynopsis>
      <methodsynopsis language="python">
        <methodname><link linkend="method-pangocairocairofontmap--create-context">create_context</link></methodname>
      </methodsynopsis>
    </classsynopsis>

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

<methodsynopsis language="python">
    <methodname><link linkend="function-pangocairo--cairo-font-map-get-default">pangocairo.cairo_font_map_get_default</link></methodname>
  </methodsynopsis></programlisting>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-pangofontmap">pango.FontMap</link>
    +-- <link linkend="class-pangocairocairofontmap">pangocairo.CairoFontMap</link>
</synopsis>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <para><link
linkend="class-pangocairocairofontmap"><classname>pangocairo.CairoFontMap</classname></link>
is an interface exported by font maps for use with Cairo. The actual type of
the font map will depend on the particular font technology Cairo was
compiled to use.</para>

    <para>Cairo is a graphics library that supports vector graphics and
image compositing that can be used with PyGTK. Since 2.8, GTK+ and Pango do
most of their drawing using Cairo. The Cairo drawing model and primitives
are similar to PostScript which uses an imaging model of painting on a two
dimensional surface.</para>

  </refsect1>

  <refsect1 id="constructor-pangocairocairofontmap">
    <title>Constructor</title>
 
    <programlisting><constructorsynopsis language="python">
        <methodname>pangocairo.CairoFontMap</methodname>
      </constructorsynopsis></programlisting>
     <variablelist>
      <varlistentry>
        <term><emphasis>Returns</emphasis>&nbsp;:</term>
        <listitem><simpara>a new <link linkend="class-pangocairocairofontmap"><classname>pangocairo.CairoFontMap</classname></link> object</simpara></listitem>
      </varlistentry>
    </variablelist>

    <para>Creates a new <link
linkend="class-pangocairocairofontmap"><classname>pangocairo.CairoFontMap</classname></link>
object; a fontmap is used to cache information about available fonts, and
holds certain global parameters such as the resolution. In most cases, you
can use the <link
linkend="function-pangocairo--cairo-font-map-get-default"><function>pangocairo.cairo_font_map_get_default</function>()</link>
function instead.</para>

    <para>Note that the type of the returned object will depend on the
particular font backend Cairo was compiled to use; You generally should only
use the <link
linkend="class-pangofontmap"><classname>pango.FontMap</classname></link> and
<link
linkend="class-pangocairocairofontmap"><classname>pangocairo.CairoFontMap</classname></link>
interfaces on the returned object.</para>
                                                                                
  </refsect1>
                                                                                
   <refsect1>
    <title>Methods</title>

    <refsect2 id="method-pangocairocairofontmap--set-resolution">
      <title>pangocairo.CairoFontMap.set_resolution</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_resolution</methodname>
	  <methodparam><parameter
			 role="keyword">dpi</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">dpi</parameter>&nbsp;:</term>
	  <listitem><simpara>the resolution in "dots per inch". (Physical
inches aren't actually involved; the terminology is
conventional.)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.8 and above.</para>
      </note>

      <para>The <methodname>set_resolution</methodname>() method sets the
resolution for the fontmap to the value specified by
<parameter>dpi</parameter>. This is a scale factor between the points
specified in a <link
linkend="class-pangofontdescription"><classname>pango.FontDescription</classname></link>
and Cairo units. The default value is 96, meaning that a 10 point font will
be 13 units high. (10 * 96. / 72. = 13.3).</para>

    </refsect2>

    <refsect2 id="method-pangocairocairofontmap--get-resolution">
      <title>pangocairo.CairoFontMap.get_resolution</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_resolution</methodname>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara> the resolution in
"dots per inch"</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.8 and above.</para>
      </note>

      <para>The <methodname>get_resolution</methodname>() method returns the
resolution for the fontmap. See the <link
linkend="method-pangocairocairofontmap--set-resolution"><methodname>set_resolution</methodname>()</link>
method for more information.</para>

    </refsect2>

    <refsect2 id="method-pangocairocairofontmap--create-context">
      <title>pangocairo.CairoFontMap.create_context</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>create_context</methodname>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
linkend="class-pangocontext"><classname>pango.Context</classname></link>
object</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.8 and above.</para>
      </note>

      <para>The <methodname>create_context</methodname>() method creates a
new <link
linkend="class-pangocontext"><classname>pango.Context</classname></link>
object.</para>

    </refsect2>

  </refsect1>

  <refsect1>
    <title>Functions</title>

    <refsect2 id="function-pangocairo--cairo-font-map-get-default">
      <title>pangocairo.cairo_font_map_get_default</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>pangocairo.cairo_font_map_get_default</methodname>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara> the default Cairo fontmap for
Pango.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This function is available in PyGTK 2.8 and above.</para>
      </note>

      <para>The <function>pangocairo.cairo_font_map_get_default</function>()
function returns the default font map to use with Cairo.</para>

    </refsect2>

  </refsect1>

</refentry>