Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Pango::Context Class Reference

A PangoLogAttr C++ wrapper class. More...

`#include <inti/pango/context.h>`

Inheritance diagram for Inti::Pango::Context:

List of all members.

## Public Member Functions

Constructors

- virtual ~Context ()
    Destructor.

Accessors

- PangoContext * pango_context () const
    Get a pointer to the PangoContext structure.
- operator PangoContext * () const
    Conversion operator; safely converts a Context to a PangoContext pointer.
- Pointer< FontMetrics > get_metrics (const FontDescription &desc, PangoLanguage *language) const
    Get the overall metric information for a particular font description.
- Pointer< FontDescription > get_font_description () const
    Retrieve the default font description for the context.
- PangoLanguage * get_language () const
    Retrieves the global language tag for the context.
- Direction get_base_dir () const
    Retrieves the base direction for the context.

Methods

- bool list_families (std::vector< FontFamily * > &families) const
    List all the families for the context's fontmap.
- Font * load_font (const FontDescription &desc) const
    Loads the font in one of the fontmaps in the context that is the closest match for desc.
- Fontset * load_fontset (const FontDescription &desc, PangoLanguage *language) const
    Load a set of fonts in the context that can be used to render a font matching desc.
- void set_font_description (const FontDescription &desc)
    Set the default font description for the context.
- void set_language (PangoLanguage *language)
    Sets the global language tag for the context.
- void set_base_dir (Direction direction)
    Sets the base direction for the context.
- std::vector< Pointer< Item > > itemize (const String &text, const AttrList &attrs) const
    Breaks a piece of text into segments with consistent directional level and shaping engine.
- std::vector< Pointer< Item > > itemize (const String &text, int start_index, int length, const AttrList &attrs, AttrIterator *cached_iter) const
    Breaks a piece of text into segments with consistent directional level and shaping engine.

GDK Pango Methods

- void set_colormap (const Gdk::Colormap &colormap)
    Sets the colormap to be used for drawing with the context.

## Static Public Member Functions

- Pointer< Pango::Context > get (const Gdk::Screen *screen=0)
    Creates a PangoContext for the specified screen.

## Protected Member Functions

Constructors

- Context (PangoContext *context, bool reference=true)
    Construct a new Context from an existing PangoContext.

## Detailed Description

A PangoLogAttr C++ wrapper class.

The Context object stores global information used to control the itemization process.

## Constructor & Destructor Documentation

Inti::Pango::Context::Context | ( | PangoContext * | context,
|  | bool | reference = true
| ) | `[explicit, protected]`

Construct a new Context from an existing PangoContext.

Parameters:

  context | A pointer to a PangoContext.
  reference | Set false if the initial reference count is floating, set true if it's not.

The context can be a newly created PangoContext or an existing PangoContext. (see G::Object::Object).

## Member Function Documentation

Pointer<Pango::Context> Inti::Pango::Context::get | ( | const Gdk::Screen * | screen = 0 | ) | `[static]`

Creates a PangoContext for the specified screen.

Parameters:

  screen | The Screen to get the context for, or null for the default screen.

Returns:
  a new PangoContext for screen

When using a Gtk::Widget, normally you should use Gtk::Widget::get_pango_context() instead of this function, to get the appropriate context for the widget you intend to render text onto.

Direction Inti::Pango::Context::get_base_dir | ( |  | ) | const

Retrieves the base direction for the context.

Returns:
  The base direction for the context.

Pointer<FontDescription> Inti::Pango::Context::get_font_description | ( |  | ) | const

Retrieve the default font description for the context.

Returns:
  A smart pointer to the context's default font description.

PangoLanguage* Inti::Pango::Context::get_language | ( |  | ) | const

Retrieves the global language tag for the context.

Returns:
  The global language tag.

Pointer<FontMetrics> Inti::Pango::Context::get_metrics | ( | const FontDescription & | desc,
|  | PangoLanguage * | language
| ) | const

