pangomm: Pango::Font Class Reference

A Pango::Font is used to represent a font in a rendering-system-independent matter. More...

#include <pangomm/font.h>

Inheritance diagram for Pango::Font:

Public Member Functions

 Font (Font&& src) noexcept
 
Fontoperator= (Font&& src) noexcept
 
 ~Font () noexcept override
 
PangoFont* gobj ()
 Provides access to the underlying C GObject. More...

 
const PangoFont* gobj () const
 Provides access to the underlying C GObject. More...

 
PangoFont* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...

 
FontDescription describe () const
 Returns a description of the font, with font size set in points. More...

 
FontDescription describe_with_absolute_size () const
 Returns a description of the font, with absolute font size set (in device units). More...

 
Glib::RefPtr< Coverageget_coverage (const Language& language) const
 Computes the coverage map for a given font and language tag. More...

 
FontMetrics get_metrics () const
 Gets overall metric information for a font. More...

 
FontMetrics get_metrics (const Language& language) const
 Gets overall metric information for a font. More...

 
void get_glyph_extents (Glyph glyph, Rectangle& ink_rect, Rectangle& logical_rect) const
 Gets the logical and ink extents of a glyph within a font. More...

 
Glib::RefPtr< FontMapget_font_map ()
 Gets the font map for which the font was created. More...

 
Glib::RefPtr< const FontMapget_font_map () const
 Gets the font map for which the font was created. More...

 
Glib::RefPtr< FontFaceget_face ()
 Gets the Pango::FontFace to which font belongs. More...

 
Glib::RefPtr< const FontFaceget_face () const
 Gets the Pango::FontFace to which font belongs. More...

 
bool has_char (gunichar wc) const
 Returns whether the font provides a glyph for this character. More...

 
Rectangle get_glyph_ink_extents (Glyph glyph) const
 Get the ink extents of a glyph within the font. More...

 
Rectangle get_glyph_logical_extents (Glyph glyph) const
 Gets the logical extents of a glyph within the font. More...

 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (Object &&src) noexcept
 
void * get_data (const QueryQuark &key)
 
void set_data (const Quark &key, void *data)
 
void set_data (const Quark &key, void *data, DestroyNotify notify)
 
void remove_data (const QueryQuark &quark)
 
void * steal_data (const QueryQuark &quark)
 
Glib::RefPtr< Glib::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
void set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
 
void get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
 
void set_property (const Glib::ustring &property_name, const PropertyType &value)
 
void get_property (const Glib::ustring &property_name, PropertyType &value) const
 
PropertyType get_property (const Glib::ustring &property_name) const
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
 
void freeze_notify ()
 
void thaw_notify ()
 
virtual void reference () const
 
virtual void unreference () const
 
GObject * gobj ()
 
const GObject * gobj () const
 
GObject * gobj_copy () const
 
- Public Member Functions inherited from sigc::trackable
 trackable () noexcept
 
 trackable (const trackable &src) noexcept
 
 trackable (trackable &&src) noexcept
 
 ~trackable ()
 
void add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
 
void notify_callbacks ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (trackable &&src) noexcept
 
void remove_destroy_notify_callback (notifiable *data) const
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...

 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Pango::Fontwrap (PangoFont* object, bool take_copy=false)
 A Glib::wrap() method for this object. More...

 

Additional Inherited Members

- Public Types inherited from Glib::Object
typedef void(*)(gpointer data DestroyNotify)
 
- Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify func_destroy_notify
 
- Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify func_destroy_notify
 
- Protected Member Functions inherited from Glib::Object
 Object ()
 
 Object (const Glib::ConstructParams &construct_params)
 
 Object (GObject *castitem)
 
 ~Object () noexcept override
 
- Protected Member Functions inherited from Glib::ObjectBase
 ObjectBase ()
 
 ObjectBase (const char *custom_type_name)
 
 ObjectBase (const std::type_info &custom_type_info)
 
 ObjectBase (ObjectBase &&src) noexcept
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 

Detailed Description

A Pango::Font is used to represent a font in a rendering-system-independent matter.

Constructor & Destructor Documentation

Pango::Font::Font ( Font&&  src)
noexcept
Pango::Font::~Font ( )
overridenoexcept

Member Function Documentation

