Get the total width and height in pixels of a string taking into account the properties in okf.
int OkfGetTextWidth( unsigned char *pStr );
int OkfGetTextHeight( unsigned char *pStr );
Routine | Required Header |
OkfGetTextWidth | "okf.h" |
OkfGetTextHeight | "okf.h" |
Libraries
OKLIB.A | Oankali's GP32 run-time library |
Return Value
In case of success these functions return the width or height of the printed text pointed by pStr.
If pStr is NULL or points to an empty string, these functions return 0.
In case of error these functions return -1. Look at okf.lastError for details on what happened.
Parameters
pStr
A pointer to the string to be measured.
Remarks
These functions measure the width or 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. OkfGetTextWidth returns the widest line of the text. OkfGetTextHeight returns the total height of all lines in the text.
Note that left indent of first char and right indent of last char of a text line are not taken into account by OkfGetTextWidth when calculating the width of the string. This way the width of the string is calculated with 100% accuracy, but it can result in strange results when printing the characters of a line one by one using OkfGetTextWidth as a reference to get the next position of a char.
If you need to get the width and the height of a text, it is advised to use OkfGetTextSize as it is faster than call OkfGetTextWidth and OkfGetTextHeight successively.
See Also
OKF Font Engine Routines, OKF Font Engine Constants, OkfGetTextSize