This file is indexed.

/usr/share/gtk-doc/html/pygtk/class-gtkprintcontext.html is in python-gtk2-doc 2.24.0-5.1ubuntu2.

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>gtk.PrintContext</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="gtk-class-reference.html" title="The gtk Class Reference"><link rel="prev" href="class-gtkplug.html" title="gtk.Plug"><link rel="next" href="class-gtkprintoperation.html" title="gtk.PrintOperation"></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">gtk.PrintContext</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkplug.html">Prev</a> </td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gtkprintoperation.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gtk.PrintContext"><a name="class-gtkprintcontext"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.PrintContext</h2><p>gtk.PrintContext — Encapsulates context for drawing pages (new in PyGTK 2.10)</p></div><div class="refsect1" title="Synopsis"><a name="id3831081"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.PrintContext</span></span>(<span class="ooclass"><span class="classname"><PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK></span></span>):
<code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkprintcontext.html#method-gtkprintcontext--get-cairo-context" title="gtk.PrintContext.get_cairo_context">get_cairo_context</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkprintcontext.html#method-gtkprintcontext--get-page-setup" title="gtk.PrintContext.get_page_setup">get_page_setup</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkprintcontext.html#method-gtkprintcontext--get-width" title="gtk.PrintContext.get_width">get_width</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkprintcontext.html#method-gtkprintcontext--get-height" title="gtk.PrintContext.get_height">get_height</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkprintcontext.html#method-gtkprintcontext--get-dpi-x" title="gtk.PrintContext.get_dpi_x">get_dpi_x</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkprintcontext.html#method-gtkprintcontext--get-dpi-y" title="gtk.PrintContext.get_dpi_y">get_dpi_y</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkprintcontext.html#method-gtkprintcontext--get-pango-fontmap" title="gtk.PrintContext.get_pango_fontmap">get_pango_fontmap</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkprintcontext.html#method-gtkprintcontext--create-pango-context" title="gtk.PrintContext.create_pango_context">create_pango_context</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkprintcontext.html#method-gtkprintcontext--create-pango-layout" title="gtk.PrintContext.create_pango_layout">create_pango_layout</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkprintcontext.html#method-gtkprintcontext--set-cairo-context" title="gtk.PrintContext.set_cairo_context">set_cairo_context</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>cr</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dpi_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dpi_y</code></strong></span></span>)</code><br></pre></td></tr></table></div><div class="refsect1" title="Ancestry"><a name="id3831350"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
  +-- <a class="link" href="class-gtkprintcontext.html" title="gtk.PrintContext">gtk.PrintContext</a>
</pre></div><div class="refsect1" title="gtk.PrintContext Signal Prototypes"><a name="signal-prototypes-gtkprintcontext"></a><h2>gtk.PrintContext Signal Prototypes</h2><p><PYGTKDOCLINK HREF="signal-prototypes-gobject">gobject.GObject Signal Prototypes</PYGTKDOCLINK></p></div><div class="refsect1" title="Description"><a name="id3831397"></a><h2>Description</h2><p>A <a class="link" href="class-gtkprintcontext.html" title="gtk.PrintContext"><code class="classname">gtk.PrintContext</code></a>
    encapsulates context information that is required when drawing pages for
    printing, such as the cairo context and important parameters like page
    size and resolution. It also lets you easily create <a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a>
    and <a class="link" href="class-pangocontext.html" title="pango.Context"><code class="classname">pango.Context</code></a>
    objects that match the font metrics of the cairo surface.</p><p><a class="link" href="class-gtkprintcontext.html" title="gtk.PrintContext"><code class="classname">gtk.PrintContext</code></a>
    objects gets passed to the "begin-print", "end-print",
    "request-page-setup" and "draw-page" signals on the <a class="link" href="class-gtkprintoperation.html" title="gtk.PrintOperation"><code class="classname">gtk.PrintOperation</code></a>.</p><div class="example"><a name="id3831452"></a><p class="title"><b>Example 2. Using <a class="link" href="class-gtkprintcontext.html" title="gtk.PrintContext"><code class="classname">gtk.PrintContext</code></a>
in a "draw-page" callback</b></p><div class="example-contents"><pre class="programlisting">
def draw_page(operation, context, page_nr):
  cr = context.get_cairo_context()

  # Draw a red rectangle, as wide as the paper (inside the margins)
  cr.set_source_rgb(1.0, 0, 0)
  cr.rectangle(0, 0, context.get_width(), 50)
  
  cr.fill()

  # Draw some lines
  cr.move_to(20, 10)
  cr.line_to(40, 20)
  cr.arc(60, 60, 20, 0, M_PI)
  cr.line_to(80, 20)
  
  cr.set_source_rgb(0, 0, 0)
  cr.set_line_width(5)
  cr.set_line_cap(cairo.LINE_CAP_ROUND)
  cr.set_line_join(cairo.LINE_JOIN_ROUND)
  
  cr.stroke()

  # Draw some text
  layout = cr.create_layout()
  layout.set_text("Hello World! Printing is easy")
  desc = pango.FontDescription("sans 28")
  layout.set_font_description(desc)

  cr.move_to(30, 20)
  cr.layout_path(layout)

  # Font Outline
  cr.set_source_rgb(0.93, 1.0, 0.47)
  cr.set_line_width(0.5)
  cr.stroke_preserve()

  # Font Fill
  cr.set_source_rgb(0, 0.0, 1.0)
  cr.fill()
