Using member :fontWidth of XbpCRT objects to specify a font width other
than the default font width can yield incorrect string output.
If @SAY is used to output a string with leading spaces for example,
character placement may differ from the output produced when using
the trimmed string.
cStr := "test"
@ 26,0 SAY REPLICATE(" ", 4) + cStr
@ 26,4 SAY LTrim( cStr )
The output produced by the two @SAY commands above should be the same.
However, the anomaly described above may cause the character positions
to be slightly different. This occurs because the font (width) used by
the operating system for character output differs from the one reported
to the Xbase++ application. This causes the second statement above
(which addresses a specific column) to produce output that is slightly
off.
NOTE: This anomaly only occurs on Windows 9x platforms and affects only
the x-coordinate used for output (column position).
NOTE: Only some applications are affected by this anomaly!
NOTE: This anomaly may also affect Xbase PARTs and output made via the
function GraStringAt(). See PDR 5330 for further info.
|
A work-around for this problem is available via Public Fix Level
(PFL) 182306. The work-around lessens the effects of said anomaly.
Since the problems is caused by the operating system, we cannot
guarantee correct behaviour in all cases. Please visit
www.alaska-software.com (support section) for further information.
This anomaly seems to be produced by rounding errors within the
operating system, causing the font width reported to be incorrect
for certain font width/height rations. If you are using font widths
other than the defaults (the width the font was originally designed
for), carefully test character placement in your application's output
on Windows 9.x. If this anomaly affects your application, try
specifying a different width/height combination, if possible.
This anomaly normally affects only applications that use coding
patterns similar to the one illustrated above (i.e. inserting/
replacing/overwriting individual characters during output).
The following (pseudo) code can be used to check whether a
certain font width/height combination shows this anomaly:
FUNCTION ValidateFont( oCrt )
#define PDR5132TSTSTR " abcdefgUVWXYZ "
#define PDR5132TSTSTRLEN 22
LOCAL oPS := oCrt:presSpace()
LOCAL oFont
LOCAL oOldFont
LOCAL bIsValid := .T.
LOCAL aBox
oFont := XbpFont():new()
oFont:familyName := oCrt:fontName
oFont:height := oCrt:fontHeight
oFont:width := oCrt:fontWidth
oFont:fixed := .T.
oFont:create()
oOldFont := GraSetFont( oPS, oFont )
aBox := GraQueryTextBox( oPS, PDR5132TSTSTR )
IF oFont:width * PDR5132TSTSTRLEN != aBox[3,1]-aBox[2,1]
bIsValid := .F.
ENDIF
GraSetFont( oPS, oOldFont )
RETURN bIsValid
|