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

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

#include <QtFontMetrics.hpp>

+ Inheritance diagram for CDPL::Vis::QtFontMetrics:

Public Member Functions

 QtFontMetrics (QPaintDevice *paint_dev=0)
 Constructs a font metrics object for Qt's default font and the given paint device. More...
 
 QtFontMetrics (const QtFontMetrics &)=delete
 
 ~QtFontMetrics ()
 Destructor. More...
 
QtFontMetricsoperator= (const QtFontMetrics &)=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 Qt rendering backend.

QtFontMetrics is implemented by wrapping a corresponding QFontMetrics instance created for the font specified by setFont(). For more information about QFontMetrics and the Qt Toolkit see [QTDOC].

Constructor & Destructor Documentation

◆ QtFontMetrics() [1/2]

CDPL::Vis::QtFontMetrics::QtFontMetrics ( QPaintDevice *  paint_dev = 0)

Constructs a font metrics object for Qt's default font and the given paint device.

Parameters
paint_devA pointer to the Qt paint device, or null if unspecified.

◆ QtFontMetrics() [2/2]

CDPL::Vis::QtFontMetrics::QtFontMetrics ( const QtFontMetrics )
delete

◆ ~QtFontMetrics()

CDPL::Vis::QtFontMetrics::~QtFontMetrics ( )

Destructor.

Member Function Documentation

◆ operator=()

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

◆ setFont()

void CDPL::Vis::QtFontMetrics::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::QtFontMetrics::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::QtFontMetrics::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::QtFontMetrics::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::QtFontMetrics::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::QtFontMetrics::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::QtFontMetrics::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::QtFontMetrics::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::QtFontMetrics::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: