pango.Font
Prev | The pango Class Reference | Next

## pango.Font

pango.Font — a rendering-system independent font representation.

## Synopsis

    class pango.Font(gobject.GObject):
        def describe()
        def get_metrics(language)
        def get_glyph_extents(glyph)
        def get_font_map()

    Functions

        def pango.PIXELS(size)
        def pango.ASCENT(rect)
        def pango.DESCENT(rect)
        def pango.RBEARING(rect)
        def pango.LBEARING(rect)

## Ancestry

    +-- gobject.GObject
      +-- pango.Font

## Description

A `pango.Font` object represents a font in a rendering-system independent way. A `pango.Font` is returned from the `pango.Context.load_font`(), `pango.FontSet.get_font`() and `pango.FontMap.load_font`()) methods.

## Methods

### pango.Font.describe

        def describe()

Returns : | a `pango.FontDescription` object.

The `describe`() method returns a description of the font in a `pango.FontDescription` object.

### pango.Font.get_metrics

        def get_metrics(language)

`language` : | a `pango.Language` that determines the script to get the metrics for, or `None` to get the metrics for the entire font.
Returns : | a `pango.FontMetrics` object.

The `get_metrics`() method returns a `pango.FontMetrics` object containing the metric information for a font using the `pango.Language` specified by `language` to limit the metrics to the script(s) used by `language`. If the value of `language` is `None`, the font metrics for the entire font is returned.

### pango.Font.get_glyph_extents

        def get_glyph_extents(glyph)

`glyph` : | the glyph index
Returns : | a 2-tuple containing two 4-tuples representing the ink and logical rectangles used to store the extents of `glyph` as drawn.

The `get_glyph_extents`() method returns a 2-tuple containing two 4-tuples representing the values of the logical and ink extent rectangles of the specified `glyph` within a font. The coordinate system for each rectangle has its origin at the base line and horizontal origin of the character with increasing coordinates extending to the right and down. The `pango.ASCENT()`, `pango.DESCENT()`, `pango.LBEARING()`, and `pango.RBEARING` functions can be used to convert from the extents rectangle to more traditional font metrics. The units of the rectangles are in `1/pango.SCALE` of a device unit.

### pango.Font.get_font_map

        def get_font_map()

Returns : | the `pango.FontMap` for the font

### Note

This method is available in PyGTK 2.10 and above.

Gets the font map for which the font was created.

## Functions

### pango.PIXELS

        def pango.PIXELS(size)

`size` : | the integer value to convert to pango pixels
Returns : | the pixel value

The `pango.PIXELS`() function converts and returns the integer value specified by `size` to pango pixels.

### pango.ASCENT

        def pango.ASCENT(rect)

`rect` : | a 4-tuple representing an extent rectangle's (x, y, width, height) value
Returns : | the ascent value of `rect`

The `pango.ASCENT`() function returns the ascent value of the extent rectangle specified by `rect`.

### pango.DESCENT

        def pango.DESCENT(rect)

`rect` : | a 4-tuple representing an extent rectangle's (x, y, width, height) value
Returns : | the descent value of `rect`

The `pango.DESCENT`() function returns the descent value of the extent rectangle specified by `rect`.

### pango.RBEARING

        def pango.RBEARING(rect)

`rect` : | a 4-tuple representing an extent rectangle's (x, y, width, height) value
Returns : | the right bearing value of `rect`

The `pango.RBEARING`() function returns the right bearing value of the extent rectangle specified by `rect`.

### pango.LBEARING

        def pango.LBEARING(rect)

`rect` : | a 4-tuple representing an extent rectangle's (x, y, width, height) value
Returns : | the left bearing value of `rect`

The `pango.LBEARING`() function returns the left bearing value of the extent rectangle specified by `rect`.

Prev | Up | Next
pango.Context | Home | pango.FontDescription