Font

Class for loading and manipulating character fonts.

Fonts can be loaded from a file, from memory or from a custom stream, and supports the most common types of fonts.

See the loadFromFile function for the complete list of supported formats.

Once it is loaded, a Font instance provides three types of information about the font: - Global metrics, such as the line spacing - Per-glyph metrics, such as bounding box or kerning - Pixel representation of glyphs

Constructors

this
this()

Defines an empty font

this
this(sfFont* newFont)
Undocumented in source.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

getGlyph
Glyph getGlyph(dchar codePoint, uint characterSize, bool bold)

Retrieve a glyph of the font.

getKerning
int getKerning(dchar first, dchar second, uint characterSize)

Get the kerning offset of two glyphs.

getLineSpacing
int getLineSpacing(uint characterSize)

Get the line spacing.

getTexture
const(Texture) getTexture(uint characterSize)

Retrieve the texture containing the loaded glyphs of a certain size.

loadFromFile
bool loadFromFile(string filename)

Load the font from a file.

loadFromMemory
bool loadFromMemory(const(void)[] data)

Load the font from a file in memory.

loadFromStream
bool loadFromStream(InputStream stream)

Load the font from a custom stream.

Properties

dup
Font dup [@property getter]

Performs a deep copy on the font.

Variables

sfPtr
sfFont* sfPtr;
Undocumented in source.

See Also

Meta

Authors

Laurent Gomila, Jeremy DeHaan