Pascal
function tsGetParameteri(ParamName: tsEnum): tsInt; procedure tsGetParameteriv(ParamName: tsEnum; pParam: ptsInt);
C/C++
tsInt tsGetParameteri(tsEnum ParamName); void tsGetParameteriv(tsEnum ParamName, tsInt * pParam);
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.
For the ParamName you are able to use the following values.
The mayor version of this library.
The minor version of this library.
The build number of this library.
This value contains the ID ot the current cound context. Zero if no context was bound.
This value contains the ID of the active bound font. Zero if no font was bound.
The styles with which the font creator was created. This value can be an set of the fontstyles.
This will return the antialiasing with which the font creator was created. This is similary to the ParamName TS_GLOBAL_ANTIALIASING.
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.
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.
|
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. |
|
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 |
|---|---|
|
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. |
|
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.
The paramter pParam is only available in the function tsGetParameteriv. If you are using it the return value will be written to pParam.
tsGetParameteri returns the value as result.
If you get an error from this function the return value always be zero.
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.
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.
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.
Needs an bound font creator. At this moment font creators are the only possible font objects.
The active renderer needs to be an OpenGL renderer.
The active renderer needs to be an NULL renderer.
If you try to query the value of an unknown ParamName.
If you pass nil / NULL as pParam into tsGetParameteriv this occours.
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.