DrawableFont

An interface representing a font that is drawn with custom facilities.

You might want OperatingSystemFont instead, which represents a font loaded and drawn by functions native to the operating system.

WARNING: I might still change this.

Members

Functions

cacheString
void cacheString(SimpleWindow window, Color foreground, Color background, string text)

Requests that the given string is added to the image cache. You should only do this rarely, but if you have a string that you know will be used over and over again, adding it to a cache can improve things (assuming the implementation actually has a cache; it is also valid for an implementation to implement this as a do-nothing method).

drawString
void drawString(ScreenPainter painter, Point upperLeft, char[] text)

Please note the point is upperLeft, NOT baseline! This is the point of a bounding box of the string.

Inherited Members

From MeasurableFont

isMonospace
bool isMonospace()

Returns true if it is a monospace font, meaning each of the glyphs (at least the ascii characters) have matching width and no kerning, so you can determine the display width of some strings by simply multiplying the string width by averageWidth.

averageWidth
int averageWidth()

The average width of glyphs in the font, traditionally equal to the width of the lowercase x. Can be used to estimate bounding boxes, especially if the font isMonospace.

height
int height()

The height of the bounding box of a line.

ascent
int ascent()

The maximum ascent of a glyph above the baseline.

descent
int descent()

The maximum descent of a glyph below the baseline. For example, how low the g might go.

stringWidth
int stringWidth(const(char)[] s, SimpleWindow window)

The display width of the given string, and if you provide a window, it will use it to make the pixel count on screen more accurate too, but this shouldn't generally be necessary.

Meta