DynaPDF Manual - Page 524
Previous Page 523 Index Next Page 525

Function Reference
Page 524 of 860
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.
GetTextWidthEx
Syntax:
double pdfGetTextWidthEx(
const PPDF* IPDF,
// Instance pointer
const char* AText, // Text string
UI32 Len)
// Length of the string in characters
The function computes the width of a text string. The graphics state parameters character spacing,
word spacing, text scaling, and the current font size are all considered. A font must be set before this
function can be used.
The function computes the visible width of the string. This is the width excluding the last character
spacing. The bounding box of the string is the text width plus the current character spacing. This
behaviour must be taken into account when writing right aligned text with WriteFText(). Due to
certain formatting rules WriteFText() uses the bounding box of a text string to output text.
Visible Text Width (character spacing = 5.0)
C h a r a c t e r S p a c i n g
Real Bounding Box (character spacing = 5.0)
C h a r a c t e r S p a c i n g
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 supported by the Unicode version in combination with
a CJK font. See SetFont() for further information.
Previous topic: GetTextWidth, GetTextWidth (Font API)
Next topic: GetTransparentColor, GetTrapped, GetTypoLeading