Chapter 7. Output

Table of Contents

7.1. tsTextBeginBlock
7.2. tsTextEndBlock
7.3. tsTextColor
7.4. tsTextOut
7.5. tsTextGetWidth
7.6. tsTextGetHeight
7.7. tsCharOutW

The functions in this section are all used to output text. You have two generell modes of printing text. The block mode and the single line mode.

Single line mode

The single line mode was made to simple print some single words or sentences at the current position. It's also possible to align the text without any calculation by yourself. You only have to set an alignment with the parameter TS_ALIGN. You also can control the position of the baseline with the parameter TS_SINGLE_LINE.

Block mode

The block mode was designed to easy print texts which uses one or more fonts/sizes and may contain some automated breaks. You also have the possibillity to align the text inside the block, vertical or horizontal or you can measure the size of the block without drawing any text. Or you just query the actual size while you are printing inside an block. All you need to query the sizes are the functions tsTextGetHeight and tsTextGetWidth. Don't cares if single line or block mode. For details look in the functions.

For the printing in block mode you have some flags to control it.

Flag Description
TS_BLOCKFLAG_NO_CLIP If this bit (0) is set no clipping will performed and the whole text will be printed. With the paramater TS_CLIP you can control if the clipping clips lines they are outside or they cut the border of the blocks.
TS_BLOCKFLAG_CALC_SIZE If this bit (1) is set no text will be print. This is necessary to calculate the width and height of some textblocks. If you want to draw an block an needs to know the height for later operation you can query them inside the block.
TS_BLOCKFLAG_WORD_WRAP If this bit (2) is set the text will be breaked at spaces. I think most of the time you use the block mode you will need this flag.

Table 7.1. Flags for the block mode