DynaPDF Manual - Page 503

Previous Page 502   Index   Next Page 504

Function Reference
Page 503 of 839
Remarks:
This function is implemented in an Ansi and Unicode compatible version.
CJK to Unicode code pages are supported by the Ansi version only because CJK strings must be
converted to Unicode beforehand. These conversion algorithms are available in the Ansi version
only. However, native CJK character sets are also supported with the wide string version in
combination with a CJK font. See SetFont() for further information.
Return values:
If the function succeeds the return value is the string width in un-scaled units. If the function fails
the return value is a negative error code.
GetTextWidth (Font API)
Syntax:
double fntGetTextWidth(
const void* IFont, // Pointer of the font object
const BYTE* Text,
// PDF Text string
UI32 Len,
// Length of the string
float CharSpacing, // Current character spacing
float WordSpacing, // Current word spacing
float TextScale)
// Current text scaling
The function can be used to calculate the width of a sub string that was returned by the content
parser (see ParseContent() for further information). The parameter IFont must be a valid pointer of a
font object that was provided in the TSetFont callback function. Note that this function is optimized
for speed and does not use the normal error handling of DynaPDF. The parameters CharSpacing,
WordSpacing, and TextScale must be taken from the current graphics state.
The function returns the real text width of a string:
Visible Text Width (character spacing = 5.0)
C h a r a c t e r S p a c i n g
Real Text Width (character spacing = 5.0)
C h a r a c t e r S p a c i n g
Return values:
If the function succeeds the return value is the string width measured in text space. If the parameter
IFont is set NULL the return value is 0.0.
 

Previous topic: GetTextScaling, GetTextWidth

Next topic: GetTextWidthEx, GetTransparentColor