DynaPDF Manual - Page 736

Previous Page 735   Index   Next Page 737

Function Reference
Page 736 of 839
The average character width (nWidth) is the same as horizontal text scaling in PDF (see
SetTextScaling()), but the calculation is completely different. The GDI uses the average character
width of a font to calculate the text scaling (the unscaled value is returned by the GDI function
GetTextMetrics() if nWidth was set to zero during font selection). So, the font must be selected into
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++):
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);
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.
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.
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.

Previous topic: GDI Font selection in comparison to DynaPDF, nHeight

Next topic: fdwCharSet, fdwPitchAndFamily, lpszFace