Dgame.System.Font

« Go back

Bottom


struct Font;
Font is the low-level class for loading and manipulating character fonts. This class is meant to be used by Dgame.Graphic.Text.

Author:
Randy Schuett (rswhite4@googlemail.com)

enum ubyte DefaultSize;
The default size of every Font is 10

enum Style: int;
Available Font styles

Normal
Used to indicate regular, normal, plain rendering style.

Bold
Used to indicate bold rendering style.This is used in a bitmask along with other styles.

Italic
Used to indicate italicized rendering style.This is used in a bitmask along with other styles.

Underline
Used to indicate underlined rendering style.This is used in a bitmask along with other styles.

StrikeThrough
Used to indicate strikethrough rendering style.This is used in a bitmask along with other styles.

enum Mode: ubyte;
Available Font modes

Solid
Solid

Shaded
Shaded

Blended
Blended

nothrow @nogc this(string filename, ubyte fontSize);
CTor

nothrow @nogc bool loadFromFile(string filename, ubyte fontSize);
Load the font from a file. Returns if the loading was successful. If not, an error message is shown, which describes the problem. If the second parameter isn't 0, the current font size will be replaced with that. If the current size is also 0, the DefaultSize (10) will be used.

See:
DefaultSize

nothrow @nogc void setStyle(Style style);
Set the Font style.

See:
Font.Style enum

const nothrow @nogc Style getStyle();
Returns the current Font style.

See:
Font.Style enum

nothrow @nogc Surface render(string text, const Color4b fg, const Color4b bg, Mode mode = Mode.Solid);
Draws the text on a Surface by using this Font and the given Mode (default is Mode.Solid) The text (and the Surface) is colorized by fg / bg Color.

Note:
The background color is ignored if your mode is not Font.Mode.Shaded

Returns a Surface with the text or throws an Error


Page generated by Ddoc.

» Dgame.System.Font on Github

Top

« Go back