Get the total width and height in pixels of a string taking into account the properties in okf.
int OkfGetTextSize( unsigned char *pStr, int *pWidth, int *pHeight );
Routine | Required Header |
OkfGetTextSize | "okf.h" |
Libraries
OKLIB.A | Oankali's GP32 run-time library |
Return Value
In case of success OkfGetTextSize returns 0, otherwise it returns -1. Look at okf.lastError for details on what happened.
If pStr is NULL or points to an empty string, OkfGetTextSize returns 0.
Parameters
pStr
A pointer to the string to be measured.
pHeight
A pointer to an integer where the height of the string will be returned.
pWidth
A pointer to an integer where the width of the string will be returned.
Remarks
This function measure the width and height of the string taking into account the properties settled in okf (font, character and line separation).
"\n" sequences are interpreted as a new line character as in standard printf C function. OkfGetTextSize returns the widest line of the text in pWidth, and the total height of all lines in the text in pHeight.
Note that left indent of first char and right indent of last char of a text line are not taken in account when calculating the width of the string. This way the width of the string is calculated with 100% accuracy.
See Also
OKF Font Engine Routines, OKF Font Engine Constants, OkfGetTextHeight, OkfGetTextWidth