home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / include / logfont.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-16  |  2.0 KB  |  49 lines

  1. //-----------------------------------------------------------------------------------//
  2. //              Windows Graphics Programming: Win32 GDI and DirectDraw               //
  3. //                             ISBN  0-13-086985-6                                   //
  4. //                                                                                   //
  5. //  Written            by  Yuan, Feng                             www.fengyuan.com   //
  6. //  Copyright (c) 2000 by  Hewlett-Packard Company                www.hp.com         //
  7. //  Published          by  Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com      //
  8. //                                                                                   //
  9. //  FileName   : logfont.h                                                             //
  10. //  Description: Logical font wrapper                                                //
  11. //  Version    : 1.00.000, May 31, 2000                                              //
  12. //-----------------------------------------------------------------------------------//
  13.  
  14. class KLogFont
  15. {
  16. public:
  17.  
  18.     LOGFONTA        m_LogFont;
  19.  
  20.     KLogFont(int height, const TCHAR * FaceName )
  21.     {
  22.         m_LogFont.lfHeight           = height;
  23.         m_LogFont.lfWidth           = 0;
  24.         m_LogFont.lfEscapement     = 0;
  25.         m_LogFont.lfOrientation    = 0;
  26.         m_LogFont.lfWeight         = FW_NORMAL;
  27.         m_LogFont.lfItalic         = FALSE;
  28.         m_LogFont.lfUnderline      = FALSE;
  29.         m_LogFont.lfStrikeOut      = FALSE;
  30.         m_LogFont.lfCharSet        = DEFAULT_CHARSET;
  31.         m_LogFont.lfOutPrecision   = OUT_TT_PRECIS;
  32.         m_LogFont.lfClipPrecision  = CLIP_DEFAULT_PRECIS;
  33.         m_LogFont.lfQuality        = ANTIALIASED_QUALITY;
  34.         m_LogFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
  35.         _tcscpy(m_LogFont.lfFaceName, FaceName);
  36.     }
  37.  
  38.     void SetHeight(int height)   { m_LogFont.lfHeight = height; }
  39.     void SetWidth (int width )   { m_LogFont.lfWidth  = width;  }
  40.     VOID SetCharSet(BYTE cs  )   { m_LogFont.lfCharSet = cs;    }
  41.  
  42.     HFONT Create(void)
  43.     {
  44.         return ::CreateFontIndirect(& m_LogFont);
  45.     }
  46.  
  47. };
  48.  
  49.