home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / S12219.ZIP / VF01.C < prev    next >
C/C++ Source or Header  |  1988-11-29  |  2KB  |  52 lines

  1. /*-----------------------------------------
  2.    VF01.C -- Display 24-point vector fonts
  3.   -----------------------------------------*/
  4.  
  5. #define INCL_GPI
  6. #include <os2.h>
  7. #include <string.h>
  8. #include "vectfont.h"
  9.  
  10. VOID Display_24Point (HPS hps, LONG cxClient, LONG cyClient)
  11.      {
  12.      static CHAR *szFacename[] = {
  13.                                  "Courier",      "Courier Italic",
  14.                                  "Courier Bold", "Courier Bold Italic",
  15.                                  "Tms Rmn",      "Tms Rmn Italic",
  16.                                  "Tms Rmn Bold", "Tms Rmn Bold Italic",
  17.                                  "Helv",         "Helv Italic",
  18.                                  "Helv Bold",    "Helv Bold Italic"
  19.                                  } ;
  20.      static INT  iNumFonts = sizeof szFacename / sizeof szFacename[0] ;
  21.      FONTMETRICS fm ;
  22.      INT         iFont ;
  23.      POINTL      ptl ;
  24.  
  25.      ptl.x = cxClient / 8 ;
  26.      ptl.y = cyClient ;
  27.  
  28.      for (iFont = 0 ; iFont < iNumFonts ; iFont++)
  29.           {
  30.                                    // Create font, select it and scale
  31.  
  32.           CreateVectorFont (hps, LCID_MYFONT, szFacename[iFont]) ;
  33.           GpiSetCharSet (hps, LCID_MYFONT) ;
  34.           ScaleVectorFont (hps, 240, 240) ;
  35.  
  36.                                    // Get font metrics for scaled font
  37.  
  38.           GpiQueryFontMetrics (hps, (LONG) sizeof (FONTMETRICS), &fm) ;
  39.           ptl.y -= fm.lMaxBaselineExt ;
  40.  
  41.                                    // Display the font facename
  42.  
  43.           GpiCharStringAt (hps, &ptl, (LONG) strlen (szFacename[iFont]),
  44.                            szFacename[iFont]) ;
  45.  
  46.           GpiCharString (hps, 10L, " - abcdefg") ;
  47.  
  48.           GpiSetCharSet (hps, LCID_DEFAULT) ;     // Clean up
  49.           GpiDeleteSetId (hps, LCID_MYFONT) ;
  50.           }
  51.      }
  52.