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

# Xfc::Pango::FontMetrics Class Reference

A PangoFontMetrics C++ wrapper class. More...

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

Inheritance diagram for Xfc::Pango::FontMetrics:

List of all members.

## Public Member Functions

Constructors

- FontMetrics (PangoFontMetrics *metrics)
    Construct a new font metrics from an existing PangoFontMetrics.
- FontMetrics (PangoFontMetrics *metrics, bool copy)
    Construct a new font metrics from an existing PangoFontMetrics.
- FontMetrics (const FontMetrics &src)
    Copy constructor.
- virtual ~FontMetrics ()
    Destructor.
- FontMetrics & operator= (const FontMetrics &src)
    Assignment operator.

Accessors

- PangoFontMetrics * pango_font_metrics () const
    Get a pointer to the PangoFontMetrics structure.
- operator PangoFontMetrics * () const
    Conversion operator; safely converts a FontMetrics to a PangoFontMetrics pointer.
- int get_ascent () const
    Returns the ascent from a font metrics structure.
- int get_descent () const
    Gets the descent from a font metrics structure.
- int get_approximate_char_width () const
    Gets the approximate character width for the font metrics structure.
- int get_approximate_digit_width () const
    Gets the approximate digit width for the font metrics structure.
- int get_underline_position () const
    Gets the suggested position to draw the underline.
- int get_underline_thickness () const
    Gets the suggested thickness to draw for the underline.
- int get_strikethrough_position () const
    Gets the suggested position to draw the strikethrough.
- int get_strikethrough_thickness () const
    Gets the suggested thickness to draw for the strikethrough.

## Detailed Description

A PangoFontMetrics C++ wrapper class.

FontMetrics structure holds the overall metric information for a font.

## Constructor & Destructor Documentation

Xfc::Pango::FontMetrics::FontMetrics | ( | PangoFontMetrics * | metrics | ) | `[explicit]`

Construct a new font metrics from an existing PangoFontMetrics.

Parameters:

  | metrics | A pointer to a PangoFontMetrics.

The metrics can be a newly created PangoFontMetrics or an existing PangoFontMetrics. The font metrics object created is a temporary object. It doesn't take over the ownership of PangoFontMetrics and PangoFontMetrics is not freed by the destructor.

Xfc::Pango::FontMetrics::FontMetrics | ( | PangoFontMetrics * | metrics,
|  | bool | copy
| ) |

Construct a new font metrics from an existing PangoFontMetrics.

Parameters:

  | metrics | A pointer to a PangoFontMetrics.
  | copy | Whether the FontMetrics object should make a copy of PangoFontMetrics or not.

The metrics can be a newly created PangoFontMetrics or an existing PangoFontMetrics. If copy is true FontMetrics will make a copy of PangoFontMetrics. If copy is false FontMetrics wont make a copy but instead takes over the ownership of PangoFontMetrics. Either way, the destructor will free PangoFontMetrics when the FontMetrics object is destroyed. This constructor is used by G::Boxed::wrap() to wrap PangoFontMetrics objects in a C++ wrapper.

Xfc::Pango::FontMetrics::FontMetrics | ( | const FontMetrics & | src | ) |

Copy constructor.

Parameters:

  | src | The source FontMetrics.

## Member Function Documentation

int Xfc::Pango::FontMetrics::get_approximate_char_width | ( |  | ) | const

Gets the approximate character width for the font metrics structure.

Returns:
  The character width, in pango units. (1 point == PANGO_SCALE pango units.)

This is merely a representative value useful, for example, for determining the initial size for a window. Actual characters in text will be wider and narrower than this.

int Xfc::Pango::FontMetrics::get_approximate_digit_width | ( |  | ) | const

Gets the approximate digit width for the font metrics structure.

Returns:
  The digit width, in pango units. (1 point == PANGO_SCALE pango units.)

This is merely a representative value useful, for example, for determining the initial size for a window. Actual digits in text can be wider and narrower than this.

int Xfc::Pango::FontMetrics::get_ascent | ( |  | ) | const

Returns the ascent from a font metrics structure.

Returns:
  The ascent, in pango units. (1 point == PANGO_SCALE 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.)

int Xfc::Pango::FontMetrics::get_descent | ( |  | ) | const

Gets the descent from a font metrics structure.

Returns:
  The descent, in pango units. (1 point == PANGO_SCALE 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.)

int Xfc::Pango::FontMetrics::get_strikethrough_position | ( |  | ) | const

Gets the suggested position to draw the strikethrough.

Returns:
  The suggested strikethrough position, in Pango units.

The value returned is the distance above the baseline of the top of the strikethrough.

int Xfc::Pango::FontMetrics::get_strikethrough_thickness | ( |  | ) | const

Gets the suggested thickness to draw for the strikethrough.

Returns:
  The suggested strikethrough thickness, in Pango units.

int Xfc::Pango::FontMetrics::get_underline_position | ( |  | ) | const

Gets the suggested position to draw the underline.

Returns:
  The suggested underline position, in Pango units.

The value returned is the distance above the baseline of the top of the underline. Since most fonts have underline positions beneath the baseline, this value is typically negative.

int Xfc::Pango::FontMetrics::get_underline_thickness | ( |  | ) | const

Gets the suggested thickness to draw for the underline.

Returns:
  The suggested underline thickness, in Pango units.

FontMetrics& Xfc::Pango::FontMetrics::operator= | ( | const FontMetrics & | src | ) |

Assignment operator.

Parameters:

  | src | The source FontMetrics.

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

- font.hh

Xfce Foundation Classes

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