Main Page Namespaces Book

# Pango::GlyphString Class Reference

List of all members.

## Detailed Description

A Pango::GlyphString is used to store strings of glyphs with geometry and visual attribute information.

It can be measured or drawn to the screen.

## Public Member Functions

void | get_extents (int start, int end, const Glib::RefPtr<const Font>& font, Rectangle& ink_rect, Rectangle& logical_rect) const
| Computes the extents of a sub-portion of a glyph string.
void | get_extents (const Glib::RefPtr<const Font>& font, Rectangle& ink_rect, Rectangle& logical_rect) const
| Compute the logical and ink extents of a glyph string.
Glib::ArrayHandle<GlyphInfo> | get_glyphs () const
| Gharacter positions are computed by dividing up each cluster into equal portions.
Rectangle | get_ink_extents (int start, int end, const Glib::RefPtr<const Font>& font) const
| Computes the extents of a sub-portion of the glyph string as drawn.
Rectangle | get_ink_extents (const Glib::RefPtr<const Font>& font) const
| Computes the extents of the glyph string as drawn.
Rectangle | get_logical_extents (int start, int end, const Glib::RefPtr<const Font>& font) const
| Computes the logical extents of a sub-portion of the glyph string.
Rectangle | get_logical_extents (const Glib::RefPtr<const Font>& font) const
| Computes the logical extents of a sub-portion of the glyph string.
Glib::ArrayHandle<int> | get_logical_widths (const Glib::ustring& text, int embedding_level) const
| Determine the screen width corresponding to each character.
int | get_width () const
| Computes the logical width of the glyph string as can also be computed using pango_glyph_string_extents().
| GlyphString (const Glib::ustring& text, const Analysis& analysis)
| Construct a string of glyphs from a string of characters.
| GlyphString (const GlyphString& other)
| GlyphString (PangoGlyphString* gobject, bool make_a_copy=true)
| GlyphString ()
const PangoGlyphString* | gobj () const
| Provides access to the underlying C instance.
PangoGlyphString* | gobj ()
| Provides access to the underlying C instance.
PangoGlyphString* | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
int | index_to_x (const Glib::ustring& text, const Analysis& analysis, int index, bool trailing) const
| Converts from character position to x position.
GlyphString& | operator= (const GlyphString& other)
void | set_size (int new_len)
| Resize a glyph string to the given length.
void | swap (GlyphString& other)
void | x_to_index (const Glib::ustring& text, const Analysis& analysis, int x_pos, int& index, bool& trailing) const
| Convert from x offset to character position.
| ~GlyphString ()

## Protected Attributes

PangoGlyphString* | gobject_

## Related Functions

(Note that these are not member functions.)
void | swap (GlyphString& lhs, GlyphString& rhs)
Pango::GlyphString | wrap (PangoGlyphString* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Constructor & Destructor Documentation

Pango::GlyphString::GlyphString | ( |  | ) |

Pango::GlyphString::GlyphString | ( | PangoGlyphString * | gobject,
|  | bool | make_a_copy = `true` |
| ) |  |  | `[explicit]`

Pango::GlyphString::GlyphString | ( | const GlyphString& | other | ) |

Pango::GlyphString::~GlyphString | ( |  | ) |

Pango::GlyphString::GlyphString | ( | const Glib::ustring & | text,
|  | const Analysis& | analysis |
| ) |  |  |

Construct a string of glyphs from a string of characters.

Given a segment of text and the corresponding Pango::Analysis structure returned from Pango::Context::itemize(), convert the characters into glyphs. You may also pass in only a sub-string of the item.

Parameters:

  | text | The text to process. You must pass the same string into those member functions expecting a const Glib::ustring&.
  | analysis | The analysis information return from Pango::Context::itemize().

## Member Function Documentation

void Pango::GlyphString::get_extents | ( | int | start,
|  | int | end,
|  | const Glib::RefPtr<const Font>& | font,
|  | Rectangle& | ink_rect,
|  | Rectangle& | logical_rect |
| ) |  |  | const

Computes the extents of a sub-portion of a glyph string.

The extents are relative to the start of the glyph string range (the origin of their coordinate system is at the start of the range, not at the start of the entire glyph string).

Parameters:

  | start | Start index.
  | end | End index (the range is the set of bytes with indices such that start <= index < end).
  | font | A Pango::Font.
  | ink_rect | Rectangle used to store the extents of the glyph string range as drawn.
  | logical_rect | Rectangle used to store the logical extents of the glyph string range.

void Pango::GlyphString::get_extents | ( | const Glib::RefPtr<const Font>& | font,
|  | Rectangle& | ink_rect,
|  | Rectangle& | logical_rect |
| ) |  |  | const

Compute the logical and ink extents of a glyph string.

See the documentation for Pango::Font::get_glyph_extents() for details about the interpretation of the rectangles.

Parameters:

  | font | A Pango::Font.
  | ink_rect | Rectangle used to store the extents of the glyph string as drawn.
  | logical_rect | Rectangle used to store the logical extents of the glyph string.

Glib::ArrayHandle<GlyphInfo> Pango::GlyphString::get_glyphs | ( |  | ) | const

Gharacter positions are computed by dividing up each cluster into equal portions.

Returns:
  An array of Pango::GlyphInfo objects.

Rectangle Pango::GlyphString::get_ink_extents | ( | int | start,
|  | int | end,
|  | const Glib::RefPtr<const Font>& | font |
| ) |  |  | const

Computes the extents of a sub-portion of the glyph string as drawn.

Parameters:

  | start | The start index.
  | end | The end index.
  | font | A Panog::Font

Returns:
  The extents of the sub-portion of the glyph string as drawn.

Rectangle Pango::GlyphString::get_ink_extents | ( | const Glib::RefPtr<const Font>& | font | ) | const

Computes the extents of the glyph string as drawn.

Parameters:

  | font | A Pango::Font.

Returns:
  The extents of the glyph string as drawn.

Rectangle Pango::GlyphString::get_logical_extents | ( | int | start,
|  | int | end,
|  | const Glib::RefPtr<const Font>& | font |
| ) |  |  | const

Computes the logical extents of a sub-portion of the glyph string.

Parameters:

  | start | The start index.
  | end | The end index.
  | font | A Pango::Font.

Returns:
  The logical extents of the sub-portion of the glyph string.

Rectangle Pango::GlyphString::get_logical_extents | ( | const Glib::RefPtr<const Font>& | font | ) | const

Computes the logical extents of a sub-portion of the glyph string.

Parameters:

  | font | A Pango::Font.

Returns:
  The logical extents of the glyph string.

Glib::ArrayHandle<int> Pango::GlyphString::get_logical_widths | ( | const Glib::ustring & | text,
|  | int | embedding_level |
| ) |  |  | const

Determine the screen width corresponding to each character.

When multiple characters compose a single cluster, the width of the entire cluster is divided equally among the characters.

Parameters:

  | text | The text corresponding to the glyphs.
  | embedding_level | The embedding level of the string.

Returns:
  An array of integers representing the resulting character widths.

int Pango::GlyphString::get_width | ( |  | ) | const

Computes the logical width of the glyph string as can also be computed using pango_glyph_string_extents().

However, since this only computes the width, it's much faster. This is in fact only a convenience function that computes the sum of geometry.width for each glyph in the glyphs.

Returns:
  The logical width of the glyph string.

Since: 1.14.

const PangoGlyphString* Pango::GlyphString::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C instance.

References gobject_.

PangoGlyphString* Pango::GlyphString::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C instance.

References gobject_.

PangoGlyphString* Pango::GlyphString::gobj_copy | ( |  | ) | const

Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.

int Pango::GlyphString::index_to_x | ( | const Glib::ustring & | text,
|  | const Analysis& | analysis,
|  | int | index,
|  | bool | trailing |
| ) |  |  | const

Converts from character position to x position.

(X position is measured from the left edge of the run). Character positions are computed by dividing up each cluster into equal portions.

Parameters:

  | text | The text corresponding to the glyphs.
  | analysis | The analysis information return from Pango::Context::itemize().
  | index | The byte index within text.
  | trailing | Whether we should compute the result for the beginning or end of the character.

Returns:
  The x position.

GlyphString& Pango::GlyphString::operator= | ( | const GlyphString& | other | ) |

void Pango::GlyphString::set_size | ( | int | new_len | ) |

Resize a glyph string to the given length.

Parameters:

  | new_len | The new length of the string.

void Pango::GlyphString::swap | ( | GlyphString& | other | ) |

Referenced by swap().

void Pango::GlyphString::x_to_index | ( | const Glib::ustring & | text,
|  | const Analysis& | analysis,
|  | int | x_pos,
|  | int & | index,
|  | bool & | trailing |
| ) |  |  | const

Convert from x offset to character position.

Character positions are computed by dividing up each cluster into equal portions. In scripts where positioning within a cluster is not allowed (such as Thai), the returned value may not be a valid cursor position; the caller must combine the result with the logical attributes for the text to compute the valid cursor position.

Parameters:

  | text | The text corresponding to the glyphs.
  | analysis | The analysis information return from Pango::Context::itemize().
  | x_pos | The x offset (in thousands of a device unit).
  | index | The location to store calculated byte index within.
  | trailing | The location to store a boolean indicating whether the user clicked on the leading or trailing edge of the character.

## Friends And Related Function Documentation

void swap | ( | GlyphString& | lhs,
|  | GlyphString& | rhs |
| ) |  |  | `[related]`

Parameters:

  | lhs | The left-hand side
  | rhs | The right-hand side

References swap().

Pango::GlyphString wrap | ( | PangoGlyphString * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

## Member Data Documentation

PangoGlyphString* Pango::GlyphString::gobject_`[protected]`

Referenced by gobj().

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

- glyphstring.h