Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Pango::Context Class Reference

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

`#include <xfc/pango/context.hh>`

Inheritance diagram for Xfc::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.
- FontMap * get_font_map () const
    Gets the Fontmap used to look up fonts for this context.
- 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.
- Pointer< Matrix > get_matrix () const
    Gets the transformation matrix that will be applied when rendering with the context (see set_matrix()).

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.
- void set_matrix (const Matrix *matrix)
    Sets the transformation matrix that will be applied when rendering with the context.
- std::vector< Pointer< Item > > itemize (const String &text, const AttrList &attrs, AttrIterator *cached_iter=0) const
    Breaks a piece of text into segments with consistent directional level and shaping engine.
- std::vector< Pointer< Item > > itemize (const char *text, int start_index, int length, const AttrList &attrs, AttrIterator *cached_iter=0) const
    Breaks a piece of text into segments with consistent directional level and shaping engine.
- std::vector< Pointer< Item > > itemize (Direction direction, const String &text, const AttrList &attrs, AttrIterator *cached_iter=0) const
    Breaks a piece of text into segments using the specified base direction.
- std::vector< Pointer< Item > > itemize (Direction direction, const char *text, int start_index, int length, const AttrList &attrs, AttrIterator *cached_iter=0) const
    Breaks a piece of text into segments using the specified base direction.

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

Accessors

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

## Protected Member Functions

Constructors

- Context (PangoContext *context, bool owns_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

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

  | Construct a new Context from an existing PangoContext. Parameters:
  | context | A pointer to a PangoContext.
  | owns_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> Xfc::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 Xfc::Pango::Context::get_base_dir | ( |  | ) | const

| Retrieves the base direction for the context. Returns: The base direction for the context.

Pointer<FontDescription> Xfc::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.

FontMap* Xfc::Pango::Context::get_font_map | ( |  | ) | const

| Gets the Fontmap used to look up fonts for this context. Returns: The font map for the Context.

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

| Retrieves the global language tag for the context. Returns: The global language tag.

Pointer<Matrix> Xfc::Pango::Context::get_matrix | ( |  | ) | const

| Gets the transformation matrix that will be applied when rendering with the context (see set_matrix()). Returns: The matrix, or null if no matrix has been set (which is the same as the identity matrix).

Pointer<FontMetrics> Xfc::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> > Xfc::Pango::Context::itemize | ( | Direction | direction,
|  | const char * | text,
|  | int | start_index,
|  | int | length,
|  | const AttrList & | attrs,
|  | AttrIterator * | cached_iter = `0`
| ) | const

  | Breaks a piece of text into segments using the specified base direction. Parameters:
  | direction | The base direction to use for bidirectional processing.
  | text | The text to itemize, starting at start_index
  | 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>. See itemize(const char*, int, int, const AttrList&, AttrIterator*).

std::vector<Pointer<Item> > Xfc::Pango::Context::itemize | ( | Direction | direction,
|  | const String & | text,
|  | const AttrList & | attrs,
|  | AttrIterator * | cached_iter = `0`
| ) | const

  | Breaks a piece of text into segments using the specified base direction. Parameters:
  | direction | The base direction to use for bidirectional processing.
  | text | The text to itemize.
  | attrs | The set of attributes that apply to text.
  | cached_iter | A cached attribute iterator, or null.
Returns: A vector of Pointer<Item>. See itemize(const String&, const AttrList&, AttrIterator*).

std::vector<Pointer<Item> > Xfc::Pango::Context::itemize | ( | const char * | text,
|  | int | start_index,
|  | int | length,
|  | const AttrList & | attrs,
|  | AttrIterator * | cached_iter = `0`
| ) | const

  | Breaks a piece of text into segments with consistent directional level and shaping engine. Parameters:
  | text | The text to itemize, starting at start_index
  | 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> > Xfc::Pango::Context::itemize | ( | const String & | text,
|  | const AttrList & | attrs,
|  | AttrIterator * | cached_iter = `0`
| ) | 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.
  | 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).

bool Xfc::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* Xfc::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* Xfc::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 Xfc::Pango::Context::set_base_dir | ( | Direction | direction | ) |

  | Sets the base direction for the context. Parameters:
  | direction | The new base direction.

void Xfc::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 Xfc::Pango::Context::set_font_description | ( | const FontDescription & | desc | ) |

  | Set the default font description for the context. Parameters:
  | desc | The new pango font description.

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

  | Sets the global language tag for the context. Parameters:
  | language | The new language tag.

void Xfc::Pango::Context::set_matrix | ( | const Matrix * | matrix | ) |

  | Sets the transformation matrix that will be applied when rendering with the context. Parameters:
  | matrix | A Pango::Matrix, or null to unset any existing matrix.
No matrix set is the same as setting the identity matrix. The reported metrics are in the user space coordinates before the application of the matrix, not device-space coordiantes after the application of the matrix. So, they don't scale with the matrix, though they may change slightly for different matrices, depending on how the text is fit to the pixel grid.

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

- context.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3