CartoType C++ API 7.8.2, 2022-03-25
for Windows, Linux, Qt and other platforms supporting C++ development
Public Member Functions | List of all members
CartoType::TFont Class Reference

#include <cartotype_graphics_context.h>

Public Member Functions

 TFont ()=default
 
 TFont (std::shared_ptr< CEngine > aEngine)
 
 TFont (std::shared_ptr< CEngine > aEngine, const TFontSpec &aFontSpec)
 
void SetToSize (double aSize)
 
const TFontSpecFontSpec () const
 
void SetColor (TColor aColor)
 
TColor Color () const
 
TDrawResult DrawText (CGraphicsContext *aGc, const MString &aText, const TPoint &aOrigin, const TTextParam &aParam, TTextMetrics &aMetrics)
 
int32_t Size ()
 
const TFontMetricsMetrics ()
 
bool IsNull () const
 

Detailed Description

A font associates a font specification with a matching typeface.

Constructor & Destructor Documentation

◆ TFont() [1/3]

CartoType::TFont::TFont ( )
default

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

◆ TFont() [2/3]

CartoType::TFont::TFont ( std::shared_ptr< CEngine >  aEngine)
inline

Construct a font with default attributes.

◆ TFont() [3/3]

CartoType::TFont::TFont ( std::shared_ptr< CEngine >  aEngine,
const TFontSpec aFontSpec 
)
inline

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

Member Function Documentation

◆ Color()

TColor CartoType::TFont::Color ( ) const
inline

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

◆ DrawText()

TDrawResult CartoType::TFont::DrawText ( CGraphicsContext aGc,
const MString aText,
const TPoint aOrigin,
const TTextParam aParam,
TTextMetrics 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 TFontSpec & CartoType::TFont::FontSpec ( ) const
inline

Return the font specification used to construct this font.

◆ IsNull()

bool CartoType::TFont::IsNull ( ) const
inline

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

◆ Metrics()

const TFontMetrics & CartoType::TFont::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 CartoType::TFont::SetColor ( TColor  aColor)
inline

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

◆ SetToSize()

void CartoType::TFont::SetToSize ( double  aSize)
inline

Set 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 CartoType::TFont::Size ( )

Gets the size of a font in pixels per em.


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