Using Intel® Visual Fortran to Create and Build Windows*-Based Applications

ID 757211
Date 7/23/2021
Public
Document Table of Contents
Give Feedback

SHOWFONT.F90 Example

The program SHOWFONT.F90 displays text in the fonts available on your system. (Once the screen fills with text, press Enter to display the next screen.) An abbreviated version follows. SHOWFONT calls SETFONT to specify the typeface. MOVETO then establishes the starting point for each text string. The program sends a message of sample text to the screen for each font initialized:

! Abbreviated version of SHOWFONT.F90.
   USE IFQWIN
   INTEGER(2) grstat, numfonts,indx, curr_height
   TYPE (xycoord) xyt
   TYPE (fontinfo) f
   CHARACTER(6) str     ! 5 chars for font num
                        ! (max. is 32767), 1 for 'n'
! Initialization.
   numfonts=INITIALIZEFONTS( )
   IF (numfonts.LE.0) PRINT *,"INITIALIZEFONTS error"
   IF (GRSTATUS().NE.$GROK) PRINT *,'INITIALIZEFONTS GRSTATUS error.'
   CALL MOVETO (0,0,xyt)
   grstat=SETCOLORRGB(#FF0000)
   grstat=FLOODFILLRGB(0, 0, #00FF00)
   grstat=SETCOLORRGB(0)
! Get default font height for comparison later.
   grstat = SETFONT('n1')
   grstat = GETFONTINFO(f)
   curr_height = f.pixheight
! Done initializing, start displaying fonts.
   DO indx=1,numfonts
      WRITE(str,10)indx
      grstat=SETFONT(str)
      IF (grstat.LT.1) THEN
         CALL OUTGTEXT('SetFont error.')
      ELSE
         grstat=GETFONTINFO(f)
         grstat=SETFONT('n1')
         CALL OUTGTEXT(f.facename(:len_trim(f.facename)))
         CALL OUTGTEXT(' ')
! Display font.
         grstat=SETFONT(str)
         CALL OUTGTEXT('ABCDEFGabcdefg12345!@#$%')
      END IF
! Go to next line.
      IF (f.pixheight .GT. curr_height) curr_height=f.pixheight
      CALL GETCURRENTPOSITION(xyt)
      CALL MOVETO(0,INT2(xyt.ycoord+curr_height),xyt)
   END DO
10  FORMAT ('n',I5.5)
   END