QtCraft API C++ classes QML types Handbook

QcPixelFont Namespace

The 5 x 7 pixel font of the text on signs (decision E-766), drawn by the game itself like its textures: printable ASCII, the German umlauts and ß, a few accented letters, € and °; any other character shows as '?'. More...

Header: #include <clientcore/textures/QcPixelFont.h>

Classes

struct Glyph

Variables

const int glyphHeight
const int spaceWidth

Functions

int advance(char32_t character)
bool contains(char32_t character)
QcPixelFont::Glyph glyph(char32_t character)
int lineWidth(const QString &line)
QImage page(int page, int tileSize)
int pageCount()
QString pageName(int page)

Detailed Description

Its glyphs live in pages of the texture atlas (four glyphs in the 2 x 2 cells of 8 x 8 pixels of a 16 x 16 tile, white on transparent), so sign text is drawn with the entity pipeline like everything else. Glyphs are as wide as their pixels (proportional), one pixel apart; a space is three pixels wide.

Classes

class Glyph

Where a glyph is: its page, its cell in the page (0..3, row by row), the first column with pixels and the number of columns it takes (0 for a space). More...

Variable Documentation

const int QcPixelFont::glyphHeight

Pixel rows of a glyph.

const int QcPixelFont::spaceWidth

Width of a space in pixels.

Function Documentation

int QcPixelFont::advance(char32_t character)

Returns the pixels character takes on a line, the gap after it included.

bool QcPixelFont::contains(char32_t character)

Returns whether the font has its own glyph for character.

QcPixelFont::Glyph QcPixelFont::glyph(char32_t character)

Returns the glyph of character; '?' for characters the font lacks.

int QcPixelFont::lineWidth(const QString &line)

Returns the pixels line takes, without the gap after its last character.

QImage QcPixelFont::page(int page, int tileSize)

Returns page page as a tile of tileSize pixels (a multiple of 16), scaled without smoothing.

int QcPixelFont::pageCount()

Returns the number of glyph pages in the atlas.

QString QcPixelFont::pageName(int page)

Returns the atlas name of page ("qtcraft:glyphs_<n>"; no content texture can have it).