PC_PRINTER_GET_FONT

Restriction:
  • This routine is not supported when CHARSET"EBCDIC" is in effect.
Gets the font on the printer.

Syntax:

call "PC_PRINTER_GET_FONT" using     printer-handle
                                      font-family-name
                                      font-size
                                      font-style
                            returning status-code

Parameters

printer-handle
Call prototype (see Key): cblt-x4-comp5
Picture: pic x(4) comp-5.
font-family-name
Group predefined as cblt-printer-name containing:
01 cblt-printer-name       typedef.
  03 cblte-pn-name-length  cblt-x2-comp5. *> pic x(2) comp-5.
  03 cblte-pn-name         cblt-x1.       *> Occurs depending on
                                          *> cblte-pn-name-length.  pic x(n).
font-size
Call prototype (see Key): cblt-x4-comp5
Picture: pic x(4) comp-5.
font-style
Call prototype (see Key): cblt-x4-comp5
Picture: pic x(4) comp-5.
status-code
See Library Routines - Key.

On Entry:

printer-handle The printer handle returned when the printer was opened.
cblte-pn-name-len The length of the buffer for the font-family name.

On Exit:

printer-handle
The printer handle returned when the printer was opened.
cblte-pn-name-len
The length of the buffer for the font-family name.
name-len
The length of the buffer for the font-family name. If the length is zero no font is returned, and the operating system default is used (font-size and font-style are then invalid).
name-text
The family name of the font to be used (for example, Courier,Symbol, Times New Roman, and so on).
font-size
The point-size of the font.
font-style
The font-style set:
3 Bold
2 Strikeout
1 Underline
0 Italic

All remaining bits are reserved for future.

Example:

 working-storage section.
 01.
   03 document-title.
     05 title-len           pic x(2) comp-5.
     05 title-text          pic x(20).

   03 font-family.
     05 font-family-namelen  pic x(2) comp-5 value 80.
     05 font-family-name     pic x(80).

   03 font-size              pic x(4) comp-5.
   03 font-style             pic x(4) comp-5.
 
   03 abort                  pic x(4) comp-5 value 1.
   03 control                pic x(4) comp-5 value 2.
   03 flags                  pic x(4) comp-5 value 3.
   03 handle                 pic x(4) comp-5.

 procedure division.
     move 17 to title-len
     move "Printer Info Test" to title-text

     call "PC_PRINTER_OPEN" using by reference handle
                                  by reference document-title
                                  by value flags
                                  by value 0
     end-call

     if return-code = zero
         call "PC_PRINTER_GET_FONT" 
                               using by reference handle
                                     by reference font-family
                                     by reference font-size
                                     by reference font-style
         end-call
         if return-code equal zero
             if font-size equal zero
                 display "Current Font   : no font selected"
             else
                 display "Current Font   : "
                       font-family-name(1:font-family-namelen)
                 display "Font size      : " font-size
                 display "Raw Font Style : " font-style
             end-if
         else
             display "PC_PRINTER_GET_FONT failed"
         end-if
     end-if

     perform close-down-printer
     .

 close-down-printer section.
     call "PC_PRINTER_CONTROL" using by reference handle
                                     by value abort
     end-call

     call "PC_PRINTER_CLOSE" using by reference handle
     end-call
     .