/usr/share/gtk-doc/html/pygtk/class-pangocairocairocontext.html is in python-gtk2-doc 2.24.0-4.
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 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>pangocairo.CairoContext</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="pangocairo-class-reference.html" title="The pangocairo Class Reference"><link rel="prev" href="pangocairo-class-reference.html" title="The pangocairo Class Reference"><link rel="next" href="class-pangocairocairofontmap.html" title="pangocairo.CairoFontMap"></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">pangocairo.CairoContext</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="pangocairo-class-reference.html">Prev</a> </td><th width="60%" align="center">The pangocairo Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-pangocairocairofontmap.html">Next</a></td></tr></table><hr></div><div class="refentry" title="pangocairo.CairoContext"><a name="class-pangocairocairocontext"></a><div class="titlepage"></div><div class="refnamediv"><h2>pangocairo.CairoContext</h2><p>pangocairo.CairoContext — object providing support for using Cairo (new in
PyGTK 2.8)</p></div><div class="refsect1" title="Synopsis"><a name="id3546509"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">pangocairo.CairoContext</span></span>(<span class="ooclass"><span class="classname"><PYGTKDOCLINK HREF="class-cairocontext">cairo.Context</PYGTKDOCLINK></span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a class="link" href="class-pangocairocairocontext.html#constructor-pangocairocairocontext" title="Constructor">pangocairo.CairoContext</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>cr</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangocairocairocontext.html#method-pangocairocairocontext--update-context" title="pangocairo.CairoContext.update_context">update_context</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>context</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangocairocairocontext.html#method-pangocairocairocontext--create-layout" title="pangocairo.CairoContext.create_layout">create_layout</a></span>()</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangocairocairocontext.html#method-pangocairocairocontext--update-layout" title="pangocairo.CairoContext.update_layout">update_layout</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>layout</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangocairocairocontext.html#method-pangocairocairocontext--show-glyph-string" title="pangocairo.CairoContext.show_glyph_string">show_glyph_string</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>font</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>glyphs</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangocairocairocontext.html#method-pangocairocairocontext--show-layout-line" title="pangocairo.CairoContext.show_layout_line">show_layout_line</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>line</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangocairocairocontext.html#method-pangocairocairocontext--show-layout" title="pangocairo.CairoContext.show_layout">show_layout</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>layout</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangocairocairocontext.html#method-pangocairocairocontext--glyph-string-path" title="pangocairo.CairoContext.glyph_string_path">glyph_string_path</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>font</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>glyphs</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangocairocairocontext.html#method-pangocairocairocontext--layout-line-path" title="pangocairo.CairoContext.layout_line_path">layout_line_path</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>line</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangocairocairocontext.html#method-pangocairocairocontext--layout-path" title="pangocairo.CairoContext.layout_path">layout_path</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>layout</code></strong></span></span>)</code><br></pre></td></tr></table></div><div class="refsect1" title="Ancestry"><a name="id3219051"></a><h2>Ancestry</h2><pre class="synopsis">+-- cairo.Context
+-- <a class="link" href="class-pangocairocairocontext.html" title="pangocairo.CairoContext">pangocairo.CairoContext</a>
</pre></div><div class="refsect1" title="Description"><a name="id3079081"></a><h2>Description</h2><p>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. There is a Python module that wraps the Cairo API that
is used by PyGTK via subclassing of the cairo.Context class by the <a class="link" href="class-pangocairocairocontext.html" title="pangocairo.CairoContext"><code class="classname">pangocairo.CairoContext</code></a>
class. The cairo.Context class provides most of the drawing primitives used
for drawing on Cairo surfaces.</p><p>PyGTK (and GTK+ and GDK) does not wrap the Cairo API, instead
<a class="link" href="class-gdkcairocontext.html" title="gtk.gdk.CairoContext"><code class="classname">gtk.gdk.CairoContext</code></a>
objects can be used to draw on <a class="link" href="class-gdkdrawable.html" title="gtk.gdk.Drawable"><code class="classname">gtk.gdk.Drawable</code></a>
objects. A <a class="link" href="class-gdkcairocontext.html" title="gtk.gdk.CairoContext"><code class="classname">gtk.gdk.CairoContext</code></a>
is created using the <a class="link" href="class-gdkdrawable.html#method-gdkdrawable--cairo-create" title="gtk.gdk.Drawable.cairo_create"><code class="methodname">gtk.gdk.Drawable.cairo_create</code>()</a>
method. See the <a class="link" href="class-gdkcairocontext.html" title="gtk.gdk.CairoContext"><code class="classname">gtk.gdk.CairoContext</code></a>
and Python cairo module documentation for additional methods.</p></div><div class="refsect1" title="Constructor"><a name="constructor-pangocairocairocontext"></a><h2>Constructor</h2><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">pangocairo.CairoContext</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>cr</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>cr</code></strong> :</span></p></td><td>a <code class="classname"><PYGTKDOCLINK HREF="class-cairocontext">cairo.Context</PYGTKDOCLINK></code>
</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-pangocairocairocontext.html" title="pangocairo.CairoContext"><code class="classname">pangocairo.CairoContext</code></a>.</td></tr></tbody></table><p>Creates a new <a class="link" href="class-pangocairocairocontext.html" title="pangocairo.CairoContext"><code class="classname">pangocairo.CairoContext</code></a></p></div><div class="refsect1" title="Methods"><a name="id3086312"></a><h2>Methods</h2><div class="refsect2" title="pangocairo.CairoContext.update_context"><a name="method-pangocairocairocontext--update-context"></a><h3>pangocairo.CairoContext.update_context</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">update_context</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>context</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>context</code></strong> :</span></p></td><td>a <a class="link" href="class-pangocontext.html" title="pango.Context"><code class="classname">pango.Context</code></a>
created by the <a class="link" href="class-pangocairocairofontmap.html#method-pangocairocairofontmap--create-context" title="pangocairo.CairoFontMap.create_context"><code class="methodname">pangocairo.CairoFontMap.create_context</code>()</a>
method</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.8 and above.</p></div><p>The <code class="methodname">update_context</code>() method updates a
<a class="link" href="class-pangocontext.html" title="pango.Context"><code class="classname">pango.Context</code></a>
previously created for use with Cairo to match the current transformation
and target surface of a Cairo context. If any layouts have been created for
the context, it's necessary to call the <a class="link" href="class-pangolayout.html#method-pangolayout--context-changed" title="pango.Layout.context_changed"><code class="methodname">pango.Layout.context_changed</code>()</a>
method on those layouts.</p></div><div class="refsect2" title="pangocairo.CairoContext.create_layout"><a name="method-pangocairocairocontext--create-layout"></a><h3>pangocairo.CairoContext.create_layout</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">create_layout</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-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a>
object.</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.8 and above.</p></div><p>The <code class="methodname">create_layout</code>() method creates a
<a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a>
object set up to match the current transformation and target surface of the
Cairo context. This layout can then be used for text measurement with
methods like <a class="link" href="class-pangolayout.html#method-pangolayout--get-size" title="pango.Layout.get_size"><code class="methodname">pango.Layout.get_size</code>()</a>
or for drawing with methods like <a class="link" href="class-pangocairocairocontext.html#method-pangocairocairocontext--show-layout" title="pangocairo.CairoContext.show_layout"><code class="methodname">show_layout</code>()</a>. If
you change the transformation or target surface for the context, you need to
call the <a class="link" href="class-pangocairocairocontext.html#method-pangocairocairocontext--update-layout" title="pangocairo.CairoContext.update_layout"><code class="methodname">update_layout</code>()</a>
method.</p><p>This method is the most convenient way to use Cairo with Pango,
however it is slightly inefficient since it creates a separate <a class="link" href="class-pangocontext.html" title="pango.Context"><code class="classname">pango.Context</code></a>
object for each layout. This might be of concern in an application laying
out large amounts of text.</p></div><div class="refsect2" title="pangocairo.CairoContext.update_layout"><a name="method-pangocairocairocontext--update-layout"></a><h3>pangocairo.CairoContext.update_layout</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">update_layout</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>layout</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>layout</code></strong> :</span></p></td><td>a <a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a>
created by the <a class="link" href="class-pangocairocairocontext.html#method-pangocairocairocontext--create-layout" title="pangocairo.CairoContext.create_layout"><code class="methodname">create_layout</code>()</a>
method</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.8 and above.</p></div><p>The <code class="methodname">update_layout</code>() method updates the
private <a class="link" href="class-pangocontext.html" title="pango.Context"><code class="classname">pango.Context</code></a> of
the <a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a>
(specified by <em class="parameter"><code>layout</code></em>) that was created with the <a class="link" href="class-pangocairocairocontext.html#method-pangocairocairocontext--create-layout" title="pangocairo.CairoContext.create_layout"><code class="methodname">create_layout</code>()</a>
method to match the current transformation and target surface of a Cairo
context.</p></div><div class="refsect2" title="pangocairo.CairoContext.show_glyph_string"><a name="method-pangocairocairocontext--show-glyph-string"></a><h3>pangocairo.CairoContext.show_glyph_string</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">show_glyph_string</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>font</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>glyphs</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>font</code></strong> :</span></p></td><td>a <a class="link" href="class-pangofont.html" title="pango.Font"><code class="classname">pango.Font</code></a></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>glyphs</code></strong> :</span></p></td><td>a <a class="link" href="class-pangoglyphstring.html" title="pango.GlyphString"><code class="classname">pango.GlyphString</code></a></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.8 and above.</p></div><p>The <code class="methodname">show_glyph_string</code>() method draws
the <a class="link" href="class-pangoglyphstring.html" title="pango.GlyphString"><code class="classname">pango.GlyphString</code></a>
specified by <em class="parameter"><code>glyphs</code></em> in the cairo context using the
<a class="link" href="class-pangofont.html" title="pango.Font"><code class="classname">pango.Font</code></a>
specified by <em class="parameter"><code>font</code></em>. The origin of the glyphs (the left
edge of the baseline) will be drawn at the current point of the cairo
context.</p></div><div class="refsect2" title="pangocairo.CairoContext.show_layout_line"><a name="method-pangocairocairocontext--show-layout-line"></a><h3>pangocairo.CairoContext.show_layout_line</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">show_layout_line</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>line</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>line</code></strong> :</span></p></td><td>a <a class="link" href="class-pangolayoutline.html" title="pango.LayoutLine"><code class="classname">pango.LayoutLine</code></a></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.8 and above.</p></div><p>The <code class="methodname">show_layout_line</code>() method draws the
<a class="link" href="class-pangolayoutline.html" title="pango.LayoutLine"><code class="classname">pango.LayoutLine</code></a>
specified by <em class="parameter"><code>line</code></em> in the cairo context. The origin of
the glyphs (the left edge of the line) will be drawn at the current point of
the cairo context.</p></div><div class="refsect2" title="pangocairo.CairoContext.show_layout"><a name="method-pangocairocairocontext--show-layout"></a><h3>pangocairo.CairoContext.show_layout</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">show_layout</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>layout</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>layout</code></strong> :</span></p></td><td>a <a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a></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.8 and above.</p></div><p>The <code class="methodname">show_layout</code>() method draws the
<a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a>
specified by <em class="parameter"><code>layout</code></em> in the cairo context. The
top-left corner of the <a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a> will
be drawn at the current point of the cairo context.</p></div><div class="refsect2" title="pangocairo.CairoContext.glyph_string_path"><a name="method-pangocairocairocontext--glyph-string-path"></a><h3>pangocairo.CairoContext.glyph_string_path</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">glyph_string_path</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>font</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>glyphs</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>font</code></strong> :</span></p></td><td>a <a class="link" href="class-pangofont.html" title="pango.Font"><code class="classname">pango.Font</code></a></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>glyphs</code></strong> :</span></p></td><td>a <a class="link" href="class-pangoglyphstring.html" title="pango.GlyphString"><code class="classname">pango.GlyphString</code></a></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.8 and above.</p></div><p>The <code class="methodname">glyph_string_path</code>() method adds the
<a class="link" href="class-pangoglyphstring.html" title="pango.GlyphString"><code class="classname">pango.GlyphString</code></a>
specified by <em class="parameter"><code>glyphs</code></em> to the current path in the cairo
context using the <a class="link" href="class-pangofont.html" title="pango.Font"><code class="classname">pango.Font</code></a> specified
by font. The origin of the added glyphs (the left edge of the baseline) will
be at the current point of the cairo context.</p></div><div class="refsect2" title="pangocairo.CairoContext.layout_line_path"><a name="method-pangocairocairocontext--layout-line-path"></a><h3>pangocairo.CairoContext.layout_line_path</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">layout_line_path</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>line</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>line</code></strong> :</span></p></td><td>a <a class="link" href="class-pangolayoutline.html" title="pango.LayoutLine"><code class="classname">pango.LayoutLine</code></a></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.8 and above.</p></div><p>The <code class="methodname">layout_line_path</code>() method adds the
text in the <a class="link" href="class-pangolayoutline.html" title="pango.LayoutLine"><code class="classname">pango.LayoutLine</code></a>
specified by <em class="parameter"><code>line</code></em> to the current path in the
specified cairo context. The origin of the glyphs (the left edge of the
line) will be at the current point of the cairo context.</p></div><div class="refsect2" title="pangocairo.CairoContext.layout_path"><a name="method-pangocairocairocontext--layout-path"></a><h3>pangocairo.CairoContext.layout_path</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">layout_path</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>layout</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>layout</code></strong> :</span></p></td><td>a <a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a></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.8 and above.</p></div><p>The <code class="methodname">layout_path</code>() method adds the text
in the <a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a>
specified by <em class="parameter"><code>layout</code></em> to the current path in the
specified cairo context. The top-left corner of the <a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a> will
be at the current point of the cairo context.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="pangocairo-class-reference.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pangocairo-class-reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="class-pangocairocairofontmap.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The pangocairo Class Reference </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> pangocairo.CairoFontMap</td></tr></table></div></body></html>
|