Module dlangui.graphics.fonts
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.
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);
See Also
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);
Classes
Name | Description |
---|---|
Font
|
Instance of font with specific size , weight , face , etc.
|
FontManager
|
Access points to fonts. |
Structs
Name | Description |
---|---|
CustomCharProps
|
custom character properties - for char-by-char drawing of text string with different character color and style
|
FontList
|
font instance collection - utility class, for font manager implementations |
GlyphCache
|
Glyph image cache |
Enums
Name | Description |
---|---|
FontFamily
|
font families enum |
FontWeight
|
font weight constants (0..1000) |
HintingMode
|
Hinting mode (currently supported for FreeType only) |
Global variables
Name | Type | Description |
---|---|---|
DEF_MIN_ANTIALIASED_FONT_SIZE
|
const(int)
|
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) |
MAX_WIDTH_UNSPECIFIED
|
immutable(int)
|
constant for measureText maxWidth paramenter - to tell that all characters of text string should be measured. |
UNICODE_HYPHEN
|
immutable(dchar)
|
|
UNICODE_NB_HYPHEN
|
immutable(dchar)
|
|
UNICODE_NO_BREAK_SPACE
|
immutable(dchar)
|
|
UNICODE_SOFT_HYPHEN_CODE
|
immutable(dchar)
|
|
UNICODE_ZERO_WIDTH_SPACE
|
immutable(dchar)
|
Aliases
Name | Type | Description |
---|---|---|
FontRef
|
Ref!(dlangui.graphics.fonts.Font)
|
Authors
Vadim Lopatin, coolreader.org@gmail.com
Copyright
Vadim Lopatin, 2014
License
Boost License 1.0