The PDF text drawing model provides a fairly wide selection of text operations.
If you, for example, want to produce a paragraph of justified text, first you need to calculate how the text should be split in lines and the additional word and character scaling parameters needed. Then the text can be rendered with the following pseudocode:
- Create a text object with the correct font and position.
- Set spacing values for the current line.
- Output the current line of text (add kerning manually if it is in a format Freetype does not handle)
- Repeat the above two steps until the paragraph is done
- Close the text object