get_text_extent


template <class character>
bool get_text_extent(handle device,
                     const character* text,
                     int length,
                     idimensions* extent)

This function obtains the dimensions of a text string.

Parameters

handle device

The handle of the device context.

const character* text

A pointer to the text whose dimensions are being queried.

int length

The length (in characters) of the text pointed to by the previous parameter.

idimensions* extent

A pointer to a structure that is updated to hold the dimensions of the text. Note that the x-coordinate holds the width and the y-coordinate holds the height.

Return

bool

true The function succeeded.
false The call failed.

Notes

The currently selected font is used to obtain the dimensions of the string (width and height - in logical units). No clipping is performed when calculating these dimensions.

Because some devices are capable of using kerning characters, the sum of the extents of the individual characters in a string may not be equal to the extent of the entire string.

The returned string width includes the intercharacter spacing.