Win32Prn() > Print output methods xHarbour Developers Network  

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
ConstantValue
FW_DONTCARE0
FW_THIN100
FW_EXTRALIGHT200
FW_LIGHT300
FW_NORMAL400
FW_MEDIUM500
FW_SEMIBOLD600
FW_BOLD700
FW_EXTRABOLD800
FW_HEAVY900

<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
ValueDescription
0 *)Text is printed left aligned to the current print position
 1Text is printed right aligned to the current print position
 2Text 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