Chemical Data Processing Library Python API - Version 1.1.1
Public Member Functions | List of all members
CDPL.Vis.CairoBackend.CairoFontMetrics Class Reference

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

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

Public Member Functions

None __init__ (cairo.Context cairo_ctxt)
 Constructs a font metrics object that operates on the Cairo drawing context specified by cairo_ctxt. More...
 
None setFont (Vis.Font font)
 Specifies the font for which to obtain the metrics. More...
 
float getAscent ()
 Returns the ascent of the font. More...
 
float getDescent ()
 Returns the descent of the font. More...
 
float getHeight ()
 Returns the height of the font. More...
 
float getLeading ()
 Returns the leading of the font. More...
 
float getWidth ()
 
float getBounds (str string, Vis.Rectangle2D bounds)
 
- Public Member Functions inherited from CDPL.Vis.FontMetrics
None __init__ ()
 Initializes the FontMetrics instance.
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
None setFont (Font font)
 Specifies the font for which to obtain the metrics. More...
 
float getWidth (str string)
 
None getBounds (str string, Rectangle2D bounds)
 

Additional Inherited Members

- Properties inherited from CDPL.Vis.FontMetrics
 objectID = property(getObjectID)
 

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

◆ __init__()

None CDPL.Vis.CairoBackend.CairoFontMetrics.__init__ ( cairo.Context  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 None.

Member Function Documentation

◆ setFont()

None CDPL.Vis.CairoBackend.CairoFontMetrics.setFont ( Vis.Font  font)

Specifies the font for which to obtain the metrics.

Parameters
fontSpecifies the font for which to retrieve the metrics.

◆ getAscent()

float CDPL.Vis.CairoBackend.CairoFontMetrics.getAscent ( )

Returns the ascent of the font.

The ascent is the maximum distance from the baseline to the highest position characters extend to. Some font designers break this rule, e.g. when they put more than one accent on top of a character, or to accommodate an unusual character in an exotic language, so it is possible (though rare) that this value will be too small.

Returns
The ascent of the font.
See also
getDescent()

Reimplemented from CDPL.Vis.FontMetrics.

◆ getDescent()

float CDPL.Vis.CairoBackend.CairoFontMetrics.getDescent ( )

Returns the descent of the font.

The descent is the distance from the baseline to the lowest position characters extend to. Some font designers break this rule, e.g. to accommodate an unusual character in an exotic language, so it is possible (though rare) that this value will be too small.

Returns
The descent of the font.
See also
getAscent()

Reimplemented from CDPL.Vis.FontMetrics.

◆ getHeight()

float CDPL.Vis.CairoBackend.CairoFontMetrics.getHeight ( )

Returns the height of the font.

The returned height is the sum of the ascent and descent plus some possible implementation dependent extra space.

Returns
The height of the font.

Reimplemented from CDPL.Vis.FontMetrics.

◆ getLeading()

float CDPL.Vis.CairoBackend.CairoFontMetrics.getLeading ( )

Returns the leading of the font.

The leading, or interline spacing, is the logical amount of space to be reserved between the descent of one line of text and the ascent of the next line.

Returns
The leading of the font.

Reimplemented from CDPL.Vis.FontMetrics.

◆ getWidth()

float CDPL.Vis.CairoBackend.CairoFontMetrics.getWidth ( )
Returns

◆ getBounds()

float CDPL.Vis.CairoBackend.CairoFontMetrics.getBounds ( str  string,
Vis.Rectangle2D  bounds 
)
Parameters
string
bounds
Returns