home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / pcmag / vol12n08.zip / OLFDEM.ZIP / OLFROT.C < prev    next >
C/C++ Source or Header  |  1993-02-03  |  2KB  |  55 lines

  1. /*----------------------------------------
  2.    OLFROT.C -- Rotated OS/2 Outline Fonts
  3.                (c) Charles Petzold, 1993
  4.   ----------------------------------------*/
  5.  
  6. #define INCL_WIN
  7. #define INCL_GPI
  8. #include <os2.h>
  9. #include <math.h>
  10. #include <string.h>
  11. #include "olf.h"
  12.  
  13. #define LCID_FONT    1
  14. #define TWO_PI       (2 * 3.14159)
  15.  
  16. void PaintClient (HPS hps, SHORT cxClient, SHORT cyClient)
  17.      {
  18.      static CHAR szText [] = "  Rotated Font" ;
  19.      double      dAngle ;
  20.      GRADIENTL   gradl ;
  21.      POINTL      ptl ;
  22.  
  23.           // Set POINTL structure to center of client
  24.  
  25.      ptl.x = cxClient / 2 ;
  26.      ptl.y = cyClient / 2 ;
  27.  
  28.           // Create the logical font, select it, and scale it
  29.  
  30.      CreateOutlineFont (hps, LCID_FONT, "Helvetica", 0, 0) ;
  31.      GpiSetCharSet (hps, LCID_FONT) ;
  32.      ScaleOutlineFont (hps, 240, 240) ;
  33.  
  34.           // Loop through the character angles
  35.  
  36.      for (dAngle = 0 ; dAngle < 360 ; dAngle += 22.5)
  37.           {
  38.                // Set the character angle
  39.  
  40.           gradl.x = (LONG) (100 * cos (TWO_PI * dAngle / 360)) ;
  41.           gradl.y = (LONG) (100 * sin (TWO_PI * dAngle / 360)) ;
  42.  
  43.           GpiSetCharAngle (hps, &gradl) ;
  44.  
  45.                // Display the character string
  46.  
  47.           GpiCharStringAt (hps, &ptl, strlen (szText), szText) ;
  48.           }
  49.  
  50.           // Select the default font; delete the logical font
  51.  
  52.      GpiSetCharSet (hps, LCID_DEFAULT) ;
  53.      GpiDeleteSetId (hps, LCID_FONT) ;
  54.      }
  55.