SYNOPSIS
#include <drawtk.h>
dtk_hshape dtk_create_string(dtk_hshape shp, const char *text,
float size, float x, float y,
unsigned int alignment,
const float *color, dtk_hfont font);
DESCRIPTION
dtk_create_string() creates a text specified by text at location (x,y) with a font size of size using a previously loaded font referenced by font argument (see dtk_load_font(3)).
The position (x,y) is interpreted according to the combination of flags controlling the vertical and horizontal alignment defined in the alignment argument:
- *
- DTK_BOTTOM, DTK_VMID and DTK_TOP make the value y to be interpreted as respectively the bottom, the middle and the top of the bounding box of the shape.
- *
- DTK_LEFT, DTK_HMID and DTK_RIGHT make the value x to be interpreted as respectively the left, the middle and the right of the bounding box of the shape.
shp and color has the same usage and meaning than in other shape creation functions (see dtk_create_shape(3)):
- *
- shp can be used to modify a previously created shape. If it is non-null, the handle will be used to modify the shape referenced by shp: no new shape is created and the returned value is ensured to be shp in case of success, NULL otherwise. If shp is NULL, the function will attempt to create a new shape.
- *
- color should point to a 4 float array containing a normalized RGBA value (i.e. each component is between 0.0 and 1.0).
RETURN VALUE
In case of success the function returns the handle to the newly created or modified shape. If the shp argument is non-null, the handle returned is the same value. In case of error, NULL is returned.