Site Tools


documentation:development:opera:pf25:ppgfldr:smmfldr:ldofldr:01ldo094

GetTextExtent

Retrieves width and height for formatted text.

Synopsis

char * GetTextExtent (TextCel *tCel, int32 *pWidth,int32 *pHeight, char *fmtString,...)

Description

Calculates the on-screen extent that would be used by the formatted text. GetTextExtent formats text (if necessary), calculates the pixel width and height required to display the text, and returns width/height values via the pointers you provide. The function return value is a pointer to the formatted text (with printf-style formatting already resolved), a feature that is mainly a convenience for the text library internals.

This function does not take clipping into account; the returned width and height may be larger than the current size of the text cel specified. As a result, you can use this function to determine whether a cel needs to be expanded by comparing the width and height it returns with the ccb_Width and ccb_Height fields in the current cel.

The related vGetTextExtent() function works exactly the same, but takes a va_list type instead of the … parameters.

Arguments

  • tCel Pointer to a TextCel structure.
  • pWidth Pointer to the variable into which the width is returned.
  • pHeight Pointer to the variable into which the height is returned.
  • fmtString The string of characters to be rendered, optionally including printf-style % formatting commands.
  • Arguments for printf-style formatting (optional).

Return Value

Pointer to the formatted text.

Associated Files

lib3do.lib, textlib.h

See Also

vGetTextExtent

documentation/development/opera/pf25/ppgfldr/smmfldr/ldofldr/01ldo094.txt · Last modified: 2022/10/10 16:53 by 127.0.0.1