载入中...
搜索中...
未找到

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
 
Fontoperator= (const Font &)=delete
 
font::FontDatagetData () const
 
TexturegetTexture () 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 GlyphfindGlyph (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.h32 行定义.

构造及析构函数说明

◆ Font() [1/2]

◆ ~Font()

eve::graphics::Font::~Font ( )
default

◆ Font() [2/2]

eve::graphics::Font::Font ( const Font )
delete

成员函数说明

◆ defaultCharset()

std::string eve::graphics::Font::defaultCharset ( )
static

Printable ASCII (0x20..0x7E), used when no explicit charset is given.

在文件 Font.cpp58 行定义.

引用了 c , 以及 s.

◆ findGlyph()

const Font::Glyph * eve::graphics::Font::findGlyph ( int  codepoint) const

Returns nullptr if codepoint isn't in this Font's atlas.

在文件 Font.cpp180 行定义.

被这些函数引用 eve::graphics::Graphics::print().

◆ getAscent()

float eve::graphics::Font::getAscent ( ) const

在文件 Font.cpp173 行定义.

引用了 eve::font::FontData::getAscent().

◆ getBaseline()

float eve::graphics::Font::getBaseline ( ) const

Distance from the top of a line to the baseline (== getAscent()).

在文件 Font.cpp174 行定义.

引用了 eve::font::FontData::getBaseline().

被这些函数引用 eve::graphics::Graphics::print().

◆ getData()

font::FontData * eve::graphics::Font::getData ( ) const
inline

在文件 Font.h43 行定义.

引用了 data.

被这些函数引用 eve::graphics::Graphics::print().

◆ getHeight()

float eve::graphics::Font::getHeight ( ) const

Line height in pixels at the FontData's decoded pixel size.

在文件 Font.cpp172 行定义.

引用了 eve::font::FontData::getLineHeight().

◆ getTexture()

Texture * eve::graphics::Font::getTexture ( ) const
inline

在文件 Font.h44 行定义.

被这些函数引用 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.

在文件 Font.cpp176 行定义.

引用了 eve::font::FontData::getWidth().

被这些函数引用 eve::card::printCentered().

◆ hasGlyph()

bool eve::graphics::Font::hasGlyph ( int  codepoint) const

Whether codepoint was rasterized into this Font's atlas.

在文件 Font.cpp178 行定义.

◆ operator=()

Font & eve::graphics::Font::operator= ( const Font )
delete

该类的文档由以下文件生成: