Module: PangoCairo
- Defined in:
- pango/lib/pango.rb
Overview
Defined Under Namespace
Instance Method Summary collapse
-
#context_get_font_options(context) ⇒ cairo::FontOptions
Retrieves any font rendering options previously set with pango_cairo_context_set_font_options().
-
#context_get_resolution(context) ⇒ Float
Gets the resolution for the context.
-
#context_get_shape_renderer(context, data) ⇒ PangoCairo::ShapeRendererFunc
Sets callback function for context to use for rendering attributes of type %PANGO_ATTR_SHAPE.
-
#context_set_font_options(context, options) ⇒ nil
Sets the font options used when rendering text with this context.
-
#context_set_resolution(context, dpi) ⇒ nil
Sets the resolution for the context.
-
#context_set_shape_renderer(context, func, data, dnotify) ⇒ nil
Sets callback function for context to use for rendering attributes of type %PANGO_ATTR_SHAPE.
-
#create_context(cr) ⇒ Pango::Context
Creates a context object set up to match the current transformation and target surface of the Cairo context.
-
#create_layout(cr) ⇒ Pango::Layout
Creates a layout object set up to match the current transformation and target surface of the Cairo context.
-
#error_underline_path(cr, x, y, width, height) ⇒ nil
Add a squiggly line to the current path in the specified cairo context that approximately covers the given rectangle in the style of an underline used to indicate a spelling error.
-
#font_map_get_default ⇒ Pango::FontMap
Gets a default Pango::CairoFontMap to use with Cairo.
-
#font_map_new ⇒ Pango::FontMap
Creates a new Pango::CairoFontMap object; a fontmap is used to cache information about available fonts, and holds certain global parameters such as the resolution.
-
#font_map_new_for_font_type(fonttype) ⇒ Pango::FontMap
Creates a new Pango::CairoFontMap object of the type suitable to be used with cairo font backend of type fonttype.
-
#glyph_string_path(cr, font, glyphs) ⇒ nil
Adds the glyphs in glyphs to the current path in the specified cairo context.
-
#layout_line_path(cr, line) ⇒ nil
Adds the text in Pango::LayoutLine to the current path in the specified cairo context.
-
#layout_path(cr, layout) ⇒ nil
Adds the text in a Pango::Layout to the current path in the specified cairo context.
-
#show_error_underline(cr, x, y, width, height) ⇒ nil
Draw a squiggly line in the specified cairo context that approximately covers the given rectangle in the style of an underline used to indicate a spelling error.
-
#show_glyph_item(cr, text, glyph_item) ⇒ nil
Draws the glyphs in glyph_item in the specified cairo context, embedding the text associated with the glyphs in the output if the output format supports it (PDF for example), otherwise it acts similar to pango_cairo_show_glyph_string().
-
#show_glyph_string(cr, font, glyphs) ⇒ nil
Draws the glyphs in glyphs in the specified cairo context.
-
#show_layout(cr, layout) ⇒ nil
Draws a Pango::Layout in the specified cairo context.
-
#show_layout_line(cr, line) ⇒ nil
Draws a Pango::LayoutLine in the specified cairo context.
-
#update_context(cr, context) ⇒ nil
Updates a Pango::Context previously created for use with Cairo to match the current transformation and target surface of a Cairo context.
-
#update_layout(cr, layout) ⇒ nil
Updates the private Pango::Context of a #PangoLayout created with pango_cairo_create_layout() to match the current transformation and target surface of a Cairo context.
Instance Method Details
#context_get_font_options(context) ⇒ cairo::FontOptions
Retrieves any font rendering options previously set with pango_cairo_context_set_font_options(). This function does not report options that are derived from the target surface by pango_cairo_update_context()
#context_get_resolution(context) ⇒ Float
Gets the resolution for the context. See pango_cairo_context_set_resolution()
#context_get_shape_renderer(context, data) ⇒ PangoCairo::ShapeRendererFunc
Sets callback function for context to use for rendering attributes of type %PANGO_ATTR_SHAPE. See Pango::CairoShapeRendererFunc for details.
Retrieves callback function and associated user data for rendering attributes of type %PANGO_ATTR_SHAPE as set by pango_cairo_context_set_shape_renderer(), if any.
#context_set_font_options(context, options) ⇒ nil
Sets the font options used when rendering text with this context. These options override any options that pango_cairo_update_context() derives from the target surface.
#context_set_resolution(context, dpi) ⇒ nil
Sets the resolution for the context. This is a scale factor between points specified in a Pango::FontDescription and Cairo units. The default value is 96, meaning that a 10 point font will be 13 units high. (10 * 96. / 72. = 13.3).
#context_set_shape_renderer(context, func, data, dnotify) ⇒ nil
Sets callback function for context to use for rendering attributes of type %PANGO_ATTR_SHAPE. See Pango::CairoShapeRendererFunc for details.
#create_context(cr) ⇒ Pango::Context
Creates a context object set up to match the current transformation and target surface of the Cairo context. This context can then be used to create a layout using pango_layout_new().
This function is a convenience function that creates a context using the default font map, then updates it to cr. If you just need to create a layout for use with cr and do not need to access Pango::Context directly, you can use pango_cairo_create_layout() instead.
#create_layout(cr) ⇒ Pango::Layout
Creates a layout 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 functions like pango_layout_get_size() or drawing with functions like pango_cairo_show_layout(). If you change the transformation or target surface for cr, you need to call pango_cairo_update_layout()
This function is the most convenient way to use Cairo with Pango, however it is slightly inefficient since it creates a separate Pango::Context object for each layout. This might matter in an application that was laying out large amounts of text.
#error_underline_path(cr, x, y, width, height) ⇒ nil
Add a squiggly line to the current path in the specified cairo context 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)
#font_map_get_default ⇒ Pango::FontMap
Gets a default Pango::CairoFontMap to use with Cairo.
Note that the type of the returned object will depend on the particular font backend Cairo was compiled to use; You generally should only use the Pango::FontMap and Pango::CairoFontMap interfaces on the returned object.
The default Cairo fontmap can be changed by using pango_cairo_font_map_set_default(). This can be used to change the Cairo font backend that the default fontmap uses for example.
Note that since Pango 1.32.6, the default fontmap is per-thread. Each thread gets its own default fontmap. In this way, PangoCairo can be used safely from multiple threads.
#font_map_new ⇒ Pango::FontMap
Creates a new Pango::CairoFontMap object; a fontmap is used to cache information about available fonts, and holds certain global parameters such as the resolution. In most cases, you can use pango_cairo_font_map_get_default() instead.
Note that the type of the returned object will depend on the particular font backend Cairo was compiled to use; You generally should only use the Pango::FontMap and Pango::CairoFontMap interfaces on the returned object.
You can override the type of backend returned by using an environment variable %PANGOCAIRO_BACKEND. Supported types, based on your build, are fc (fontconfig), win32, and coretext. If requested type is not available, NULL is returned. Ie. this is only useful for testing, when at least two backends are compiled in.
#font_map_new_for_font_type(fonttype) ⇒ Pango::FontMap
Creates a new Pango::CairoFontMap object of the type suitable to be used with cairo font backend of type fonttype.
In most cases one should simply use pango_cairo_font_map_new(), or in fact in most of those cases, just use pango_cairo_font_map_get_default().
#glyph_string_path(cr, font, glyphs) ⇒ nil
Adds the glyphs in glyphs to the current path in the specified cairo context. The origin of the glyphs (the left edge of the baseline) will be at the current point of the cairo context.
#layout_line_path(cr, line) ⇒ nil
Adds the text in Pango::LayoutLine 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.
#layout_path(cr, layout) ⇒ nil
Adds the text in a Pango::Layout to the current path in the specified cairo context. The top-left corner of the Pango::Layout will be at the current point of the cairo context.
#show_error_underline(cr, x, y, width, height) ⇒ nil
Draw a squiggly line in the specified cairo context 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)
#show_glyph_item(cr, text, glyph_item) ⇒ nil
Draws the glyphs in glyph_item in the specified cairo context, embedding the text associated with the glyphs in the output if the output format supports it (PDF for example), otherwise it acts similar to pango_cairo_show_glyph_string().
The origin of the glyphs (the left edge of the baseline) will be drawn at the current point of the cairo context.
Note that text is the start of the text for layout, which is then indexed by <literal>glyph_item->item->offset</literal>.
#show_glyph_string(cr, font, glyphs) ⇒ nil
Draws the glyphs in glyphs in the specified cairo context. The origin of the glyphs (the left edge of the baseline) will be drawn at the current point of the cairo context.
#show_layout(cr, layout) ⇒ nil
Draws a Pango::Layout in the specified cairo context. The top-left corner of the Pango::Layout will be drawn at the current point of the cairo context.
#show_layout_line(cr, line) ⇒ nil
Draws a Pango::LayoutLine in the specified cairo context. The origin of the glyphs (the left edge of the line) will be drawn at the current point of the cairo context.
#update_context(cr, context) ⇒ nil
Updates a Pango::Context 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 pango_layout_context_changed() on those layouts.
#update_layout(cr, layout) ⇒ nil
Updates the private Pango::Context of a #PangoLayout created with pango_cairo_create_layout() to match the current transformation and target surface of a Cairo context.