Instance of font with specific size, weight, face, etc.
Access points to fonts.
font families enum
font weight constants (0..1000)
Hinting mode (currently supported for FreeType only)
find some suitable replacement for important characters missing in font
ID generator for glyphs
get glyph destroy callback (to cleanup OpenGL caches)
Set glyph destroy callback (to cleanup OpenGL caches) This callback is used to tell OpenGL glyph cache that glyph is not more used - to let OpenGL glyph cache delete texture if all glyphs in it are no longer used.
custom character properties - for char-by-char drawing of text string with different character color and style
font face properties item
font instance collection - utility class, for font manager implementations
Glyph image cache
helper to split text into several lines and draw it
default min font size for antialiased fonts (e.g. if 16 is set, for 16+ sizes antialiasing will be used, for sizes <=15 - antialiasing will be off)
constant for measureText maxWidth paramenter - to tell that all characters of text string should be measured.
Actual implementation is:
dlangui.graphics.ftfonts - FreeType based font manager.
dlangui.platforms.windows.w32fonts - Win32 API based font manager.
To enable OpenGL support, build with version(USE_OPENGL);
dlangui.graphics.drawbuf, DrawBuf, drawbuf, drawbuf.html
Synopsis:
import dlangui.graphics.fonts; // find suitable font of size 25, normal, preferrable Arial, or, if not available, any SansSerif font FontRef font = FontManager.instance.getFont(25, FontWeight.Normal, false, FontFamily.SansSerif, "Arial"); dstring sampleText = "Sample text to draw"d; // measure text string width and height (one line) Point sz = font.textSize(sampleText); // draw red text at center of DrawBuf buf font.drawText(buf, buf.width / 2 - sz.x/2, buf.height / 2 - sz.y / 2, sampleText, 0xFF0000);
Boost License 1.0
Vadim Lopatin, 2014
This module contains base fonts access interface and common implementation.
Font - base class for fonts.
FontManager - base class for font managers - provides access to available fonts.