#include <GFont.h>
Public Member Functions | |
GDisplayString (GFont *f, char *s, int l=-1, int tabOrigin=0) | |
Constructor. | |
GDisplayString (GFont *f, char16 *s, int l=-1, int tabOrigin=0) | |
Constructor. | |
bool | ShowVisibleTab () |
void | ShowVisibleTab (bool i) |
void | TruncateWithDots (int Width) |
Fits string into 'width' pixels, truncating with '...' if it's not going to fit. | |
bool | IsTruncated () |
Returns true if the string is trucated. | |
int | Length () |
Returns the chars in the OsChar string. | |
void | Length (int NewLen) |
Sets the number of chars in the OsChar string. | |
operator OsChar * () | |
Returns the pointer to the native string. | |
int | X () |
Returns the width of the whole string. | |
int | Y () |
Returns the height of the whole string. | |
void | Size (int *x, int *y) |
Returns the width and height of the whole string. | |
int | CharAt (int x) |
Returns the number of characters that fit in 'x' pixels. | |
void | Draw (GSurface *pDC, int x, int y, GRect *r=0) |
Draws the string onto a device surface. |
To paint text onto the screen several stages need to be implemented to properly support unicode on multiple platforms. This class addresses all of those needs and then allows you to cache the results to reduce text related workload.
The first stage is converting text into the native format for the OS's API. This usually involved converting the text to wide characters for Linux or Windows, or Utf-8 for BeOS. Then the text is converted into runs of characters that can be rendered in the same font. If glyph substitution is required to render the characters a separate run is used with a different font ID. Finally you can measure or paint these runs of text. Also tab characters are expanded to the current tab size setting.
|
Constructor.
|
|
Constructor.
|
|
Draws the string onto a device surface.
|
|
Sets the ShowVisibleTab setting. Treats Unicode-2192 (left arrow) as a tab char |
|
Returns the ShowVisibleTab setting. Treats Unicode-2192 (left arrow) as a tab char |
|
Fits string into 'width' pixels, truncating with '...' if it's not going to fit.
|