GPU-side font: wraps a decoded font::FontData and rasterizes a fixed set of codepoints into a single RGBA8 glyph atlas texture up front, so Graphics::print() can draw text with plain textured-quad draws.
更多...
#include <Font.h>
类 | |
| struct | Glyph |
Public 成员函数 | |
| Font (Graphics *gfx, font::FontData *data, std::string charset=defaultCharset()) | |
| ~Font () | |
| Font (const Font &)=delete | |
| Font & | operator= (const Font &)=delete |
| font::FontData * | getData () const |
| Texture * | getTexture () const |
| float | getHeight () const |
| Line height in pixels at the FontData's decoded pixel size. | |
| float | getAscent () const |
| float | getBaseline () const |
| Distance from the top of a line to the baseline (== getAscent()). | |
| float | getWidth (const std::string &text) const |
Pixel width of text (UTF-8), including kerning; delegates to FontData. | |
| bool | hasGlyph (int codepoint) const |
Whether codepoint was rasterized into this Font's atlas. | |
| const Glyph * | findGlyph (int codepoint) const |
Returns nullptr if codepoint isn't in this Font's atlas. | |
静态 Public 成员函数 | |
| static std::string | defaultCharset () |
| Printable ASCII (0x20..0x7E), used when no explicit charset is given. | |
详细描述
GPU-side font: wraps a decoded font::FontData and rasterizes a fixed set of codepoints into a single RGBA8 glyph atlas texture up front, so Graphics::print() can draw text with plain textured-quad draws.
Codepoints outside the pre-rasterized charset still advance the pen using FontData metrics (via FreeType) but are not drawn (no atlas entry). Does not take ownership of the FontData* passed to the constructor.
构造及析构函数说明
◆ Font() [1/2]
| eve::graphics::Font::Font | ( | Graphics * | gfx, |
| font::FontData * | data, | ||
| std::string | charset = defaultCharset() |
||
| ) |
引用了 a, eve::graphics::Font::Glyph::advance, b, eve::graphics::Font::Glyph::bearingX, eve::graphics::Font::Glyph::bearingY, data, eve::font::FontData::getGlyphAdvance(), eve::font::FontData::getGlyphBearingX(), eve::font::FontData::getGlyphBearingY(), h, eve::font::FontData::hasGlyph(), eve::graphics::Font::Glyph::height, idx, eve::font::FontData::newGlyphImageData(), eve::graphics::Graphics::newTexture(), eve::image::ImageData::paste(), eve::graphics::Font::Glyph::u0, eve::graphics::Font::Glyph::u1, eve::graphics::Font::Glyph::v0, eve::graphics::Font::Glyph::v1, w, eve::graphics::Font::Glyph::width, x , 以及 y.
◆ ~Font()
|
default |
◆ Font() [2/2]
|
delete |
成员函数说明
◆ defaultCharset()
|
static |
◆ findGlyph()
| const Font::Glyph * eve::graphics::Font::findGlyph | ( | int | codepoint | ) | const |
Returns nullptr if codepoint isn't in this Font's atlas.
被这些函数引用 eve::graphics::Graphics::print().
◆ getAscent()
| float eve::graphics::Font::getAscent | ( | ) | const |
◆ getBaseline()
| float eve::graphics::Font::getBaseline | ( | ) | const |
Distance from the top of a line to the baseline (== getAscent()).
引用了 eve::font::FontData::getBaseline().
被这些函数引用 eve::graphics::Graphics::print().
◆ getData()
|
inline |
◆ getHeight()
| float eve::graphics::Font::getHeight | ( | ) | const |
Line height in pixels at the FontData's decoded pixel size.
◆ getTexture()
|
inline |
被这些函数引用 eve::graphics::Graphics::print().
◆ getWidth()
| float eve::graphics::Font::getWidth | ( | const std::string & | text | ) | const |
Pixel width of text (UTF-8), including kerning; delegates to FontData.
引用了 eve::font::FontData::getWidth().
被这些函数引用 eve::card::printCentered().
◆ hasGlyph()
| bool eve::graphics::Font::hasGlyph | ( | int | codepoint | ) | const |
◆ operator=()
该类的文档由以下文件生成: