Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 543

Previous Page 542   Index   Next Page 544

Function Reference
Page 543 of 750
the Matrix parameter (see also Coordinate Spaces). The Matrix parameter is optional and can be set to
NULL. In the latter case, the form matrix is set to the identity matrix.
If the form matrix is present then it must be multiplied with the current transformation matrix of the
graphics state as follows:
// m_GState represents the current graphics state
if (Matrix)
{
m_GState.Matrix = MulMatrix(m_GState.Matrix, *Matrix);
}
The corresponding TEndTemplate callback function is executed if the contents of a template were
fully processed. The definition of this callback function is optional because no specific code is
required to be executed.
Return values:
0 indicates success and processing continues.
1 means that the template should be skipped.
Any other return value breaks processing.
TMulMatrix
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.
TSetFont
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;
m_GState.FontSize
= FontSize;
m_GState.FontType
= 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: TBeginTemplate

Next topic: TShowTextArrayA