ID: Q198426
The information in this article applies to:
This article describes how to control the horizontal and vertical spacing of @...SAY commands when printed.
Although when printing an @...SAY, the coordinates are given to determine the location of the @...SAY on the printed page, the same coordinates can be in different locations depending on the font. You can use the SET PRINT FONT command to control the location of a given coordinate on a page. You should issue the SET PRINT FONT command after the SET DEVICE TO PRINTER command for it to effect the location of @...SAY coordinates. The following sample programs demonstrate this.
Run the following sample programs and note the difference in the printed output. The first sample program uses the SET PRINT FONT command to set the Print Font to Courier New, 12 point. The second program sets the Print Font to Courier New, 40 point.
xIsVFP=.F.
IF ! "2.6" $ VERSION() && The code in this IF is for VFP only.
xIsVFP=.T.
_Screen.LockScreen = .T.
cOldbackcolor = _Screen.BackColor
_Screen.BackColor = RGB(255,255,255)
ENDIF
SET PRINTER TO
SET DEVICE TO PRINTER
SET PRINT FONT "Courier New", 12
@ 1,1 SAY "Hello World" FONT "Arial",14 STYLE "B"
@ 1,13 SAY "Goodbye World" FONT "Times New Roman", 12 STYLE "B"
@ 5,1 SAY "Hello World" FONT "Arial", 10
@ 6,1 SAY "Goodbye World" FONT "Times New Roman",10
@ 7,1 SAY "No Font Clause"
SET DEVICE TO SCREEN
SET PRINTER TO
IF xIsVFP
_Screen.BackColor = cOldbackcolor
_Screen.LockScreen = .F.
ENDIF
xIsVFP=.F.
IF ! "2.6" $ VERSION() && The code in this IF is for VFP only.
xIsVFP=.T.
_Screen.LockScreen = .T.
cOldbackcolor = _Screen.BackColor
_Screen.BackColor = RGB(255,255,255)
ENDIF
SET PRINTER TO
SET DEVICE TO PRINTER
SET PRINT FONT "Courier New", 40
@ 1,1 SAY "Hello World" FONT "Arial",14 STYLE "B"
@ 1,13 SAY "Goodbye World" FONT "Times New Roman", 12 STYLE "B"
@ 5,1 SAY "Hello World" FONT "Arial", 10
@ 6,1 SAY "Goodbye World" FONT "Times New Roman",10
@ 7,1 SAY "No Font Clause"
SET DEVICE TO SCREEN
SET PRINTER TO
IF xIsVFP
_Screen.BackColor = cOldbackcolor
_Screen.LockScreen = .F.
ENDIF
The SET PRINT FONT command also determines the font that @...SAY commands
use if the FONT clause is not used on the @...SAY command. This is true
whether you issue the SET PRINT FONT command either before or after the SET
DEVICE TO PRINTER command. Only if you issue the SET PRINT FONT command
after the SET DEVICE TO PRINTER command does it control the location of the
@...SAY coordinates.
NOTE: Microsoft has received unconfirmed customer reports that printer drivers can effect the spacing of @...SAY coordinates. If using the SET PRINT FONT command is not having the desired effect, try a different printer driver for your printer that is for a model that is similar or that your printer emulates.
Visual FoxPro Help, version 6.0; search on: "SET DEVICE"; topic: SET DEVICE command; search on: "SET PRINTER"; topic: SET PRINTER command
For additional information, please see the following articles in the Microsoft Knowledge Base:
ARTICLE-ID: Q99621
TITLE : Changing Font Used in Print Commands in FP for Windows
ARTICLE-ID: Q162301
TITLE : FIX: @ SAY Causes Error After SET DEVICE to PRINTER Command
ARTICLE-ID: Q164374
TITLE : BUG: Cannot Use Printer Fonts with ? Printing in VFP 5.0
ARTICLE-ID: Q154170
TITLE : BUG: @...SAY Prints Gray Background
ARTICLE-ID: Q103829
TITLE : How to Right-Justify Numeric Fields with @ ... SAY
ARTICLE-ID: Q151767
TITLE : BUG: 2.x @ SAY Report May Print Differently in Visual FoxPro
Additional query words:
Keywords : kbMAC kbPrinting kbVFp kbVFp300 kbVFp300b kbVFp500 kbVFp500a kbVFp600 kbXBase
Version : MACINTOSH:2.6a,3.0b; WINDOWS:2.6a,3.0,3.0b,5.0,5.0a,6.0
Platform : MACINTOSH WINDOWS
Issue type : kbhowto
Last Reviewed: January 7, 1999