DynaPDF Manual - Page 424

Previous Page 423   Index   Next Page 425

Function Reference
Page 424 of 839
struct TPDFGlyphOutline
{
float
AdvanceX; // Glyph width in horizontal writing mode.
float
AdvanceY; // Glyph height in vertical writing mode.
float
OriginX;
// Placement vector (vertical writing mode only).
float
OriginY;
// Placement vector (vertical writing mode only).
SI16
Lsb;
// Left side bearing (already applied, info only).
SI16
Tsb;
// Top side bearing (already applied, info only).
LBOOL
HaveBBox; // If true, BBox was computed.
struct TFRect
BBox;
// Bounding box of the glyph outline.
struct TI32Point* Outline;
// Encoded outline. See description.
UI32
Size;
// Number of points.
};
The function returns the outline of a glyph of the active font. The usage is slightly different
depending on the used programming language:
C, C++, Delphi
The function must be called twice, the first time with the parameter Outline set to NULL or nil to
determine the size of the glyph outline (the function returns the number of points in this case). The
member Outline of the TPDFGlyphOutline structure can now be allocated and the function can be
called again. See example below the function description for further information.
C#, VB 6, VB .Net, PHP
The function returns the outline already in the first function call.
Note that not all glyphs have an outline. A space character, for example, has no outline and
therefore the size can be zero. The function returns normalized outlines scaled to a font size of 1000
units.
Outline format
The member Outline of the TPDFGlyphOutline structure contains coodinates encoded as 24.6 bit
fixed integer values. The remaining 2 bits contain the type of point or corresponding command that
was returned:
TI32Point &p = glyph.Outline[i];
UI32 cmd = ((p.y & 3) << 2) | (p.x & 3);
// Extract the command
SI32 x
= p.x >> 2;
// Remove the command. Result = 24.6 bit fixed point value!
SI32 y
= p.y >> 2;
// Remove the command. Result = 24.6 bit fixed point value!
double fx = x / 64.0;
// Conversion to PDF units
double fy = y / 64.0;
// Conversion to PDF units
cmd == 1 // MoveTo
cmd == 2 // LineTo
cmd == 3 // Bezier_2_3
// One more point follows
cmd == 4 // Bezier_1_2_3 // Two more points follow
Other values as listed above cannot occur and must be treated as an error.
Return values:
If the function succeeds the return value is the size of the outline in points. If the function fails the
return value is a negative error code.
 

Previous topic: GetGlyphIndex, GetGlyphOutline

Next topic: GetGoToAction