yage.resource.font
Authors:
Eric Poggel
License:
LGPL v3
- struct
Letter
;
- Stores a single rendered letter.
- dchar
letter
;
- unicode
letter
- short
top
;
- image
top
offset
- short
left
;
- image
left
offset
- short
advanceX
;
short
advanceY
;
- x and y distance in pixels required to move to the next letter after this one
- Image
image
;
- rendered
image
of this letter
- char[]
toString
(char[] lookaside = null);
- Get the utf8 representation of this letter.
Params:
char[] lookaside |
If specified, fill and return this buffer instead of allocating new memory on the heap. |
- class
Font
;
- An instance of a loaded
Font
.
Fonts are typically used to render strings of text to an image.
- this(char[] filename);
- Construct and load the font file specified by filename.
Params:
char[] filename |
Any font file supported by Freetype that exists in ResourceManager.paths. |
- this(ubyte[] data, char[] resourceName = "");
- Contstruct and load font file data directly from memory.
Params:
ubyte[] data |
|
char[] resourceName |
|
- void
clearCache
();
- Clear the cache of rendered letters.
Characters of text are cached after they're rendered.
This allows a tremendous speedup in for future calls, but uses a little extra memory.
Calling this function should not usually be necessary.
- Letter
getLetter
(dchar letter, int width, int height = 0, bool bold = false, bool italic = false);
- Get a Letter struct containing info and an image for a single letter.
Params:
text |
A string of text to render, must be unencoded unicode (dchar[]). |
int width |
The horizontal pixel size of the font to render. |
int height |
The vertical pixel size of the font to render, if 0 it will be the same as the width. |
bool bold |
Get a bold version of the letter. This is performed by compositing the same glyph multiple times
horizontally and then cached. |
bool italic |
Get an italicized version of the letter. This is performed by an image skew and then cached. |
- char[]
toString
();
- Return the font filename.
|