|
roo_display
API Documentation for roo_display
|
Abstract font interface. More...
#include <font.h>
Public Member Functions | |
| const FontMetrics & | metrics () const |
| Return font metrics. | |
| const FontProperties & | properties () const |
| Return font properties. | |
| virtual bool | getGlyphMetrics (char32_t code, FontLayout layout, GlyphMetrics *result) const =0 |
| Retrieve glyph metrics for a code point and layout. | |
| virtual int16_t | getKerning (char32_t left, char32_t right) const |
| Return kerning adjustment for a pair of code points. | |
| void | drawHorizontalString (const Surface &s, roo::string_view text, Color color) const |
| Draw a UTF-8 string horizontally using a string view. | |
| virtual void | drawHorizontalString (const Surface &s, const char *utf8_data, uint32_t size, Color color) const =0 |
| Draw a UTF-8 string horizontally. | |
| virtual void | drawGlyph (const Surface &s, char32_t code, FontLayout layout, Color color) const |
| Draw a single glyph. | |
| GlyphMetrics | getHorizontalStringMetrics (roo::string_view text) const |
| Return metrics of the specified UTF-8 string as if it were a single glyph. | |
| virtual GlyphMetrics | getHorizontalStringMetrics (const char *utf8_data, uint32_t size) const =0 |
| Return metrics of the specified UTF-8 string as if it were a single glyph. | |
| uint32_t | getHorizontalStringGlyphMetrics (roo::string_view text, GlyphMetrics *result, uint32_t offset, uint32_t max_count) const |
| Return metrics for consecutive glyphs in the UTF-8 string. | |
| virtual uint32_t | getHorizontalStringGlyphMetrics (const char *utf8_data, uint32_t size, GlyphMetrics *result, uint32_t offset, uint32_t max_count) const =0 |
| Return metrics for consecutive glyphs in the UTF-8 string. | |
| virtual | ~Font () |
Protected Member Functions | |
| void | init (FontMetrics metrics, FontProperties properties) |
|
virtual |
Draw a single glyph.
The default implementation supports horizontal layout and delegates to drawHorizontalString. Font implementations can override this for a faster path that avoids UTF-8 encoding.
Reimplemented in roo_display::FontAdafruitFixed5x7, roo_display::SmoothFont, and roo_display::SmoothFontV2.
Definition at line 8 of file font.cpp.
References color, drawHorizontalString(), and roo_display::kHorizontal.
|
pure virtual |
Draw a UTF-8 string horizontally.
Implemented in roo_display::FontAdafruitFixed5x7, roo_display::SmoothFont, and roo_display::SmoothFontV2.
|
inline |
Draw a UTF-8 string horizontally using a string view.
See https://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html
Definition at line 209 of file font.h.
References color, and drawHorizontalString().
Referenced by drawGlyph(), drawHorizontalString(), roo_display::TextLabel::drawTo(), roo_display::ClippedTextLabel::drawTo(), roo_display::StringViewLabel::drawTo(), and roo_display::ClippedStringViewLabel::drawTo().
|
pure virtual |
Retrieve glyph metrics for a code point and layout.
Implemented in roo_display::FontAdafruitFixed5x7, roo_display::SmoothFont, and roo_display::SmoothFontV2.
|
pure virtual |
Return metrics for consecutive glyphs in the UTF-8 string.
Implemented in roo_display::FontAdafruitFixed5x7, roo_display::SmoothFont, and roo_display::SmoothFontV2.
|
inline |
Return metrics for consecutive glyphs in the UTF-8 string.
Glyphs may overlap due to kerning. The number of glyphs written is limited by max_count. Returns the number of glyphs measured, which may be smaller than max_count if the input string is shorter.
Definition at line 242 of file font.h.
References getHorizontalStringGlyphMetrics().
Referenced by getHorizontalStringGlyphMetrics().
|
pure virtual |
Return metrics of the specified UTF-8 string as if it were a single glyph.
Implemented in roo_display::FontAdafruitFixed5x7, roo_display::SmoothFont, and roo_display::SmoothFontV2.
|
inline |
Return metrics of the specified UTF-8 string as if it were a single glyph.
Definition at line 228 of file font.h.
References getHorizontalStringMetrics().
Referenced by getHorizontalStringMetrics().
Return kerning adjustment for a pair of code points.
The returned value is in pixels and should be added to the base advance of the left glyph. Fonts without kerning can keep the default implementation.
Reimplemented in roo_display::SmoothFont, and roo_display::SmoothFontV2.
|
inlineprotected |
Definition at line 258 of file font.h.
References metrics(), and properties().
Referenced by roo_display::FontAdafruitFixed5x7::FontAdafruitFixed5x7(), roo_display::SmoothFont::SmoothFont(), and roo_display::SmoothFontV2::SmoothFontV2().
|
inline |
Return font metrics.
Definition at line 188 of file font.h.
Referenced by roo_display::SmoothFont::drawGlyph(), roo_display::SmoothFontV2::drawGlyph(), roo_display::SmoothFont::drawHorizontalString(), roo_display::SmoothFontV2::drawHorizontalString(), roo_display::SmoothFont::getGlyphMetrics(), roo_display::SmoothFontV2::getGlyphMetrics(), roo_display::SmoothFont::getHorizontalStringMetrics(), roo_display::SmoothFontV2::getHorizontalStringMetrics(), init(), roo_display::SmoothFont::GlyphMetadataReader::readMetrics(), and roo_display::SmoothFontV2::GlyphMetadataReader::readMetrics().
|
inline |