Xojo Conferences
MBSOct2019CologneDE

DynaPDF Manual - Page 389

Previous Page 388   Index   Next Page 390

Function Reference
Page 389 of 770
x
= PosX + (p.x >> 2) * s;
y
= PosY - (p.y >> 2) * s; // Variant for top down coordinates (+ otherwise).
switch(cmd)
{
case 1: pdfMoveTo(PDF, x, y); break;
case 2: pdfLineTo(PDF, x, y); break;
case 3:
switch(++idx)
{
case 1: x1 = x; y1 = y; break;
case 2:
idx = 0;
pdfBezier_2_3(PDF, x1, y1, x, y);
break;
}
break;
case 4:
switch(++idx)
{
case 1: x1 = x; y1 = y; break;
case 2: x2 = x; y2 = y; break;
case 3:
idx = 0;
pdfBezier_1_2_3(PDF, x1, y1, x2, y2, x, y);
break;
}
break;
default: throw "Unknown error!";
}
}
pdfClosePath(PDF, fmFill);
}
void DrawTextOutline(const PPDF* PDF, const BYTE* Text, SI32 Len)
{
SI32 i, idx, size;
TPDFGlyphOutline glyph;
double x, y, scale, fontSize;
pdfCreateNewPDF(PDF, "test.pdf");
pdfSetPageCoords(PDF, pcTopDown);
pdfAppend(PDF);
memset(&glyph, 0, sizeof(glyph));
// The font size is NOT considered by GetGlyphOutline()!
pdfSetFont(PDF, "Arial", fsRegular, 10.0, false, cp1252);
x = y = 50.0;
fontSize = 40.0f;
scale
= fontSize / 1000.0;
for (i = 0; i < Len; i++)
{
idx = pdfGetGlyphIndex(PDF, Text[i]);
if ((size = pdfGetGlyphOutline(PDF, idx, NULL)) >= 0)
{
glyph.Size = size;
// Note that the size can be zero!
if (size > 0)
glyph.Outline = (TI32Point*)malloc(size * sizeof(TI32Point));
pdfGetGlyphOutline(PDF, idx, &glyph);
// See definition above
DrawGlyph(PDF, x, y + fontSize, fontSize, glyph);
x += glyph.AdvanceX * scale;
if (size > 0) free(glyph.Outline);
 

Previous topic: C, C++, Delphi, C#, VB 6, VB .Net, PHP, Outline format

Next topic: GetGoToAction, GetGoToRAction