DynaPDF Manual - Page 413

Previous Page 412   Index   Next Page 414

Function Reference
Page 413 of 818
double fs = FontSize / 1000.0;
double s = fs / 64.0;
for (i = 0; i < size; i++)
{
TI32Point &p = Outline.Outline[i];
cmd = ((p.y & 3) << 2) | (p.x & 3);
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;
 

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

Next topic: GetGoToAction


Start Chat