2.8. tsGetParameter

Syntax

Pascal

function tsGetParameteri(ParamName: tsEnum): tsInt;
procedure tsGetParameteriv(ParamName: tsEnum; pParam: ptsInt);

C/C++

tsInt tsGetParameteri(tsEnum ParamName);
void tsGetParameteriv(tsEnum ParamName, tsInt * pParam);

Description

This function is the complement to tsSetParameter. You can query all parameters you can set with tsSetParameter but there are still some more parameters you can query. I only explain the read only parameters for all other look at tsSetParameter.

Params

ParamName

For the ParamName you are able to use the following values.

Library

TS_INFO_MAYOR_VERSION

The mayor version of this library.

TS_INFO_MINOR_VERSION

The minor version of this library.

TS_INFO_BUILD_NUMBER

The build number of this library.

TS_CONTEXT_BINDING

This value contains the ID ot the current cound context. Zero if no context was bound.

TS_FONT_BINDING

This value contains the ID of the active bound font. Zero if no font was bound.

Creator

TS_FONT_STYLE

The styles with which the font creator was created. This value can be an set of the fontstyles.

TS_FONT_ANTIALIASING

This will return the antialiasing with which the font creator was created. This is similary to the ParamName TS_GLOBAL_ANTIALIASING.

TS_FONT_FORMAT

This will return the format with which the font creator was created. This is similary to the ParamName TS_GLOBAL_FORMAT. For the complete list of formats take a look in the Image section.

Font

TS_FONT_LINESKIP

The lineskip is the height of the line. This value is the sum of the ascent, descent and the external leading from the current bound font.

Lineskip
[Note] Note

If you try to calculate the size of multiple fonts in an single line i prefer to use the three seperated values. So you can calculate the size depending on the baseline. It's possible that some fonts have larger ascent or descent but the lineskip is smaler than by an other font.

TS_FONT_FILE_STYLE

This value contains the styles from the fontfile. It is possible that fontfiles have an style and with this parameter you are able to query them. This value is like TS_FONT_STYLE and can be an set of the fontstyles.

[Note] Note

SDL_ttf dosn't support these flags so it's not possible to query these value with SDL_ttf. You always get zero for this style.

TS_FONT_FIXED_WIDTH

Returns TS_TRUE if the font is an monospace font. That means all chars have exactly the same width. TS_FALSE if it's not monospaced.

pParam

The paramter pParam is only available in the function tsGetParameteriv. If you are using it the return value will be written to pParam.

Return Value

tsGetParameteri returns the value as result.

If you get an error from this function the return value always be zero.

Error Codes

TS_NO_ACTIVE_CONTEXT

This error occours if no context was bound. Only 4 ParamNames are allowed to query without an bound context. TS_INFO_MAYOR_VERSION, TS_INFO_MINOR_VERSION, TS_INFO_BUILD_NUMBER and TS_CONTEXT_BINDING. All other need an bound context.

TS_NO_ACTIVE_FONT

If you try to retrieve an parameter from an font there must be an font bound. Else this error will happen. ParamNames they need an bound font are all they starts with TS_FONT_*. Also TS_CREATOR_CREATE_CHARS needs an bound font. But in this case the fonts needs to be an creator.

TS_INVALID_OPERATION

This error will happen if you try to get some informations about an object but the object has an wrong type. With the following ParamNames this error can happen.

TS_CREATOR_CREATE_CHARS

Needs an bound font creator. At this moment font creators are the only possible font objects.

TS_RENDERER_OPENGL_TEXTURE_SIZE

The active renderer needs to be an OpenGL renderer.

TS_RENDERER_NULL_SAVE_IMAGES

The active renderer needs to be an NULL renderer.

TS_INVALID_ENUM

If you try to query the value of an unknown ParamName.

TS_INVALID_VALUE

If you pass nil / NULL as pParam into tsGetParameteriv this occours.

TS_ERROR

This error only could happen if an unknown renderer was found, if you tries to query TS_RENDERER. But this would never happen so this error should never set from tsGetParameter.