The OpenD Programming Language

FONScontextInternal

FontStash context (internal definition). Don't use it derectly, it was made public only to generate documentation.

Postblit

A postblit is present on this object, but not explicitly documented in the source.

Members

Functions

addFallbackFont
bool addFallbackFont(int base, int fallback)

Add fallback font (FontStash will try to find missing glyph in all fallback fonts before giving up).

addFont
int addFont(const(char)[] name, const(char)[] path, bool defAA)

Add font to FontStash.

addFontMem
int addFontMem(const(char)[] name, ubyte* data, int dataSize, bool freeData, bool defAA)

Add font to FontStash, using data from memory.

addFontsFrom
void addFontsFrom(FONSContext source)

Add fonts from another FontStash.

clearState
void clearState()

Clear current state (i.e. set it to some sane defaults).

fontAscender
float fontAscender()

Returns font ascender (positive).

fontDescender
float fontDescender()

Returns font descender (negative).

fontHeight
float fontHeight()

Returns font line height.

getFontAA
bool getFontAA(int font)

Get AA for the current font, or for the specified font.

getFontByName
int getFontByName(const(char)[] name)

Returns font id corresponding to the given logical font name, or FONS_INVALID.

getLineBounds
void getLineBounds(float y, float* minyp, float* maxyp)

Returns line bounds. Any argument can be null if you aren't interested in its value.

getNameById
const(char)[] getNameById(int idx)

Returns logical font name corresponding to the given font id, or null.

Copy returned name, as name buffer can be invalidated by next FontStash API call!
getTextBounds
float getTextBounds(float x, float y, const(T)[] str, float[] bounds)

Measures the specified text string. Parameter bounds should be a float[4], if the bounding box of the text should be returned. The bounds value are [xmin, ymin, xmax, ymax] Returns the horizontal advance of the measured text (i.e. where the next character should drawn).

getVertMetrics
void getVertMetrics(float* ascender, float* descender, float* lineh)

Returns various font metrics. Any argument can be null if you aren't interested in its value.

hasFont
bool hasFont(const(char)[] name)

Check if FontStash has a font with the given name loaded.

popState
bool popState()

Pop current state. Returns false if state stack underflowed.

pushState
bool pushState()

Push current state. Returns false if state stack overflowed.

Static functions

create
FONSContext create(FONSParams params)

Create new FontStash context. It can be destroyed with fs.kill() later.

See Also

Meta