Xojo Conferences
XDCMay2019MiamiUSA
MBSOct2019CologneDE

DynaPDF Manual - Page 548

Previous Page 547   Index   Next Page 549

Function Reference
Page 548 of 766
SI32 parseShowTextArrayW(const void* Data, const struct TTextRecordA*
Source, struct TCTM* Matrix, const struct TTextRecordW* Kerning, UI32
Count, double Width, LBOOL Decoded)
{
if (!Decoded) return 0;
double x1 = 0.0;
double y1 = 0.0;
// Transform the text matrix to user space
TCTM m = MulMatrix(m_GState.Matrix, *Matrix);
Transform(m, x1, y1); // Start point of the text record
// Word spacing applies to simple fonts only.
if (m_GState.FontType != ftType0)
{
UI32 i, j, last;
double x2 = 0.0;
double y2 = 0.0;
double textWidth = 0.0;
for (i = 0; i < Count; i++)
{
j
= 0;
last = 0;
// Consider kerning space
if (Source[i].Advance != 0.0f)
{
textWidth -= Source[i].Advance;
x1 = textWidth;
y1 = 0.0;
// Update the cursor position
Transform(m, x1, y1);
}
// Scan for spaces
while (j < Source[i].Length)
{
if (Source[i].Text[j] != 32)
++j;
else
{
// A space was found
if (j > last)
{
// The text must be taken from the Source array!
textWidth += fntGetTextWidth( m_GState.ActiveFont,
Source[i].Text + last,
j - last,
m_GState.CharSpacing,
m_GState.WordSpacing,
m_GState.TextScale);
x2 = textWidth;
y2 = 0.0;
// Calculate the end point.
 

Previous topic: Word Spacing

Next topic: Sub string coordinates