Get the overall metric information for a particular font description.

Parameters:

  desc | A FontDescription.
  language | A language tag used to determine which script to get the metrics for, or null to indicate to get the metrics for the entire font.

Returns:
  A smart pointer to a FontMetrics object.

Since the metrics may be substantially different for different scripts, a language tag can be provided to indicate that the metrics should be retrieved that correspond to the script(s) used by that language.

The FontDescription is interpreted in the same way as by itemize(), and the family name may be a comma separated list of figures. If characters from multiple of these families would be used to render the string, then the returned fonts would be a composite of the metrics for the fonts loaded for the individual families.

std::vector<Pointer<Item> > Inti::Pango::Context::itemize | ( | const String & | text,
|  | int | start_index,
|  | int | length,
|  | const AttrList & | attrs,
|  | AttrIterator * | cached_iter
| ) | const

Breaks a piece of text into segments with consistent directional level and shaping engine.

Parameters:

  text | The text to itemize.
  start_index | The first byte in text to process.
  length | The number of bytes (not characters) to process after start_index. This must be >= 0.
  attrs | The set of attributes that apply to text.
  cached_iter | A cached attribute iterator, or null.

Returns:
  A vector of Pointer<Item>.

Each byte of text will be contained in exactly one of the items in the returned vector. The generated vector of items will be in logical order (the start offsets of the items are ascending).

cached_iter should be an iterator over attrs currently positioned at a range before or containing start_index; cached_iter will be advanced to the range covering the position just after start_index + length. (i.e. if itemizing in a loop, just keep passing in the same cached_iter).

std::vector<Pointer<Item> > Inti::Pango::Context::itemize | ( | const String & | text,
|  | const AttrList & | attrs
| ) | const

Breaks a piece of text into segments with consistent directional level and shaping engine.

Parameters:

  text | The text to itemize.
  attrs | The set of attributes that apply to text.

Returns:
  A vector of Pointer<Item>.

Each byte of text will be contained in exactly one of the items in the returned vector. The generated vector of items will be in logical order (the start offsets of the items are ascending).

bool Inti::Pango::Context::list_families | ( | std::vector< FontFamily * > & | families | ) | const

List all the families for the context's fontmap.

Parameters:

  families | A reference to a vector of FontFamily* to hold the font families.

Returns:
  true if the vector is not empty.

Font* Inti::Pango::Context::load_font | ( | const FontDescription & | desc | ) | const

Loads the font in one of the fontmaps in the context that is the closest match for desc.

Parameters:

  desc | A FontDescription describing the font to load.

Returns:
  The font loaded, or null if no font matched.

Fontset* Inti::Pango::Context::load_fontset | ( | const FontDescription & | desc,
|  | PangoLanguage * | language
| ) | const

Load a set of fonts in the context that can be used to render a font matching desc.

Parameters:

  desc | A FontDescription describing the fonts to load.
  language | A PangoLanguage the fonts will be used for.

Returns:
  The fontset, or null if no font matched.

void Inti::Pango::Context::set_base_dir | ( | Direction | direction | ) |

Sets the base direction for the context.

Parameters:

  direction | The new base direction.

void Inti::Pango::Context::set_colormap | ( | const Gdk::Colormap & | colormap | ) |

Sets the colormap to be used for drawing with the context.

Parameters:

  colormap | A Gdk::colormap.

If you obtained your context from Gtk::Widget::get_pango_context() or Gtk::Widget::create_pango_context(), the colormap will already be set to the colormap for the widget, so you shouldn't need this method.

void Inti::Pango::Context::set_font_description | ( | const FontDescription & | desc | ) |

Set the default font description for the context.

Parameters:

  desc | The new pango font description.

void Inti::Pango::Context::set_language | ( | PangoLanguage * | language | ) |

Sets the global language tag for the context.

Parameters:

  language | The new language tag.

The documentation for this class was generated from the following file:

- context.h

Main Page - Footer