blip  0.1
Font Class Reference

A TrueType font. More...

#include <Font.hpp>

Public Member Functions

 ~Font ()
 Destructor. More...
 
const char * getName () const
 Get the font name. More...
 
int getSize () const
 Get the font point size. More...
 
int getStyle () const
 Get the font style. More...
 
bool isBold () const
 Test if the font has a bold style. More...
 
bool isItalic () const
 Test if the font has an italic style. More...
 
int getGlyphCount () const
 Get the number of glyphs in the font. More...
 
const FontGlyphgetGlyph (char16_t c) const
 Get the glyph for the given Unicode character. More...
 
const FontGlyphgetGlyph (char c) const
 Get the glyph for the given ASCII character. More...
 
const FontGlyphgetGlyph (int c) const
 Get the glyph for the given Unicode character. More...
 
int getAscent () const
 Get the font's ascent, in pixels. More...
 
int getDescent () const
 Get the font's descent, in pixels. More...
 
int getHeight () const
 Get the font's height, in pixels. More...
 
int getMaxAdvance () const
 Get the font's maximum advance, in pixels. More...
 
const SizegetBoundingBox () const
 Get the font's global (maximum) glyph bounding box, in pixels. More...
 

Static Public Attributes

static const int PLAIN = 0
 Style constant indicating plain font. More...
 
static const int BOLD = 1 << 0
 Style constant indicating bold font. More...
 
static const int ITALIC = 1 << 1
 Style constant indicating italic font. More...
 

Detailed Description

A TrueType font.

The class exposes the metadata for the font, such as its name, style, and metrics, and maintains a cache of character glyphs.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ ~Font()

~Font ( )

Destructor.

Member Function Documentation

◆ getAscent()

int getAscent ( ) const
inline

Get the font's ascent, in pixels.

◆ getBoundingBox()

const Size& getBoundingBox ( ) const
inline

Get the font's global (maximum) glyph bounding box, in pixels.

◆ getDescent()

int getDescent ( ) const
inline

Get the font's descent, in pixels.

◆ getGlyph() [1/3]

const FontGlyph * getGlyph ( char16_t  c) const

Get the glyph for the given Unicode character.

Parameters
cThe character.
Returns
The glyph, or NULL if the font has no glyph for the character.

◆ getGlyph() [2/3]

const FontGlyph* getGlyph ( char  c) const
inline

Get the glyph for the given ASCII character.

Parameters
cThe character.
Returns
The glyph, or NULL if the font has no glyph for the character.

◆ getGlyph() [3/3]

const FontGlyph* getGlyph ( int  c) const
inline

Get the glyph for the given Unicode character.

Parameters
cThe character.
Returns
The glyph, or NULL if the font has no glyph for the character.

◆ getGlyphCount()

int getGlyphCount ( ) const

Get the number of glyphs in the font.

◆ getHeight()

int getHeight ( ) const
inline

Get the font's height, in pixels.

◆ getMaxAdvance()

int getMaxAdvance ( ) const
inline

Get the font's maximum advance, in pixels.

◆ getName()

const char * getName ( ) const

Get the font name.

◆ getSize()

int getSize ( ) const
inline

Get the font point size.

◆ getStyle()

int getStyle ( ) const

Get the font style.

The style is either Font::PLAIN, or a bitwise-or of the constants Font::BOLD and Font::ITALIC.

◆ isBold()

bool isBold ( ) const

Test if the font has a bold style.

◆ isItalic()

bool isItalic ( ) const

Test if the font has an italic style.

Member Data Documentation

◆ BOLD

const int BOLD = 1 << 0
static

Style constant indicating bold font.

◆ ITALIC

const int ITALIC = 1 << 1
static

Style constant indicating italic font.

◆ PLAIN

const int PLAIN = 0
static

Style constant indicating plain font.


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