CartoType C++ API 8.8-7-gb35e4dc71
for Windows, Linux, Qt and other platforms supporting C++ development
Public Member Functions | List of all members
CartoTypeCore::Font Class Reference

#include <cartotype_graphics_context.h>

Public Member Functions

 Font ()=default
 
 Font (std::shared_ptr< CEngine > aEngine)
 
 Font (std::shared_ptr< CEngine > aEngine, const FontSpec &aFontSpec)
 
void SetToSize (double aSize)
 
const CartoTypeCore::FontSpecFontSpec () const
 
void SetColor (Color aColor)
 
CartoTypeCore::Color Color () const
 
DrawResult DrawText (GraphicsContext *aGc, const MString &aText, const PointFP &aOrigin, const TextParam &aParam, TextMetrics &aMetrics)
 
bool CanDrawText (const MString &aText)
 
int32_t Size ()
 
const FontMetricsMetrics ()
 
bool IsNull () const
 

Detailed Description

A font associates a font specification with a matching typeface.

Constructor & Destructor Documentation

◆ Font() [1/3]

CartoTypeCore::Font::Font ( )
default

Constructs a null font. It cannot be used until another font has been assigned to it.

◆ Font() [2/3]

CartoTypeCore::Font::Font ( std::shared_ptr< CEngine >  aEngine)
inline

Constructs a font with default attributes.

◆ Font() [3/3]

CartoTypeCore::Font::Font ( std::shared_ptr< CEngine >  aEngine,
const FontSpec aFontSpec 
)
inline

Constructs a font that is the best available match for aFontSpec.

Member Function Documentation

◆ CanDrawText()

bool CartoTypeCore::Font::CanDrawText ( const MString aText)

Returns true if all required glyphs are available to draw some text.

◆ Color()

CartoTypeCore::Color CartoTypeCore::Font::Color ( ) const
inline

Returns the text color; if it's null (completely transparent) the graphic context's current color is used.

◆ DrawText()

DrawResult CartoTypeCore::Font::DrawText ( GraphicsContext aGc,
const MString aText,
const PointFP aOrigin,
const TextParam aParam,
TextMetrics aMetrics 
)

Draws or measures text. If aGc is null the text is measured, otherwise it is drawn into aGc. Drawing is controlled by aParam. Metrics are returned in aMetrics.

◆ FontSpec()

const CartoTypeCore::FontSpec & CartoTypeCore::Font::FontSpec ( ) const
inline

Returns the font specification used to construct this font.

◆ IsNull()

bool CartoTypeCore::Font::IsNull ( ) const
inline

Returns true if this is a null font, which cannot be used until another font has been assigned to it.

◆ Metrics()

const FontMetrics & CartoTypeCore::Font::Metrics ( )

Returns the metrics of the current instance (size, etc.,) of the font. If no instance has been set null metrics are returned.

◆ SetColor()

void CartoTypeCore::Font::SetColor ( Color  aColor)
inline

Sets the text color; if it's null (completely transparent) the graphic context's current color is used.

◆ SetToSize()

void CartoTypeCore::Font::SetToSize ( double  aSize)
inline

Sets the em size to aSize and set other components of the typeface instance's transformation to a plain scaling transformation, removing any slant, skew, stretch or rotation.

◆ Size()

int32_t CartoTypeCore::Font::Size ( )

Returns the size of a font in pixels per em.


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