class Pango::Renderer

Overview

Pango::Renderer is a base class for objects that can render text provided as Pango::GlyphString or Pango::Layout.

By subclassing Pango::Renderer and overriding operations such as draw_glyphs and draw_rectangle, renderers for particular font backends and destinations can be created.

Defined in:

lib/gi-crystal/src/auto/pango-1.0/renderer.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class GObject::Object

==(other : self) ==, bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding bind_property, bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding bind_property_full, data(key : String) : Pointer(Void) | Nil data, finalize finalize, freeze_notify : Nil freeze_notify, getv(names : Enumerable(String), values : Enumerable(_)) : Nil getv, hash(hasher) hash, notify(property_name : String) : Nil notify, notify_by_pspec(pspec : GObject::ParamSpec) : Nil notify_by_pspec, notify_signal notify_signal, property(property_name : String, value : _) : Nil property, qdata(quark : UInt32) : Pointer(Void) | Nil qdata, ref_count : UInt32 ref_count, run_dispose : Nil run_dispose, set_data(key : String, data : Pointer(Void) | Nil) : Nil set_data, set_property(property_name : String, value : _) : Nil set_property, steal_data(key : String) : Pointer(Void) | Nil steal_data, steal_qdata(quark : UInt32) : Pointer(Void) | Nil steal_qdata, thaw_notify : Nil thaw_notify, to_unsafe : Pointer(Void) to_unsafe, watch_closure(closure : GObject::Closure) : Nil watch_closure

Constructor methods inherited from class GObject::Object

cast(obj : GObject::Object) : self cast, new(pointer : Pointer(Void), transfer : GICrystal::Transfer)
new
new
, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv

Class methods inherited from class GObject::Object

cast?(obj : GObject::Object) : self | Nil cast?, compat_control(what : UInt64, data : Pointer(Void) | Nil) : UInt64 compat_control, g_type : UInt64 g_type, interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec interface_find_property, interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec) interface_list_properties

Macros inherited from class GObject::Object

previous_vfunc(*args) previous_vfunc, previous_vfunc!(*args) previous_vfunc!, signal(signature) signal

Constructor Detail

def self.new #

Initialize a new Renderer.


[View source]

Class Method Detail

def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.


[View source]

Instance Method Detail

def ==(other : self) #
Description copied from class Reference

Returns true if this reference is the same as other. Invokes same?.


def activate : Nil #

Does initial setup before rendering operations on renderer.

Pango::Renderer#deactivate should be called when done drawing. Calls such as Pango::Renderer#draw_layout automatically activate the layout before drawing on it.

Calls to Pango::Renderer#activate and Pango::Renderer#deactivate can be nested and the renderer will only be initialized and deinitialized once.


[View source]
def alpha(part : Pango::RenderPart) : UInt16 #

Gets the current alpha for the specified part.


[View source]
def color(part : Pango::RenderPart) : Pango::Color | Nil #

Gets the current rendering color for the specified part.


[View source]
def deactivate : Nil #

Cleans up after rendering operations on renderer.

See docs for Pango::Renderer#activate.


[View source]
def draw_error_underline(x : Int32, y : Int32, width : Int32, height : Int32) : Nil #

Draw a squiggly line that approximately covers the given rectangle 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.

This should be called while renderer is already active. Use Pango::Renderer#activate to activate a renderer.


[View source]
def draw_glyph(font : Pango::Font, glyph : UInt32, x : Float64, y : Float64) : Nil #

Draws a single glyph with coordinates in device space.


[View source]
def draw_glyph_item(text : String | Nil, glyph_item : Pango::GlyphItem, x : Int32, y : Int32) : Nil #

Draws the glyphs in glyph_item with the specified Pango::Renderer, embedding the text associated with the glyphs in the output if the output format supports it.

This is useful for rendering text in PDF.

Note that this method does not handle attributes in glyph_item. If you want colors, shapes and lines handled automatically according to those attributes, you need to use pango_renderer_draw_layout_line() or pango_renderer_draw_layout().

Note that text is the start of the text for layout, which is then indexed by glyph_item->item->offset.

If text is nil, this simply calls Pango::Renderer#draw_glyphs.

The default implementation of this method simply falls back to Pango::Renderer#draw_glyphs.


[View source]
def draw_glyphs(font : Pango::Font, glyphs : Pango::GlyphString, x : Int32, y : Int32) : Nil #

Draws the glyphs in glyphs with the specified Pango::Renderer.


[View source]
def draw_layout(layout : Pango::Layout, x : Int32, y : Int32) : Nil #

Draws layout with the specified Pango::Renderer.

This is equivalent to drawing the lines of the layout, at their respective positions relative to x, y.


[View source]
def draw_layout_line(line : Pango::LayoutLine, x : Int32, y : Int32) : Nil #

Draws line with the specified Pango::Renderer.

This draws the glyph items that make up the line, as well as shapes, backgrounds and lines that are specified by the attributes of those items.


[View source]
def draw_rectangle(part : Pango::RenderPart, x : Int32, y : Int32, width : Int32, height : Int32) : Nil #

Draws an axis-aligned rectangle in user space coordinates with the specified Pango::Renderer.

This should be called while renderer is already active. Use Pango::Renderer#activate to activate a renderer.


[View source]
def draw_trapezoid(part : Pango::RenderPart, y1_ : Float64, x11 : Float64, x21 : Float64, y2 : Float64, x12 : Float64, x22 : Float64) : Nil #

Draws a trapezoid with the parallel sides aligned with the X axis using the given Pango::Renderer; coordinates are in device space.


[View source]
def hash(hasher) #
Description copied from class Reference

See Object#hash(hasher)


def layout : Pango::Layout | Nil #

Gets the layout currently being rendered using renderer.

Calling this function only makes sense from inside a subclass's methods, like in its draw_shape vfunc, for example.

The returned layout should not be modified while still being rendered.


[View source]
def layout_line : Pango::LayoutLine | Nil #

Gets the layout line currently being rendered using renderer.

Calling this function only makes sense from inside a subclass's methods, like in its draw_shape vfunc, for example.

The returned layout line should not be modified while still being rendered.


[View source]
def matrix : Pango::Matrix | Nil #

Gets the transformation matrix that will be applied when rendering.

See Pango::Renderer#matrix=.


[View source]
def matrix=(matrix : Pango::Matrix | Nil) : Nil #

Sets the transformation matrix that will be applied when rendering.


[View source]
def part_changed(part : Pango::RenderPart) : Nil #

Informs Pango that the way that the rendering is done for part has changed.

This should be called if the rendering changes in a way that would prevent multiple pieces being joined together into one drawing call. For instance, if a subclass of Pango::Renderer was to add a stipple option for drawing underlines, it needs to call

pango_renderer_part_changed (render, 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 Pango::Renderer#color=)


[View source]
def set_alpha(part : Pango::RenderPart, alpha : UInt16) : Nil #

Sets the alpha for part of the rendering.

Note that the alpha may only be used if a color is specified for part as well.


[View source]
def set_color(part : Pango::RenderPart, color : Pango::Color | Nil) : Nil #

Sets the color for part of the rendering.

Also see Pango::Renderer#alpha=.


[View source]