FontDescription Pango::Font::describe ( ) const

Returns a description of the font, with font size set in points.

Use describe_with_absolute_size() if you want the font size in device units.

Returns
A newly-allocated Pango::FontDescription object.
FontDescription Pango::Font::describe_with_absolute_size ( ) const

Returns a description of the font, with absolute font size set (in device units).

Use describe() if you want the font size in points.

Since pangomm 1.14:
Returns
A newly-allocated Pango::FontDescription object.
Glib::RefPtr<Coverage> Pango::Font::get_coverage ( const Language language) const

Computes the coverage map for a given font and language tag.

Parameters
languageThe language tag.
Returns
A newly-allocated Pango::Coverage object.
Glib::RefPtr<FontFace> Pango::Font::get_face ( )

Gets the Pango::FontFace to which font belongs.

Since pangomm 1.46:
Returns
The Pango::FontFace.
Glib::RefPtr<const FontFace> Pango::Font::get_face ( ) const

Gets the Pango::FontFace to which font belongs.

Since pangomm 1.46:
Returns
The Pango::FontFace.
Glib::RefPtr<FontMap> Pango::Font::get_font_map ( )

Gets the font map for which the font was created.

Note that the font maintains a <firstterm>weak</firstterm> reference to the font map, so if all references to font map are dropped, the font map will be finalized even if there are fonts created with the font map that are still alive. In that case this function will return nullptr. It is the responsibility of the user to ensure that the font map is kept alive. In most uses this is not an issue as a Pango::Context holds a reference to the font map.

Since pangomm 1.10:
Returns
The Pango::FontMap for the font, or nullptr if font is nullptr.
Glib::RefPtr<const FontMap> Pango::Font::get_font_map ( ) const

Gets the font map for which the font was created.

Note that the font maintains a <firstterm>weak</firstterm> reference to the font map, so if all references to font map are dropped, the font map will be finalized even if there are fonts created with the font map that are still alive. In that case this function will return nullptr. It is the responsibility of the user to ensure that the font map is kept alive. In most uses this is not an issue as a Pango::Context holds a reference to the font map.

Since pangomm 1.10:
Returns
The Pango::FontMap for the font, or nullptr if font is nullptr.
void Pango::Font::get_glyph_extents ( Glyph  glyph,
Rectangle ink_rect,
Rectangle logical_rect 
) const

Gets the logical and ink extents of a 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 macros PANGO_ASCENT(), PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING 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.

Parameters
glyphThe glyph index.
ink_rectRectangle used to store the extents of the glyph as drawn.
logical_rectRectangle used to store the logical extents of the glyph.
Rectangle Pango::Font::get_glyph_ink_extents ( Glyph  glyph) const

Get the ink extents of a glyph within the font.

Parameters
glyphThe glyph index.
Returns
The extents of the glyph as drawn.
Rectangle Pango::Font::get_glyph_logical_extents ( Glyph  glyph) const

Gets the logical extents of a glyph within the font.

Parameters
glyphThe glyph index.
Returns
The logical extents of the glyph.
FontMetrics Pango::Font::get_metrics ( ) const

Gets overall metric information for a font.

The metrics may be substantially different for different scripts. However, this function overload returns the metrics for the entire font.

FontMetrics Pango::Font::get_metrics ( const Language language) const

Gets overall metric information for a font.

Since the metrics may be substantially different for different scripts, a language tag can be provided to indicate that the metrics should be retrieved that correspond to the script(s) used by that language.

Parameters
languageLanguage tag used to determine which script to get the metrics for.
Returns
A Pango::Metrics object.
static GType Pango::Font::get_type ( )
static

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

PangoFont* Pango::Font::gobj ( )
inline

Provides access to the underlying C GObject.

const PangoFont* Pango::Font::gobj ( ) const
inline

Provides access to the underlying C GObject.

PangoFont* Pango::Font::gobj_copy ( )

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

bool Pango::Font::has_char ( gunichar  wc) const

Returns whether the font provides a glyph for this character.

Since pangomm 1.44:
Parameters
wcA Unicode character.
Returns
true if font can render wc.
Font& Pango::Font::operator= ( Font&&  src)
noexcept

Friends And Related Function Documentation

Glib::RefPtr< Pango::Font > wrap ( PangoFont *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse 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.