pangomm 2.48.1

Public Member Functions | Static Public Member Functions | Protected Attributes | Related Functions | List of all members
Pango::FontMetrics Class Reference

A Pango::FontMetrics holds the overall metric information for a font (possibly restricted to a script). More...

`#include <pangomm/fontmetrics.h>`

## Public Member Functions
| FontMetrics ()
| FontMetrics (PangoFontMetrics* gobject, bool make_a_copy=true)
| FontMetrics (const FontMetrics& other)
FontMetrics& | operator= (const FontMetrics& other)
| FontMetrics (FontMetrics&& other) noexcept
FontMetrics& | operator= (FontMetrics&& other) noexcept
| ~FontMetrics () noexcept
void | swap (FontMetrics& other) noexcept
PangoFontMetrics* | gobj ()
| Provides access to the underlying C instance. More...
const PangoFontMetrics* | gobj () const
| Provides access to the underlying C instance. More...
PangoFontMetrics* | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. More...
int | get_ascent () const
| Gets the ascent from a font metrics structure. More...
int | get_descent () const
| Gets the descent from a font metrics structure. More...
int | get_height () const
| Gets the line height from a font metrics structure. More...
int | get_approximate_char_width () const
| Gets the approximate character width for a font metrics structure. More...
int | get_approximate_digit_width () const
| Gets the approximate digit width for a font metrics structure. More...
int | get_underline_position () const
| Gets the suggested position to draw the underline. More...
int | get_underline_thickness () const
| Gets the suggested thickness to draw for the underline. More...
int | get_strikethrough_position () const
| Gets the suggested position to draw the strikethrough. More...
int | get_strikethrough_thickness () const
| Gets the suggested thickness to draw for the strikethrough. More...

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...

## Protected Attributes
PangoFontMetrics* | gobject_

## Related Functions
(Note that these are not member functions.)
void | swap (FontMetrics& lhs, FontMetrics& rhs) noexcept
Pango::FontMetrics | wrap (PangoFontMetrics* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Detailed Description

A Pango::FontMetrics holds the overall metric information for a font (possibly restricted to a script).

## Constructor & Destructor Documentation

## ◆ FontMetrics() [1/4]

Pango::FontMetrics::FontMetrics | ( |  | ) |

## ◆ FontMetrics() [2/4]

Pango::FontMetrics::FontMetrics | ( | PangoFontMetrics * | gobject,
|  | bool | make_a_copy = `true`
| ) |  |
| explicit

## ◆ FontMetrics() [3/4]

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

## ◆ FontMetrics() [4/4]

Pango::FontMetrics::FontMetrics | ( | FontMetrics&& | other | ) |
| noexcept

## ◆ ~FontMetrics()

Pango::FontMetrics::~FontMetrics | ( |  | ) |
| noexcept

## Member Function Documentation

## ◆ get_approximate_char_width()

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

Gets the approximate character width for a font metrics structure.

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.

Returns
  The character width, in Pango units.

## ◆ get_approximate_digit_width()

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

Gets the approximate digit width for a font metrics structure.

This is merely a representative value useful, for example, for determining the initial size for a window. Actual digits in text can be wider or narrower than this, though this value is generally somewhat more accurate than the result of get_approximate_char_width() for digits.

Returns
  The digit width, in Pango units.

## ◆ get_ascent()

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

Gets the ascent from a font metrics structure.

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.)

Returns
  The ascent, in Pango units.

## ◆ get_descent()

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

Gets the descent from a font metrics structure.

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.)

Returns
  The descent, in Pango units.

## ◆ get_height()

int Pango::FontMetrics::get_height | ( |  | ) | const

Gets the line height from a font metrics structure.

The line height is the distance between successive baselines in wrapped text.

If the line height is not available, 0 is returned.

Since pangomm 1.44:

Returns
  The height, in Pango units.

## ◆ get_strikethrough_position()

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

Gets the suggested position to draw the strikethrough.

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

Since pangomm 1.6:

Returns
  The suggested strikethrough position, in Pango units.

## ◆ get_strikethrough_thickness()

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

Gets the suggested thickness to draw for the strikethrough.

Since pangomm 1.6:

Returns
  The suggested strikethrough thickness, in Pango units.

## ◆ get_type()

static GType Pango::FontMetrics::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ get_underline_position()

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

Gets the suggested position to draw the underline.

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.

Since pangomm 1.6:

Returns
  The suggested underline position, in Pango units.

## ◆ get_underline_thickness()

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

Gets the suggested thickness to draw for the underline.

Since pangomm 1.6:

Returns
  The suggested underline thickness, in Pango units.

## ◆ gobj() [1/2]

PangoFontMetrics* Pango::FontMetrics::gobj | ( |  | ) |
| inline

Provides access to the underlying C instance.

## ◆ gobj() [2/2]

const PangoFontMetrics* Pango::FontMetrics::gobj | ( |  | ) | const
| inline

Provides access to the underlying C instance.

## ◆ gobj_copy()

PangoFontMetrics* Pango::FontMetrics::gobj_copy | ( |  | ) | const

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

## ◆ operator=() [1/2]

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

## ◆ operator=() [2/2]

FontMetrics& Pango::FontMetrics::operator= | ( | FontMetrics&& | other | ) |
| noexcept

## ◆ swap()

void Pango::FontMetrics::swap | ( | FontMetrics& | other | ) |
| noexcept

## Friends And Related Function Documentation

## ◆ swap()

void swap | ( | FontMetrics& | lhs,
|  | FontMetrics& | rhs
| ) |  |
| related

Parameters

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

## ◆ wrap()

Pango::FontMetrics wrap | ( | PangoFontMetrics * | 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

## ◆ gobject_

PangoFontMetrics* Pango::FontMetrics::gobject_
| protected