Highlighted
Absent Member.
Absent Member.
649 views

[archive] Win$printer

[Migrated content. Thread originally posted on 07 January 2005]

Guys,

Can you please look at this and tell me why it doesn't work?
Basically it seems to change to font size ok, but I can't seem to figure out how to change the font type.

Many Thanks,

Shaun

IF OS-IS-WIN-FAMILY
CALL "WIN$PRINTER"
USING WINPRINT-SETUP
GIVING WS-RESULT
IF WS-RESULT = 1
INITIALIZE WFONT-DATA
SET WFDEVICE-WIN-PRINTER TO TRUE
SET WFCHARSET-DEFAULT TO TRUE
SET WFFAMILY-MODERN TO TRUE
MOVE "Courier New" TO WFONT-NAME
MOVE 07 TO WFONT-SIZE
CALL "W$FONT" USING
WFONT-GET-CLOSEST-FONT
TEXT-FONT WFONT-DATA
GIVING WS-RESULT
INITIALIZE WPRTDATA-SET-FONT
MOVE TEXT-FONT TO WPRTDATA-FONT
CALL "WIN$PRINTER" USING
WINPRINT-SET-FONT
WINPRINT-DATA
GIVING WS-RESULT
ELSE
PERFORM CLOSE-FILES
EXIT PROGRAM
END-IF
END-IF.
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Win$printer

My bet would be the following:

When I check the font dialog here, Courier New does not provide 7 point sizes, and you also set the flag WFONT-GET-CLOSEST-FONT, which means the w$font routine will not fail because it can't find the requested font/size pair, provide the closest alternative.
As such, this is expected behavior.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Win$printer

OK Gisle,

Changed it like this and now its OK.

Shaun

INITIALIZE WFONT-DATA
SET WFDEVICE-WIN-PRINTER TO TRUE
SET WFCHARSET-DEFAULT TO TRUE
MOVE "Courier New" TO WFONT-NAME
MOVE 12 TO WFONT-SIZE
CALL "W$FONT" USING WFONT-GET-FONT,
WS-FONT-HANDLE,
WFONT-DATA
GIVING WS-RESULT
MOVE WS-FONT-HANDLE TO WPRTDATA-FONT
CALL "WIN$PRINTER" USING WINPRINT-SET-FONT,
WINPRINT-DATA
GIVING WS-RESULT
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.