Win32Prn() > Print output methods |
|
|
oWin32Prn:textAtFont()
Prints text at the specified X/Y position and restores previous font settings.
Syntax
:textAtFont([<nPosX>] , ;
[<nPosY>] , ;
<cString> , ;
[<cFontName>] , ;
[<nPointSize>] , ;
[<nFontWidth>] , ;
[<nFontWeight>], ;
[<lUnderLine>] , ;
[<lItalic>] , ;
[<lNewLine>] , ;
[<lUpdatePosX>], ;
[<nTextColor>] , ;
[<nTextAlign>] ) --> lSuccess
Arguments
- <nPosX> and <nPosY>
- These two numeric values are the X and Y coordinates where <cString> is output. They
default to the current X and Y coordinate of the print position.
- <cString>
- This is a character string holding the text to print.
- <cFontName>
- This is a character string holding the name of the font to select as current. It is
case sensitive.
- <nPointSize>
- This is a numeric value indicating the font size in points. If omitted, a default font size
is used.
- <nFontWidth>
- This is a numeric value indicating the font width in pixels. If omitted, a default font width
is used.
- <nFontWeight>
- This is a numeric value indicating the font weight. If omitted, a default font weight
is used. #define constants are available in the file WinGdi.ch that can be used for
<nFontWeight>:
Constants for font weights
Constant | Value |
FW_DONTCARE | 0 |
FW_THIN | 100 |
FW_EXTRALIGHT | 200 |
FW_LIGHT | 300 |
FW_NORMAL | 400 |
FW_MEDIUM | 500 |
FW_SEMIBOLD | 600 |
FW_BOLD | 700 |
FW_EXTRABOLD | 800 |
FW_HEAVY | 900 |
- <lUnderline>
- This is a logical value specifying the underlined mode of the font. The value .T. (true) switches
underlined on, and .F. (false) switches it off. When omitted, the current underlined mode
of the Win32Prn object is used.
- <lItalic>
- This is a logical value specifying the italic mode of the font. The value .T. (true) switches
italic on, and .F. (false) switches it off. When omitted, the current italic mode
of the Win32Prn object is used.
- <lNewLine>
- This parameter defaults to .F. (false). When set to .T. (true), the print position
is moved to the beginning of the next line after <cString> is output.
- <lUpdatePosX>
- This parameter defaults to .T. (true) which changes the X coordinate of the print
position to the end of <cString> after printing. Subsequent print output appears
to the right of <cString>. Passing .F. (false), leaves the X coordinate unchanged.
- <nTextColor>
- This is a numeric RGB color value defining the text color (foreground).
- <nTextAlign>
- This is an optional numeric value specifying the text alignment at the current print position.
The following values can be used:
Values for text alignment
Value | Description |
0 *) | Text is printed left aligned to the current print position |
1 | Text is printed right aligned to the current print position |
2 | Text is printed centered on the current print position |
Description
Method :textAtFont() is a combination of methods :texOutAt(),
:setFont() and :setColor().
It prints the text string at the given location using the specified font and color. The previous
font and color settings are restored after printing. This allows for changing font and color
temporarily without having to define new settings for the current font.
The method returns a logical value indicating success of the operation.
Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe