DynaPDF Manual - Page 768
Previous Page 767 Index Next Page 769

Function Reference
Page 768 of 874
device context twice to calculate a text scaling, one time to determine the unscaled value, and a
second time to select the font with the wished value.
If a text should be scaled to 120% horizontally the calculation is as follows (C++):
TEXTMETRIC tm;
GetTextMetrics(dc, &tm);
int nWidth = tm.AveCharWidth * 120 / 100;
Note that text scaling is an output attribute; the value is not used during font selection.
In PDF, text scaling is a separate property of the current graphics state so that you don't need to
determine the average character width of a font beforehand. Text scaling can be applied directly
with the function SetTextScaling() without any further calculation. So, if you want to scale a text to
120% in PDF, you can simply call the function SetTextScaling() as follows:
pdfSetTextScaling(pdf, 120.0);
nEscapement
The angle of escapement specifies the output angle of a text string in tenths degrees. The output
angle of a string has nothing to do with a font, it is an output attribute. Rotated text can be printed
with the function WriteAngleText() with DynaPDF.
nOrientation
This parameter specifies the angle, between each character's base line and the x-axis of the device.
DynaPDF does not support a function that enables printing of characters in this way. Each character
must be printed separately with the function WriteAngleText() to get the same result.
nWeight
The font weight can be in the range 0 to 1000 (zero means don't know). A font can be installed in up
to 10 different font weights and each weight refers to another font file. The weight is encoded in the
parameter Style of a SetFont() call. The helper function WidthToStyle() converts a weight to a
TFStyle constant. A valid font weight is dividable by 100. A value like 345 is no valid font weight
while 300 or 400, for example, would be correct.
The style flags underlined and strikeout are supported by SetFont() too. The only difference is that
each flag can be set with one parameter because the parameter Style of SetFont() is a bit-mask. See
sesction Font Styles for further information.
fdwCharSet
A character set is not what a user types in with the keyboard; it specifies a character collection or an
alphabet that the font must support. The charset has the highest search priority, followed by
fdwPitchAndFamily. Font selection fails if no font can be found that supports the selected character
set, but it does not fail if the font name is wrong.
Previous topic: nHeight, nWidth
Next topic: fdwPitchAndFamily, lpszFace