4.4 Painting text

Text is drawn by the following steps:

  1. Start drawing text by invoking page:BeginText().
  2. Set text states (such as font, filling color...) using text state operators or color operators. At least page:SetFontAndSize() must be invoked once before invoking text painting operators.
  3. Set text positioning by invoking text positioning operators.
  4. Show text by invoking text painting operators.
  5. Repeat steps 2 to 4 if necessary.
  6. Finish drawing text by invoking page:EndText().

The figure below explains text positioning:

You can see that, in contrast to Hollywood's coordinate system, the PDF document's coordinate system for placing text starts at the bottom and extends upwards.

Here is a list of text state operators:

 
page:SetCharSpace()
page:SetFontAndSize()
page:SetHorizontalScaling()
page:SetTextLeading()
page:SetTextRenderingMode()
page:SetTextRise()
page:SetWordSpace()

Here is a list of text positioning operators:

 
page:MoveTextPos()
page:SetTextMatrix()

Here is a list of text painting operators:

 
page:ShowText()
page:ShowTextNextLine()
page:TextOut()
page:TextRect()


Show TOC