Abstract base class for a typeface, which corresponds to a single digital font file.
More...
#include <typeface.hpp>
|
| 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...
|
|
|
std::unordered_set< char32_t > | charset |
|
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.
◆ typeface() [1/2]
Creates a typeface, setting its style and weight.
- Parameters
-
style | Typeface style. |
weight | Typeface 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 |
◆ 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] | height | Height of the font, in pixels. |
[in] | code | UTF-32 character code of a glyph. |
[out] | bitmap | Glyph 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] | height | Height of the font, in pixels. |
[in] | first | UTF-32 character code of the first glyph. |
[in] | second | UTF-32 character code of the second glyph. |
[out] | offset | Kerning 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] | height | Height of the font, in pixels. |
[in] | code | UTF-32 character code of a glyph. |
[out] | metrics | Glyph 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] | height | Height of the font, in pixels. |
[out] | metrics | Font metrics. |
- Returns
true
if font metrics were returned, false
otherwise.
Implemented in type::ft_typeface.
◆ get_style()
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()
Sets the style of the typeface.
- Parameters
-
Definition at line 40 of file typeface.cpp.
◆ set_weight()
void type::typeface::set_weight |
( |
int |
weight | ) |
|
Sets the weight of the typeface.
- Parameters
-
Definition at line 45 of file typeface.cpp.
◆ charset
std::unordered_set<char32_t> type::typeface::charset |
|
protected |
The documentation for this class was generated from the following files: