Gtk::PrintContext
class Gtk::PrintContext
A Gtk::PrintContext 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 Pango::Layout and Pango::Context objects that match the font metrics of the cairo surface.
Gtk::PrintContext objects gets passed to the ::begin-print,
the Gtk::PrintOperation.
Instance Methods
cairo_context
-
Obtains the cairo context that is associated with the Gtk::PrintContext.
- Returns: the cairo context of self
create_pango_context
-
Creates a new Pango::Context that can be used with the Gtk::PrintContext.
- Returns: a new Pango context for self
create_pango_layout
-
Creates a new Pango::Layout that is suitable for use
with the Gtk::PrintContext.
- Returns: a new Pango layout for self
dpi_x
-
Obtains the horizontal resolution of the
Gtk::PrintContext, in dots per inch.
- Returns: the horizontal resolution of self
dpi_y
-
Obtains the vertical resolution of the
Gtk::PrintContext, in dots per inch.
- Returns: the vertical resolution of self
height
-
Obtains the height of the Gtk::PrintContext, in pixels.
- Returns: the height of self
width
-
Obtains the width of the Gtk::PrintContext, in pixels.
- Returns: the width of self
page_setup
-
Obtains the Gtk::PageSetup that determines the page
dimensions of the Gtk::PrintContext.
- Returns: the page setup of self
pango_fontmap
-
Returns a Pango::FontMap that is suitable for use with
the Gtk::PrintContext.
- Returns: the font map of self
set_cairo_context(cr, dpi_x, dpi_y)
-
Sets a new cairo context on a print context.
This function is intended to be used when implementing an internal print preview, it is not needed for printing, since GTK+ itself creates a suitable cairo context in that case.
- cr: the cairo context
- dpi_x: the horizontal resolution to use with cr
- dpi_y: the vertical resolution to use with cr
Keyword(s):
References:[Ruby/GTK] [api-gtk-index] [Gtk::PrintOperation] [Gtk::PrintContext] [index-ruby-gtk2] [Gtk::PrintOperationPreview]