#include <RE_Font.h>

Public Member Functions | |
| RE_Font (const char *name, float size=DEFAULT_FONTSIZE) | |
| virtual | ~RE_Font () |
| void | setFont (const char *name, float size) |
| Set the current font to name and size. Invalidates the current font. | |
| UT_String | getName () const |
| float | getSize () const |
| Get the size, in points, of this font. | |
| virtual void | render (RE_Render *r, const char *s)=0 |
| int | getDescender () |
| int | getHeight () |
| int | getCharWidth (char c) |
| virtual int | getCharWidth (char c, char prev)=0 |
| virtual int | getStringWidth (const char *s)=0 |
| Get the width of a string, including all kerning adjustments. | |
| int | getNumGlyphs () |
| void | wrapString (const char *src, UT_WorkBuffer &dest, int w, int h=-1) |
Protected Member Functions | |
| void | setFontName (const char *name) |
| virtual void | loadFont ()=0 |
| Override this to load your font and set myFontLoaded to true. | |
Protected Attributes | |
| UT_String | myFontName |
| The name of this font face. | |
| float | myFontSize |
| The size, in points, of this font. | |
| bool | myFontLoaded |
| int | myFontHeight |
| int | myDescender |
| int | myNumGlyphs |
Definition at line 33 of file RE_Font.h.
| RE_Font::RE_Font | ( | const char * | name, | |
| float | size = DEFAULT_FONTSIZE | |||
| ) |
Construct an RE_Font. name is the name of the font face you want to use, and size is the size in points you want to use.
| virtual RE_Font::~RE_Font | ( | ) | [virtual] |
| virtual int RE_Font::getCharWidth | ( | char | c, | |
| char | prev | |||
| ) | [pure virtual] |
Get the width, in pixels, of a particular character as laid out on the screen, including kerning. This is better thought of as answering the question "how far horizontally will the font renderer travel if it renders c after prev?"
Implemented in RE_OGLBitmapFont, and RE_OGLTextureFont.
| int RE_Font::getCharWidth | ( | char | c | ) | [inline] |
| int RE_Font::getDescender | ( | ) | [inline] |
| int RE_Font::getHeight | ( | ) | [inline] |
| UT_String RE_Font::getName | ( | void | ) | const [inline] |
Note that returning a UT_String usually isn't safe, but myFontName has been constructed with UT_String::ALWAYS_DEEP, so it won't cause any problems.
| int RE_Font::getNumGlyphs | ( | ) | [inline] |
| float RE_Font::getSize | ( | void | ) | const [inline] |
| virtual int RE_Font::getStringWidth | ( | const char * | s | ) | [pure virtual] |
Get the width of a string, including all kerning adjustments.
Implemented in RE_OGLBitmapFont, and RE_OGLTextureFont.
| virtual void RE_Font::loadFont | ( | ) | [protected, pure virtual] |
Override this to load your font and set myFontLoaded to true.
Implemented in RE_OGLBitmapFont, and RE_OGLTextureFont.
| virtual void RE_Font::render | ( | RE_Render * | r, | |
| const char * | s | |||
| ) | [pure virtual] |
Render string s using the position defined by the renderer r's raster X, Y, and Z, set with the RE_Render::textMove* functions. Implicitly updates the raster position to point at the end of the rendered text.
Implemented in RE_OGLBitmapFont, and RE_OGLTextureFont.
| void RE_Font::setFont | ( | const char * | name, | |
| float | size | |||
| ) |
Set the current font to name and size. Invalidates the current font.
| void RE_Font::setFontName | ( | const char * | name | ) | [protected] |
A helper function to set up myFontName correctly depending on whether name is non-NULL (set it to name) or NULL (set it to the default).
| void RE_Font::wrapString | ( | const char * | src, | |
| UT_WorkBuffer & | dest, | |||
| int | w, | |||
| int | h = -1 | |||
| ) |
This method wraps the string src to fit into a box of width w and height h. It takes into account the character height and width of this font. The string dest contains the wrapped text (
are inserted where necessary). If h is -1, then no limit is placed on height, otherwise your dest string may contain only the portion of the src string that fits in h.
int RE_Font::myDescender [protected] |
int RE_Font::myFontHeight [protected] |
bool RE_Font::myFontLoaded [protected] |
UT_String RE_Font::myFontName [protected] |
float RE_Font::myFontSize [protected] |
int RE_Font::myNumGlyphs [protected] |
1.5.9