Declaration (see MWindow.h):
void drawText(const MString& text, const MRect& bBox, MTextJustifications tj = tjDefault);
Draws the specified text at the coordinates specified by bBox.
The text to draw.
Details: The string can include line-breaks and tab characters. Each tab character is replaced with 4 spaces before drawing the string.
The bounding box for the text.
Details: If bBox.p1() is an invalid MPoint (see MRect::p1), then nothing is drawn. Otherwise, bBox.p1() is transformed according to the latest setDrawTransform.
Justifies the text. i.e. adjusts its alignment relatively to bBox.
Details: The tj parameter affects the position of the painted text relatively to bBox.
The font and color of the text are determined by the latest setDrawTextSettings.
- See Painting functions for details about the coordinate system
- At this time only the horizontal solid text drawing is supported. Patterned, vertical, rotated, and distorted text drawing may be supported in the future versions
- This function may produce slightly different outputs on different computers, especially if they are running a different operating system or a different version of the system. This can be due to different installed fonts, a different handling of these fonts by the system, and so on. The differences are usually small and non-crucial. A good app should account for the fact that the painted text may appear slightly different and at a slightly different position. If the text's precise positioning is important (such as in MEditBox), it is recommended to use unbounded text (with the invalid size in bBox) because Elgrint is calibrated in a way that best matches the positioning of the unbounded text (calibrating for the bounded text is more difficult). The best results are achieved with the "Arial" font
Let us know
Please Contact us to report any errors on this page, or to suggest any improvements.