pango.FontMetrics
Prev | The pango Class Reference | Next

## pango.FontMetrics

pango.FontMetrics — an object containing overall metric information for a font.

## Synopsis

    class pango.FontMetrics(gobject.GBoxed):
        def get_ascent()
        def get_descent()
        def get_approximate_char_width()
        def get_approximate_digit_width()

## Description

A `pango.FontMetrics` object holds the overall metric information for a font. A `pango.FontMetrics` object is returned from the following methods:

- `pango.Context.get_metrics`()
- `pango.Font.get_metrics`()
- `pango.Fontset.get_metrics`()

## Methods

### pango.FontMetrics.get_ascent

        def get_ascent()

Returns : | the ascent in pango units. (1 point == `pango.SCALE` pango units.)

The `get_ascent`() method returns the font ascent in pango units where one font point is equal to pango.SCALE (1024) pango units. The ascent is the distance from the baseline to the logical top of a line of text. (The logical top may be above or below the top of the actual drawn ink. It is necessary to lay out the text to figure where the ink will be.)

### pango.FontMetrics.get_descent

        def get_descent()

Returns : | the descent in pango units. (1 point == `pango.SCALE` pango units.)

The `get_descent`() method returns the font descent in pango units where one font point is equal to pango.SCALE (1024) pango units. The descent is the distance from the baseline to the logical bottom of a line of text. (The logical bottom may be above or below the bottom of the actual drawn ink. It is necessary to lay out the text to figure where the ink will be.)

### pango.FontMetrics.get_approximate_char_width

        def get_approximate_char_width()

Returns : | the character width in pango units. (1 point == `pango.SCALE` pango units.)

The `get_approximate_char_width`() method returns the approximate character width for a font in pango units where one font point is equal to pango.SCALE (1024) pango units. This is merely a representative value that is useful, for example, for determining the initial size for a window. Actual characters in text will be wider and narrower than this.

### pango.FontMetrics.get_approximate_digit_width

        def get_approximate_digit_width()

Returns : | the digit width in pango units. (1 point == `pango.SCALE` pango units.)

The `get_approximate_digit_width`() method returns the approximate digit width for a font in pango units where one font point is equal to pango.SCALE (1024) pango units. This is merely a representative value that is useful, for example, for determining the initial size for a window. Actual digits in text can be wider and narrower than this, though this value is generally somewhat more accurate than the result of the `get_approximate_char_width`() method.

Prev | Up | Next
pango.FontMap | Home | pango.Fontset