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

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::drawText() and Graphics::print() can draw text with plain textured-quad draws. 更多...

#include <Font.h>

类

struct  Glyph
 Glyph public API. 更多...
 

Public 成员函数

 Font (Graphics *gfx, font::FontData *data, std::string charset=defaultCharset())
 Font.
 
 ~Font ()
 Font.
 
 Font (const Font &)=delete
 
Font & operator= (const Font &)=delete
 
font::FontData * getData () const
 Returns the data.
 
Texture * getTexture () const
 Returns the texture.
 
float getHeight () const
 Line height in pixels at the FontData's decoded pixel size.
 
float getAscent () const
 Returns the ascent.
 
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::drawText() and 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.h 第 35 行定义.

构造及析构函数说明

◆ Font() [1/2]

◆ ~Font()

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

Font.

◆ 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.cpp 第 58 行定义.

引用了 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.cpp 第 180 行定义.

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

◆ getAscent()

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

Returns the ascent.

在文件 Font.cpp 第 173 行定义.

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

◆ getBaseline()

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

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

在文件 Font.cpp 第 174 行定义.

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

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

◆ getData()

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

Returns the data.

在文件 Font.h 第 49 行定义.

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

◆ getHeight()

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

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

在文件 Font.cpp 第 172 行定义.

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

◆ getTexture()

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

Returns the texture.

在文件 Font.h 第 51 行定义.

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

◆ getWidth()

float eve::graphics::Font::getWidth ( const std::string &  text) const

Pixel width of text (UTF-8), including kerning; delegates to FontData.

在文件 Font.cpp 第 176 行定义.

引用了 eve::font::FontData::getWidth() , 以及 text.

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

◆ hasGlyph()

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

Whether codepoint was rasterized into this Font's atlas.

在文件 Font.cpp 第 178 行定义.

◆ operator=()

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

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