pango.GlyphString
Prev | The pango Class Reference | Next

## pango.GlyphString

pango.GlyphString — an object holding strings of glyphs and glyph information.

## Synopsis

    class pango.GlyphString(gobject.GBoxed):
        pango.GlyphString()
        def set_size(new_len)
        def copy()
        def extents(font)
        def extents_range(start, end, font)
        def get_logical_widths(text, embedding_level)

## Attributes

"num_glyphs" | Read | The number of glyphs in the glyph string.

## Description

A `pango.GlyphString` object contains strings of glyphs with geometry and visual attribute information.

## Constructor

        pango.GlyphString()

Returns : | a new `pango.GlyphString`

Creates a new `pango.GlyphString` containing no glyphs.

## Methods

### pango.GlyphString.set_size

        def set_size(new_len)

`new_len` : | the new length of the string.

The `set_size`() method resizes the glyph string to the length specified by `new_len`.

### pango.GlyphString.copy

        def copy()

Returns : | a `pango.GlyphString`

The `copy`() method returns a `pango.GlyphString` that is a copy of the glyph string.

### pango.GlyphString.extents

        def extents(font)

`font` : | a `pango.Font`
Returns : | a 2-tuple containing two 4-tuples representing the ink and logical extents rectangles of the glyph string.

The `extents`() method returns a 2-tuple containing two 4-tuples representing the logical and ink extents rectangles of the glyph string as rendered in the `pango.Font` specified by `font`. See the `pango.Font.get_glyph_extents`() for details about the interpretation of the rectangles.

### pango.GlyphString.extents_range

        def extents_range(start, end, font)

`start` : | start index
`end` : | end index
`font` : | a `pango.Font`
Returns : | a 2-tuple containing two 4-tuples representing the ink and logical extents rectangles of the glyph string range.

The `extents_range`() method returns a 2-tuple containing two 4-tuples representing the logical and ink extents rectangles of a range (specified by `start` and `end`) of the glyph string as rendered in the `pango.Font` specified by `font`. 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).

### pango.GlyphString.get_logical_widths

        def get_logical_widths(text, embedding_level)

`text` : | the text corresponding to the glyphs
`embedding_level` : | the embedding level of the string
Returns : | a list containing the calculated character widths.

The `get_logical_widths`() method returns a list of the screen width of the characters in the specified `text` that corresponds to the glyph string. When multiple characters compose a single cluster, the width of the entire cluster is divided equally among the characters.

Prev | Up | Next
pango.FontsetSimple | Home | pango.Language