Chemical Data Processing Library C++ API - Version 1.4.0
Public Member Functions | List of all members
CDPL::Vis::CairoFontMetrics Class Reference

Implements the FontMetrics interface for the Cairo rendering backend. More...

#include <CairoFontMetrics.hpp>

+ Inheritance diagram for CDPL::Vis::CairoFontMetrics:

Public Member Functions

 CairoFontMetrics (const CairoPointer< cairo_t > &cairo_ctxt)
 Constructs a font metrics object that operates on the Cairo drawing context specified by cairo_ctxt. More...
 
 CairoFontMetrics (const CairoFontMetrics &)=delete
 
 ~CairoFontMetrics ()
 Destructor. More...
 
CairoFontMetricsoperator= (const CairoFontMetrics &)=delete
 
void setFont (const Font &font)
 Specifies the font to use for the calculation of text metrics. More...
 
double getAscent () const
 Returns the ascent of the current font. More...
 
double getDescent () const
 Returns the descent of the current font. More...
 
double getHeight () const
 Returns the height of the current font. More...
 
double getLeading () const
 Returns the leading of the current font. More...
 
double getWidth (const std::string &str) const
 Returns the total advance width of the rendered string str in the current font. More...
 
double getWidth (char ch) const
 Returns the advance width of the rendered character ch in the current font. More...
 
void getBounds (const std::string &str, Rectangle2D &bounds) const
 Computes the tight bounding rectangle of the rendered string str in the current font. More...
 
void getBounds (char ch, Rectangle2D &bounds) const
 Computes the tight bounding rectangle of the rendered character ch in the current font. More...
 
- Public Member Functions inherited from CDPL::Vis::FontMetrics
virtual ~FontMetrics ()
 Virtual destructor. More...
 

Detailed Description

Implements the FontMetrics interface for the Cairo rendering backend.

For more information about the Cairo 2D Graphics Library see [CAIRO].

Constructor & Destructor Documentation

◆ CairoFontMetrics() [1/2]

CDPL::Vis::CairoFontMetrics::CairoFontMetrics ( const CairoPointer< cairo_t > &  cairo_ctxt)

Constructs a font metrics object that operates on the Cairo drawing context specified by cairo_ctxt.

Parameters
cairo_ctxtThe Cairo drawing context.
Exceptions
Base::NullPointerExceptionif cairo_ctxt is null.

◆ CairoFontMetrics() [2/2]

CDPL::Vis::CairoFontMetrics::CairoFontMetrics ( const CairoFontMetrics )
delete

◆ ~CairoFontMetrics()

CDPL::Vis::CairoFontMetrics::~CairoFontMetrics ( )

Destructor.

Member Function Documentation

◆ operator=()

CairoFontMetrics& CDPL::Vis::CairoFontMetrics::operator= ( const CairoFontMetrics )
delete

◆ setFont()

void CDPL::Vis::CairoFontMetrics::setFont ( const Font font)
virtual

Specifies the font to use for the calculation of text metrics.

Parameters
fontThe font used for the calculation of text metrics.

Implements CDPL::Vis::FontMetrics.

◆ getAscent()

double CDPL::Vis::CairoFontMetrics::getAscent ( ) const
virtual

Returns the ascent of the current font.

Returns
The ascent of the current font.

Implements CDPL::Vis::FontMetrics.

◆ getDescent()

double CDPL::Vis::CairoFontMetrics::getDescent ( ) const
virtual

Returns the descent of the current font.

Returns
The descent of the current font.

Implements CDPL::Vis::FontMetrics.

◆ getHeight()

double CDPL::Vis::CairoFontMetrics::getHeight ( ) const
virtual

Returns the height of the current font.

Returns
The height of the current font.

Implements CDPL::Vis::FontMetrics.

◆ getLeading()

double CDPL::Vis::CairoFontMetrics::getLeading ( ) const
virtual

Returns the leading of the current font.

Returns
The leading of the current font.

Implements CDPL::Vis::FontMetrics.

◆ getWidth() [1/2]

double CDPL::Vis::CairoFontMetrics::getWidth ( const std::string &  str) const
virtual

Returns the total advance width of the rendered string str in the current font.

Parameters
strThe string for which to retrieve the total advance width.
Returns
The total advance width of str.

Implements CDPL::Vis::FontMetrics.

◆ getWidth() [2/2]

double CDPL::Vis::CairoFontMetrics::getWidth ( char  ch) const
virtual

Returns the advance width of the rendered character ch in the current font.

Parameters
chThe character for which to retrieve the advance width.
Returns
The advance width of ch.

Implements CDPL::Vis::FontMetrics.

◆ getBounds() [1/2]

void CDPL::Vis::CairoFontMetrics::getBounds ( const std::string &  str,
Rectangle2D bounds 
) const
virtual

Computes the tight bounding rectangle of the rendered string str in the current font.

Parameters
strThe string for which to compute the bounding rectangle.
boundsThe Rectangle2D instance receiving the result.

Implements CDPL::Vis::FontMetrics.

◆ getBounds() [2/2]

void CDPL::Vis::CairoFontMetrics::getBounds ( char  ch,
Rectangle2D bounds 
) const
virtual

Computes the tight bounding rectangle of the rendered character ch in the current font.

Parameters
chThe character for which to compute the bounding rectangle.
boundsThe Rectangle2D instance receiving the result.

Implements CDPL::Vis::FontMetrics.


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