Highlighted
Absent Member.
Absent Member.
669 views

[archive] Printing and use W$TEXTSIZE

[Migrated content. Thread originally posted on 26 October 2005]

Is it right to use W$TEXTSIZE for examine the height/width of a font for printing? Because before skipping to an next page I have to print some subtotals etc.
0 Likes
6 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Printing and use W$TEXTSIZE

I guess so. Problem is however, the routine is accepting a ACUCOBOL-GT Window handle, and you cannot get that of the printer. Which you need.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Printing and use W$TEXTSIZE

Oke, but I initialise TEXTSIZE-WINDOW, so it is NULL. After that I call W$TEXTSIZE wich de value "0" wich differents font-handles and the result is always different values in CELLS-X, BASE-X, CELLS-Y, BASE-Y. So a fonthandler wich 12 dots gives higher values then a fonthandler wich 8 dots. Wich these values and the LINES-PER-PAGE I calculate and it seems to work on my computer who has a 19" monitor. Will it be wrong when running wich a 17" monitor? And an other question is, what is an other way to figure out when a page is full?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Printing and use W$TEXTSIZE

After preview reply the attachement was away. So here an attachment.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Printing and use W$TEXTSIZE

I am sorry, I thought you said you would be printing? If you are estimating to the screen, then it is a different story, then you have access to the window handle.
As for printing, not being able to provide the handle will give unpredictable results.

What you could do, is to use the WINPRINT-SET-CURSOR before printing to obtain current position, then print a line, use WINPRINT-SET-CURSOR again and subtract the difference, then you know the line feed.

Read the docs on WINPRINT-SET-CURSOR for info on how to get current position.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Printing and use W$TEXTSIZE

For so far I use now the SET-CUSOR for the height. A print from PC A(19") or PC B (17") gives the same result. For the width of a character I used W$TEXTSIZE but it gives unpredictable results you wrote to me, so I have to change.
First I will use WINPRINT-SET-FONT with WIN$PRINTER before to print a line(so the system nows the current font), after that I will CALL GetCharWidthFloat. Is that the solution, to use GetCharWidthFloat? :

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/fontext_9ltg.asp

With this function I can use H-ACU-SPOOLER-DC? If it can, how is the rest of the parameters in the cobol-syntax? When it can not, what I have to do then? I will examine the character "0" and count de values A,B en C.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Printing and use W$TEXTSIZE

you can use H-ACU-SPOOLER-DC with GetTextExtentPoint32 and you will get the size and height of a string (sequence of characters). Just remember to have set the font before you call the funtion.

E.g.:

OPEN OUTPUT myprinter
| set the font
CALL "GetTextExtentPoint32A" USING ...


The size structure in COBOL:

01 MY-SIZE.
   03 cx PICTURE X(4) COMP-N.
   03 cy PICTURE X(4) COMP-N.


Note however that depending on the host OS cy is the height of the string, not the line. If needed, you may get this intercharacter spacing by calling GetTextCharacterExtra.
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.