Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 452

Previous Page 451   Index   Next Page 453

Function Reference
Page 452 of 750
Value = 50
WordWord
GetTextWidth
Syntax:
double pdfGetTextWidth(
const PPDF* IPDF,
// Instance pointer
const char* AText) // Null-terminated text string
The function computes the width of a text string in horizontal writing mode and the height in
vertical writing mode. 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() must use the real bounding box of the 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 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.
 

Previous topic: GetTextScaling

Next topic: GetTextWidthEx