DynaPDF Manual - Page 563

Previous Page 562   Index   Next Page 564

Function Reference
Page 563 of 777
The TMulMatrix callback function is executed if the current transformation matrix must be
multiplied with a new one. When using the function MulMatrix() the matrix must be multiplied with
the one of the graphics state as follows:
// m_GState represents the current graphics state
m_GState.Matrix = MulMatrix(m_GState.Matrix, *Matrix);
The parameter Matrix is always set; it is not required to check whether the parameter is set to NULL.
The TSetFont callback function activates a font in the graphics state. The following variables of the
graphics state must be set when the callback function is executed:
m_GState.ActiveFont = Font;
= FontSize;
= Type;
m_GState.SpaceWidth = (float)(fntGetSpaceWidth(Font, FontSize) * 0.5);
The space width is required to construct text lines. It is usually best to use the half space width to
determine whether a space must be inserted at a specific position because many PDF fonts do not
contain a space character and the function fntGetSpaceWidth() returns just a default width in this
case (the function name is GetSpaceWidth() in C#, Delphi, and VB .Net).
The space width is measured in text space like the member Advance of a kerning record. However,
the distance between two text records is measured in user space! So, the space width must be
transformed to user space before it can be compared with the distance between two text records. See
the description of the TShowTextArrayW callback function for further information.

Previous topic: Inside the Callback Functions, TBeginTemplate

Next topic: TRestoreGraphicState, TSaveGraphicState, TShowTextArrayA