Table of Contents
Fonts are really helpfull if you want to print some text. With these functions you are able to create and destroy fonts. To use or manipulate an font you have to bind them.
Normally the fonts are empty. If you want to add some chars to an font you have to attach an creator to the font. Everytime you access an unknown char the font uses the creator to add the char. You also can add and delete chars by yourself.
The chars have several properties they control the position and size of the char. If you want to query or change some of them you must bind and font and then you can call tsSetParameter or tsGetParameter to change or query them.
The figure above shows the layout of the chars. Following i try to describe the meaning of the values.
The advance describes the width of the char. But not only the width of the image. It's the width from the left of the actuall char to the left of the next char.
The baseline describes the vertical position of the char. All chars are arranged at the baseline. The baseline has no real value. It depends on the position of the glyph.
The whole image contains the complete data of the image. Mostly the image and the glyph rect has the same size. If you apply an shadow the image will be expanded but the glyph rect stay "unchanged". It only will moved inside the image. This isn't an real property of the char. It's only to show it. In post processors it's depends directly to the size of the image.
The glyph rect is the rect which only marks the size of the glyph inside the whole image. This rect only marks the closest rect of the glyph. It dosn't contains things like shadows. Its an relative position from the top left of the image. This rect will be used for the line calculation of the textoutput. If will be aranged at the left side of the text.
The glyph origin contains the origin of the glyph rect. The glyph origin y is an positive value seen from the baseline. The glyph origin x is seen from the starting point. The starting point is the end of the last char or the beginning og the line. In the figure the starting point is the beginning of the advance. glyph origin x is zero.
| Style | Description |
|---|---|
| TS_STYLE_NORMAL | Normal means no style will be applied. This value is equal to zero. |
| TS_STYLE_BOLD | Bold style. If bit 0 (the first) is set it will applied. |
| TS_STYLE_ITALIC | Italic style. If bit 1 is set it will be applied. |
| TS_STYLE_UNDERLINE | Underline. If bit 2 is set it will be applied. |
| TS_STYLE_STRIKEOUT | Strikeout. If bit 3 is set it will be applied. |
Table 4.1. Fontstyles