Skip to main content

[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.

[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.
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.

[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.
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?

[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.
After preview reply the attachement was away. So here an attachment.

[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.
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.

[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.
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.

[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.
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.