STLL  0.0
Simple Text Layouting Library
STLL::FontFamily_c Class Reference

a class contains all resources for a family of fonts More...

Public Member Functions

 FontFamily_c (std::shared_ptr< FontCache_c > c)
 Initialize an empty family, using the given font cache to get the fonts. More...
 
 FontFamily_c (void)
 Initialize an empty family, using font cache created specifically for this family. More...
 
Font_c getFont (uint32_t size, const std::string &style="normal", const std::string &variant="normal", const std::string &weight="normal", const std::string &stretch="normal")
 Get a font instance from the family. More...
 
void addFont (const FontResource_c &res, const std::string &style="normal", const std::string &variant="normal", const std::string &weight="normal", const std::string &stretch="normal")
 Add a font to the family. More...
 

Detailed Description

a class contains all resources for a family of fonts

A family is a set of fonts with roman, italics, bold, ... variants this class will store the resources to each font and create a FontFace_c for it, when requested.

Usually you don't need to use this class directly as the CSS stylesheet class TextStyleSheet_c will take care of this.

Constructor & Destructor Documentation

STLL::FontFamily_c::FontFamily_c ( std::shared_ptr< FontCache_c c)
inline

Initialize an empty family, using the given font cache to get the fonts.

STLL::FontFamily_c::FontFamily_c ( void  )
inline

Initialize an empty family, using font cache created specifically for this family.

This is normally not what you want as you will probably have more than one family and they all should use the same cache

Member Function Documentation

void STLL::FontFamily_c::addFont ( const FontResource_c res,
const std::string &  style = "normal",
const std::string &  variant = "normal",
const std::string &  weight = "normal",
const std::string &  stretch = "normal" 
)

Add a font to the family.

Parameters
resResource to use for this member of the font family
styleFont style, values are usually: "normal", "italic", "oblique"
variantFont variant, values are usually: "normal", "small-caps"
weightFont weight, typical values are: "lighter", "normal", "bold", "bolder"
stretchFont stretch, typical values are: "normal", "condensed"
Font_c STLL::FontFamily_c::getFont ( uint32_t  size,
const std::string &  style = "normal",
const std::string &  variant = "normal",
const std::string &  weight = "normal",
const std::string &  stretch = "normal" 
)

Get a font instance from the family.

Parameters
sizeSize in pixels
styleFont style, values are usually: "normal", "italic", "oblique"
variantFont variant, values are usually: "normal", "small-caps"
weightFont weight, typical values are: "lighter", "normal", "bold", "bolder"
stretchFont stretch, typical values are: "normal", "condensed"
Returns
a nullptr, when the requested face doesn't exist, the font otherwise

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