</pre></div></div><br class="example-break"><p>Printing support was added in GTK+ 2.10.</p></div><div class="refsect1" title="Methods"><a name="id3831494"></a><h2>Methods</h2><div class="refsect2" title="gtk.PrintContext.get_cairo_context"><a name="method-gtkprintcontext--get-cairo-context"></a><h3>gtk.PrintContext.get_cairo_context</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_cairo_context</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 cairo context</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>The <code class="methodname">get_cairo_context</code>() method returns
      the cairo context that is associated with the <a class="link" href="class-gtkprintcontext.html" title="gtk.PrintContext"><code class="classname">gtk.PrintContext</code></a>.</p></div><div class="refsect2" title="gtk.PrintContext.get_page_setup"><a name="method-gtkprintcontext--get-page-setup"></a><h3>gtk.PrintContext.get_page_setup</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_page_setup</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 page setup</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>The <code class="methodname">get_page_setup</code>() method returns the
      <a class="link" href="class-gtkpagesetup.html" title="gtk.PageSetup"><code class="classname">gtk.PageSetup</code></a>
      that determines the page dimensions of the <a class="link" href="class-gtkprintcontext.html" title="gtk.PrintContext"><code class="classname">gtk.PrintContext</code></a>.</p></div><div class="refsect2" title="gtk.PrintContext.get_width"><a name="method-gtkprintcontext--get-width"></a><h3>gtk.PrintContext.get_width</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_width</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 width</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>The <code class="methodname">get_width</code>() method returns the width
      of the <a class="link" href="class-gtkprintcontext.html" title="gtk.PrintContext"><code class="classname">gtk.PrintContext</code></a>,
      in pixels.</p></div><div class="refsect2" title="gtk.PrintContext.get_height"><a name="method-gtkprintcontext--get-height"></a><h3>gtk.PrintContext.get_height</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_height</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 height</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>The <code class="methodname">get_height</code>() method returns the
      width of the <a class="link" href="class-gtkprintcontext.html" title="gtk.PrintContext"><code class="classname">gtk.PrintContext</code></a>,
      in pixels.</p></div><div class="refsect2" title="gtk.PrintContext.get_dpi_x"><a name="method-gtkprintcontext--get-dpi-x"></a><h3>gtk.PrintContext.get_dpi_x</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_dpi_x</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 horizontal resolution</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>The <code class="methodname">get_dpi_x</code>() method returns the
      horizontal resolution of the <a class="link" href="class-gtkprintcontext.html" title="gtk.PrintContext"><code class="classname">gtk.PrintContext</code></a>,
      in dots per inch.</p></div><div class="refsect2" title="gtk.PrintContext.get_dpi_y"><a name="method-gtkprintcontext--get-dpi-y"></a><h3>gtk.PrintContext.get_dpi_y</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_dpi_y</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 vertical resolution</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>The <code class="methodname">get_dpi_y</code>() method returns the
      vertical resolution of the <a class="link" href="class-gtkprintcontext.html" title="gtk.PrintContext"><code class="classname">gtk.PrintContext</code></a>,
      in dots per inch.</p></div><div class="refsect2" title="gtk.PrintContext.get_pango_fontmap"><a name="method-gtkprintcontext--get-pango-fontmap"></a><h3>gtk.PrintContext.get_pango_fontmap</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_pango_fontmap</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 font map</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>The method returns a <a class="link" href="class-pangofontmap.html" title="pango.FontMap"><code class="classname">pango.FontMap</code></a>
      that is suitable for use with the <a class="link" href="class-gtkprintcontext.html" title="gtk.PrintContext"><code class="classname">gtk.PrintContext</code></a>.</p></div><div class="refsect2" title="gtk.PrintContext.create_pango_context"><a name="method-gtkprintcontext--create-pango-context"></a><h3>gtk.PrintContext.create_pango_context</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">create_pango_context</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-pangocontext.html" title="pango.Context"><code class="classname">pango.Context</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.10 and above.</p></div><p>The <code class="methodname">create_pango_context</code>() method
      creates a new <a class="link" href="class-pangocontext.html" title="pango.Context"><code class="classname">pango.Context</code></a>
      that can be used with the <a class="link" href="class-gtkprintcontext.html" title="gtk.PrintContext"><code class="classname">gtk.PrintContext</code></a>.</p></div><div class="refsect2" title="gtk.PrintContext.create_pango_layout"><a name="method-gtkprintcontext--create-pango-layout"></a><h3>gtk.PrintContext.create_pango_layout</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">create_pango_layout</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-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.10 and above.</p></div><p>The <code class="methodname">create_pango_layout</code>() method
      creates a new <a class="link" href="class-pangolayout.html" title="pango.Layout"><code class="classname">pango.Layout</code></a>
      that is suitable for use with the <a class="link" href="class-gtkprintcontext.html" title="gtk.PrintContext"><code class="classname">gtk.PrintContext</code></a>.</p></div><div class="refsect2" title="gtk.PrintContext.set_cairo_context"><a name="method-gtkprintcontext--set-cairo-context"></a><h3>gtk.PrintContext.set_cairo_context</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_cairo_context</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>cr</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dpi_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dpi_y</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></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dpi_x</code></strong> :</span></p></td><td></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dpi_y</code></strong> :</span></p></td><td></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>The <code class="methodname">set_cairo_context</code>() method sets the
      CairoContext specified by <em class="parameter"><code>cr</code></em> as the cairo
      context for the print context. <em class="parameter"><code>dpi_x</code></em> and
      <em class="parameter"><code>dpi_y</code></em> specify the horizontal and vertical
      resolution of the print 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="class-gtkplug.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="gtk-class-reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="class-gtkprintoperation.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.Plug </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gtk.PrintOperation</td></tr></table></div></body></html>