Antkeeper  0.0.1
Public Member Functions | Protected Attributes | List of all members
type::font Class Referenceabstract

Abstract base class for fonts. More...

#include <font.hpp>

Inheritance diagram for type::font:
type::bitmap_font

Public Member Functions

 font (const font_metrics &metrics)
 Creates a font and sets its metrics. More...
 
 font ()
 Creates an empty font. More...
 
virtual ~font ()
 Destroys a font. More...
 
virtual bool contains (char32_t code) const =0
 Returns true if the font contains a glyph with the given character code. More...
 
void kern (char32_t first, char32_t second, const math::fvec2 &offset)
 Sets the kerning offset for a pair of glyphs. More...
 
void set_font_metrics (const font_metrics &metrics)
 Sets the font metrics. More...
 
virtual const glyph_metricsget_glyph_metrics (char32_t code) const =0
 Returns metrics describing a glyph. More...
 
const math::fvec2get_kerning (char32_t first, char32_t second) const
 Returns the kerning offset for a pair of glyphs. More...
 
const kerning_tableget_kerning_table () const
 Returns the font's kerning table. More...
 
const font_metricsget_font_metrics () const
 Returns metrics describing the font. More...
 

Protected Attributes

font_metrics metrics
 
kerning_table kerning_table
 

Detailed Description

Abstract base class for fonts.

See also
type::font_metrics
type::glyph_metrics
type::bitmap_font

Definition at line 36 of file font.hpp.

Constructor & Destructor Documentation

◆ font() [1/2]

type::font::font ( const font_metrics metrics)

Creates a font and sets its metrics.

Parameters
metricsMetrics describing the font.

Definition at line 24 of file font.cpp.

◆ font() [2/2]

type::font::font ( )

Creates an empty font.

Definition at line 28 of file font.cpp.

◆ ~font()

type::font::~font ( )
virtual

Destroys a font.

Definition at line 31 of file font.cpp.

Member Function Documentation

◆ contains()

virtual bool type::font::contains ( char32_t  code) const
pure virtual

Returns true if the font contains a glyph with the given character code.

Parameters
codeUTF-32 character code of a glyph.
Returns
true if the font contains the glyph, false otherwise.

Implemented in type::bitmap_font.

◆ get_font_metrics()

const font_metrics & type::font::get_font_metrics ( ) const
inline

Returns metrics describing the font.

Definition at line 109 of file font.hpp.

◆ get_glyph_metrics()

virtual const glyph_metrics& type::font::get_glyph_metrics ( char32_t  code) const
pure virtual

Returns metrics describing a glyph.

Parameters
codeUTF-32 character code of a glyph.
Returns
Metrics describing the glyph.

Implemented in type::bitmap_font.

◆ get_kerning()

const math::fvec2 & type::font::get_kerning ( char32_t  first,
char32_t  second 
) const

Returns the kerning offset for a pair of glyphs.

Parameters
firstUTF-32 character code of the first glyph.
secondUTF-32 character code of the second glyph.
Returns
Kerning offset.

Definition at line 44 of file font.cpp.

◆ get_kerning_table()

const kerning_table & type::font::get_kerning_table ( ) const
inline

Returns the font's kerning table.

Definition at line 104 of file font.hpp.

◆ kern()

void type::font::kern ( char32_t  first,
char32_t  second,
const math::fvec2 offset 
)

Sets the kerning offset for a pair of glyphs.

Parameters
firstUTF-32 character code of the first glyph.
secondUTF-32 character code of the second glyph.
offsetKerning offset.

Definition at line 34 of file font.cpp.

◆ set_font_metrics()

void type::font::set_font_metrics ( const font_metrics metrics)

Sets the font metrics.

Parameters
metricsFont metrics.

Definition at line 39 of file font.cpp.

Member Data Documentation

◆ kerning_table

kerning_table type::font::kerning_table
protected

Definition at line 101 of file font.hpp.

◆ metrics

font_metrics type::font::metrics
protected

Definition at line 100 of file font.hpp.


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