video.fontmanager
Font manager and text drawing code abstracted from the video driver.
- struct FontRenderer;
Used by VideoDriver implementations to draw a string.
- const pure @property uint height();
- void start();
Start drawing a string.
- const bool hasGlyph(const dchar c);
Determine if the glyph of a character is loaded.
Parameters:Returns:dchar c Character to check. True if the glyph is loaded, false otherwise.- void loadGlyph(VideoDriver driver, const dchar c);
Load glyph for a character.
Will render the glyph and create a texture for it.
Parameters:Throws:VideoDriver driver Video driver to use for texture creation. dchar c Character to load glyph for. TextureException if the glyph texture could not be created.- const(Texture*) glyph(const dchar c, out Vector2u offset);
- Parameters: Returns:
- Vector2u textSize(const string text);
Get size of text as it would be drawn in pixels.
Parameters:Returns:string text Text to get size of. Size of the text in X and Y. Y might be slightly imprecise.
- class FontManager;
Manages all font resources.
- this(VFSDir gameDir);
Construct the font manager, load default font.
Parameters:Throws:VFSDir gameDir Game data directory. FontException on failure.- void unloadTextures(VideoDriver driver);
Delete all glyph textures from the video driver.
Parameters:VideoDriver driver VideoDriver to unload textures from. - void reloadTextures(VideoDriver driver);
Load glyph textures back to the video driver.
Parameters:Throws:VideoDriver driver VideoDriver to load textures to. TextureException if the glyph textures could not be reloaded.- void font(string fontName, const bool forceLoad = false);
- Parameters:
- void fontSize(uint size, const bool forceLoad = false);
Set font size to use.
Parameters:uint size Font size to set. bool forceLoad Force the font size to be set right now and font loaded if it's not loaded yet. - FontRenderer renderer();
- const pure @property bool antialiasing();
- const pure @property bool kerning();