Text Functions

Windows GDI+ exposes a flat API that consists of about 600 functions, which are implemented in Gdiplus.dll and declared in Gdiplusflat.h. The functions in the GDI+ flat API are wrapped by a collection of about 40 C++ classes. It is recommended that you do not directly call the functions in the flat API. Whenever you make calls to GDI+, you should do so by calling the methods and functions provided by the C++ wrappers. Microsoft Product Support Services will not provide support for code that calls the flat API directly. For more information on using these wrapper methods, see GDI+ Flat API. The following flat API functions are wrapped by the Graphics Text C++ class.

Text Functions and Corresponding Wrapper Methods

Flat function Wrapper method Remarks
GpStatus WINGDIPAPI GdipDrawString( GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, GDIPCONST GpBrush *brush )
Status Graphics::DrawString( IN const WCHAR *string, IN INT length, IN const Font *font, IN const RectF &layoutRect, IN const StringFormat *stringFormat, IN const Brush *brush )
Draws a string based on a font, a layout rectangle, and a format.
GpStatus WINGDIPAPI GdipMeasureString( GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, RectF *boundingBox, INT *codepointsFitted, INT *linesFilled )
Status Graphics::MeasureString( IN const WCHAR *string, IN INT length, IN const Font *font, IN const RectF &layoutRect, IN const StringFormat *stringFormat, OUT RectF *boundingBox, OUT INT *codepointsFitted = 0, OUT INT *linesFilled = 0 ) const
Measures the extent of the string in the specified font, format, and layout rectangle.
GpStatus WINGDIPAPI GdipMeasureCharacterRanges( GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF &layoutRect, GDIPCONST GpStringFormat *stringFormat, INT regionCount, GpRegion **regions )
Status Graphics::MeasureCharacterRanges( IN const WCHAR *string, IN INT length, IN const Font *font, IN const RectF &layoutRect, IN const StringFormat *stringFormat, IN INT regionCount, OUT Region *regions ) const
Gets a set of regions each of which bounds a range of character positions within a string.
GpStatus WINGDIPAPI GdipDrawDriverString( GpGraphics *graphics, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, GDIPCONST GpBrush *brush, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix )
Status Graphics::DrawDriverString( IN const UINT16 *text, IN INT length, IN const Font *font, IN const Brush *brush, IN const PointF *positions, IN INT flags, IN const Matrix *matrix )
Draws characters at the specified positions. The method gives the client complete control over the appearance of text. The method assumes that the client has already set up the format and layout to be applied.
GpStatus WINGDIPAPI GdipMeasureDriverString( GpGraphics *graphics, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix, RectF *boundingBox )
Status Graphics::MeasureDriverString( IN const UINT16 *text, IN INT length, IN const Font *font, IN const PointF *positions, IN INT flags, IN const Matrix *matrix, OUT RectF *boundingBox ) const
Measures the bounding box for the specified characters and their corresponding positions.