pango.Renderer

pango.Renderer — a base class for pango rendering (new in PyGTK 2.8)

Synopsis

class pango.Renderer(gobject.GObject):
    def draw_layout(layout, x, y)
def draw_layout_line(line, x, y)
def draw_glyphs(font, glyphs, x, y)
def draw_rectangle(part, x, y, width, height)
def draw_error_underline(x, y, width, height)
def draw_trapezoid(part, y1_, x11, x21, y2, x12, x22)
def activate()
def deactivate()
def part_changed(part)
def set_color(part, color)
def get_color(part)

Ancestry

+-- gobject.GObject
  +-- pango.Renderer

Description

pango.Renderer is a base class that contains the necessary logic for rendering a pango.Layout or pango.LayoutLine. By subclassing pango.Renderer and overriding operations such as draw_glyphs() and draw_rectangle(), renderers for particular font backends and destinations can be created.

Methods

pango.Renderer.draw_layout

    def draw_layout(layout, x, y)
layout :a pango.Layout
x :the x position of left edge of baseline, in user space coordinates in Pango units.
y :the y position of left edge of baseline, in user space coordinates in Pango units.

Note

This method is available in PyGTK 2.8 and above.

The draw_layout() method draws the pango.Layout s[ecified by layout at the position specified by x and y.

pango.Renderer.draw_layout_line

    def draw_layout_line(line, x, y)
line :a pango.LayoutLine
x :the x position of left edge of baseline, in user space coordinates in Pango units.
y :the y position of left edge of baseline, in user space coordinates in Pango units.

Note

This method is available in PyGTK 2.8 and above.

The draw_layout_line() method draws the pango.LayoutLine specified by line at the position specified by x and y.

pango.Renderer.draw_glyphs

    def draw_glyphs(font, glyphs, x, y)
font :a pango.Font
glyphs :a pango.GlyphString
x :the x position of left edge of baseline, in user space coordinates in Pango units.
y :the y position of left edge of baseline, in user space coordinates in Pango units.

Note

This method is available in PyGTK 2.8 and above.

The draw_glyphs() method draws the pango.GlyphString specified by glyphs using the pango.Font specified by font at the position specified by x and y.

pango.Renderer.draw_rectangle

    def draw_rectangle(part, x, y, width, height)
part :the part where the rectangle is to be rendered
x :the x position at which to draw rectangle, in user space coordinates in Pango units
y :the y position at which to draw rectangle, in user space coordinates in Pango units
width :the width of rectangle in Pango units in user space coordinates
height :the height of rectangle in Pango units in user space coordinates

Note

This method is available in PyGTK 2.8 and above.

The draw_rectangle() method draws an axis-aligned rectangle with the size specified by width and height at the position specified by x and y, all in user space coordinates. The rectangle will be drawn in the rendering part (see the Pango Render Part Constants) specified by part.

pango.Renderer.draw_error_underline

    def draw_error_underline(x, y, width, height)
x :the X coordinate of the underline, in Pango units in the user coordinate system
y :the Y coordinate of the underline, in Pango units in the user coordinate system
width :the width of the underline, in Pango units in the user coordinate system
height :the height of the underline, in Pango units in the user coordinate system

Note

This method is available in PyGTK 2.8 and above.

The draw_error_underline() method draws a squiggly line that approximately covers the rectangle specified by x, y, width and height in the style of an underline used to indicate a spelling error. (The width of the underline is rounded to an integer number of up/down segments and the resulting rectangle is centered in the original rectangle).

pango.Renderer.draw_trapezoid

    def draw_trapezoid(part, y1_, x11, x21, y2, x12, x22)
part :where the trapezoid is to be rendered
y1_ :the Y coordinate of the top of the trapezoid
x11 :the X coordinate of the left end of the top of the trapezoid
x21 :the X coordinate of the right end of the top of the trapezoid
y2 :the Y coordinate of the bottom of the trapezoid
x12 :the X coordinate of the left end of the bottom of the trapezoid
x22 :the X coordinate of the left end of the bottom of the trapezoid

Note

This method is available in PyGTK 2.8 and above.

The draw_trapezoid() method draws a trapezoid with the parallel sides aligned with the X axis using the coordinates specified by y1_, x11, x21, y2, x12, x22. The coordinates are in device space. The trapezoid is rendered in the part specified by part which must be one of the Pango Render Part Constants.

pango.Renderer.activate

    def activate()

Note

This method is available in PyGTK 2.8 and above.

The activate() method does initial setup before performing the rendering operations on renderer. The deactivate() method should be called when drawing is complete. Calls to the draw_layout() method automatically activate the layout before drawing on it. Calls to the activate() and deactivate() methods can be nested and the renderer will only be initialized and deinitialized once.

pango.Renderer.deactivate

    def deactivate()

Note

This method is available in PyGTK 2.8 and above.

The deactivate() method cleans up after rendering operations are completed. See the activate() method for more information.

pango.Renderer.part_changed

    def part_changed(part)
part :the part that has its rendering changed.

Note

This method is available in PyGTK 2.8 and above.

The part_changed() method informs Pango that the way that the renderering is done for the part specified by part has changed in a way that would prevent multiple pieces being joined together into one drawing call. part must be one of the Pango Render Part Constants. For instance, if a subclass of pango.Renderer was to add a stipple option for drawing underlines, it needs to call:

renderer.part_changed(pango.RENDER_PART_UNDERLINE)

when the stipple changes or underlines with different stipples might be joined together. Pango automatically calls this for changes to colors. (See the set_color() method for more information).

pango.Renderer.set_color

    def set_color(part, color)
part :the part to change the color of
color :a pango.Color

Note

This method is available in PyGTK 2.8 and above.

The set_color() method sets the pango.Color specified by color as the color for the part specified by part. part must be one of the Pango Render Part Constants.

pango.Renderer.get_color

    def get_color(part)
part :a part
Returns :,  :, a pango.Color or None

Note

This method is available in PyGTK 2.8 and above.

The get_color() method returns the current rendering pango.Color for the part specified by part. part must be one of the Pango Render Part Constants. If None is returned, the color has not been set and should be inherited from the environment.