DynaPDF Manual - Page 691

Previous Page 690   Index   Next Page 692

Function Reference
Page 691 of 787
GDI Font selection in comparison to DynaPDF
The Windows GDI selects a font in another way than DynaPDF does. Let us see how a font can be
selected with the GDI function CreateFont() and where are the differences in comparison to
HFONT f = CreateFont(
// height of font
// average character width
// angle of escapement
// base-line orientation angle
// font weight
// italic attribute option
// underline attribute option
// strikeout attribute option
// character set identifier
// output precision
CLIP_DEFAULT_PRECIS, // clipping precision
ANTIALIASED_QUALITY, // output quality
// pitch and family
// typeface name (Family Name)
The GDI supports three modes how the font size or height can be specified. We want to discuss
negative values only because the other modes are not of interest for high precision output (positive
values specify the cell height of a font, this value must be converted by DynaPDF to determine the
wished font size). The font height we used in the example CreateFont() function call is defined as a
negative value. The absolute value of it is transformed to device units by the font mapper. We
choose a size of 240 units; this is a normal font size for a 1440 DPI output.
A negative font height in a CreateFont() function call is exactly the same as a positive height or size
in a SetFont() function call in DynaPDF (negative values are not supported by SetFont()).
However, GDI coordinates are normally upscaled because GDI functions support integer values
only. For example, if we want to use a font size of 12.74 units, we can only upscale the coordinate
system because it is impossible to define such a font size with a GDI function. That is the reason
why GDI drawings are defined in a specific resolution. GDI coordinates are never really device
However, to avoid issues with a fixed resolution the PDF format uses a completely different system
to produce device independent output. PDF coordinates and font sizes are expressed in floating
point units so that we can use our font size of 12.74 units directly. We do not need to upscale the
coordinate system and we don't need to consider whether the PDF file is drawn on a monitor or
printer. All the details about the output resolution are completely hidden for the user.
BTW - A PDF unit is 1/72 inch.

Previous topic: How to use CJK encodings?

Next topic: nWidth, nEscapement, nOrientation, nWeight

Start Chat