7.6. tsTextGetHeight

Syntax

Pascal

function tsTextGetHeightA(pText: pAnsiChar): tsInt;

function tsTextGetHeightW(pText: pWideChar): tsInt;

C/C++

tsInt tsTextGetHeightA(char * pText);

tsInt tsTextGetHeightW(WideChar * pText);

Description

This function calculates the height of an text and returns it. You also can use this function to query the actual height of the text inside an blockmode. For this you can call this functions inside the block mode with nil / NULL as pText and it will return the actual height.

If you query the height of an single text (pText is not nil / NULL) the return value is equal to the fontparameter TS_FONT_LINESKIP and no calculation will be performed.

Parameters

pText

It's an pointer to an null terminated string that contains the text of which you wants to know the height. If you call this function inside the block mode and you pass nil / NULL for pText the function will return the width of the actual drawn text.

Return Value

Return value is the width of the given text or the width of the drawn text inside the block mode.

Error Codes

TS_NO_ACTIVE_CONTEXT

There is no active context. See also tsContextBind.

TS_NO_ACTIVE_RENDERER

There was no renderer set. See the parameter TS_RENDERER.

TS_NO_ACTIVE_FONT

There was no font bound to the actual context. See also tsFontBind.

TS_INVALID_OPERATION

This could happen only in the ansi version. And there was an error to convert the ansi to unicode text. But it's nearly not possible to get this error.

TS_INVALID_VALUE

If you pass nil / NULL to this function. If you really wants to draw some text you should put it into this function. With nil / NULL this won't work.