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

Abstract base class for a typeface, which corresponds to a single digital font file. More...

#include <typeface.hpp>

Inheritance diagram for type::typeface:
type::ft_typeface

Public Member Functions

 typeface (typeface_style style, int weight)
 Creates a typeface, setting its style and weight. More...
 
 typeface ()
 Creates an empty typeface. More...
 
virtual ~typeface ()=default
 Destroys a typeface. More...
 
void set_style (typeface_style style)
 Sets the style of the typeface. More...
 
void set_weight (int weight)
 Sets the weight of the typeface. More...
 
typeface_style get_style () const noexcept
 Returns the style of the typeface. More...
 
int get_weight () const noexcept
 Returns the weight of the typeface. More...
 
virtual bool has_kerning () const =0
 Returns true if the typeface contains kerning information, false otherwise. More...
 
virtual bool get_metrics (float height, font_metrics &metrics) const =0
 Gets metrics for a font of the specified size. More...
 
virtual bool get_metrics (float height, char32_t code, glyph_metrics &metrics) const =0
 Gets metrics for a glyph in a font of the specified size. More...
 
virtual bool get_bitmap (float height, char32_t code, std::vector< std::byte > &bitmap, std::uint32_t &bitmap_width, std::uint32_t &bitmap_height) const =0
 Gets a bitmap of a glyph in a font of the specified size. More...
 
virtual bool get_kerning (float height, char32_t first, char32_t second, math::fvec2 &offset) const =0
 Gets the kerning offset for a pair of glyphs. More...
 
const std::unordered_set< char32_t > & get_charset () const noexcept
 Returns the set of characters supported by the typeface. More...
 

Protected Attributes

std::unordered_set< char32_t > charset
 

Detailed Description

Abstract base class for a typeface, which corresponds to a single digital font file.

See also
type::font

Definition at line 49 of file typeface.hpp.

Constructor & Destructor Documentation

◆ typeface() [1/2]

type::typeface::typeface ( typeface_style  style,
int  weight 
)

Creates a typeface, setting its style and weight.

Parameters
styleTypeface style.
weightTypeface weight.

Definition at line 30 of file typeface.cpp.

◆ typeface() [2/2]

type::typeface::typeface ( )

Creates an empty typeface.

Definition at line 35 of file typeface.cpp.

◆ ~typeface()

virtual type::typeface::~typeface ( )
virtualdefault

Destroys a typeface.

Member Function Documentation

◆ get_bitmap()

virtual bool type::typeface::get_bitmap ( float  height,
char32_t  code,
std::vector< std::byte > &  bitmap,
std::uint32_t &  bitmap_width,
std::uint32_t &  bitmap_height 
) const
pure virtual

Gets a bitmap of a glyph in a font of the specified size.

Parameters
[in]heightHeight of the font, in pixels.
[in]codeUTF-32 character code of a glyph.
[out]bitmapGlyph bitmap data.
Returns
true if glyph bitmap data was returned, false otherwise.

Implemented in type::ft_typeface.

◆ get_charset()

const std::unordered_set<char32_t>& type::typeface::get_charset ( ) const
inlinenoexcept

Returns the set of characters supported by the typeface.

Definition at line 136 of file typeface.hpp.

◆ get_kerning()

virtual bool type::typeface::get_kerning ( float  height,
char32_t  first,
char32_t  second,
math::fvec2 offset 
) const
pure virtual

Gets the kerning offset for a pair of glyphs.

Parameters
[in]heightHeight of the font, in pixels.
[in]firstUTF-32 character code of the first glyph.
[in]secondUTF-32 character code of the second glyph.
[out]offsetKerning offset.
Returns
true if a kerning offset was returned, false otherwise.

Implemented in type::ft_typeface.

◆ get_metrics() [1/2]

virtual bool type::typeface::get_metrics ( float  height,
char32_t  code,
glyph_metrics metrics 
) const
pure virtual

Gets metrics for a glyph in a font of the specified size.

Parameters
[in]heightHeight of the font, in pixels.
[in]codeUTF-32 character code of a glyph.
[out]metricsGlyph metrics.
Returns
true if glyph metrics were returned, false otherwise.

Implemented in type::ft_typeface.

◆ get_metrics() [2/2]

virtual bool type::typeface::get_metrics ( float  height,
font_metrics metrics 
) const
pure virtual

Gets metrics for a font of the specified size.

Parameters
[in]heightHeight of the font, in pixels.
[out]metricsFont metrics.
Returns
true if font metrics were returned, false otherwise.

Implemented in type::ft_typeface.

◆ get_style()

typeface_style type::typeface::get_style ( ) const
inlinenoexcept

Returns the style of the typeface.

Definition at line 81 of file typeface.hpp.

◆ get_weight()

int type::typeface::get_weight ( ) const
inlinenoexcept

Returns the weight of the typeface.

Definition at line 87 of file typeface.hpp.

◆ has_kerning()

virtual bool type::typeface::has_kerning ( ) const
pure virtual

Returns true if the typeface contains kerning information, false otherwise.

Implemented in type::ft_typeface.

◆ set_style()

void type::typeface::set_style ( typeface_style  style)

Sets the style of the typeface.

Parameters
styleTypeface style.

Definition at line 40 of file typeface.cpp.

◆ set_weight()

void type::typeface::set_weight ( int  weight)

Sets the weight of the typeface.

Parameters
weightTypeface weight.

Definition at line 45 of file typeface.cpp.

Member Data Documentation

◆ charset

std::unordered_set<char32_t> type::typeface::charset
protected

Definition at line 142 of file typeface.hpp.


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