home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / pctchnqs / 1991 / number2 / font.hpp < prev    next >
C/C++ Source or Header  |  1991-03-08  |  2KB  |  52 lines

  1. //-------------------------------------------------------------//
  2. // File:   Font.Hpp                                            //
  3. // Desc:   Definition for a generic Font Class                 //
  4. // Author: Marv Luse, Autumn Hill Software                     //
  5. //-------------------------------------------------------------//
  6.  
  7. #ifndef _FONT_HPP_
  8. #define _FONT_HPP_
  9.  
  10. #include "Charactr.Hpp"
  11.  
  12. //........ Font Class
  13.  
  14. class Font
  15. {
  16.    public:
  17.  
  18.       int        fstatus;   // font status flag
  19.  
  20.    protected:
  21.  
  22.       int        cell_w;    // cell width in pixels
  23.       int        cell_h;    // cell height in pixels
  24.       int        ascent;    // ascent dist in pixels
  25.       int        descent;   // descent dist in pixels
  26.       int        pitch;     // default pitch in pixels
  27.       int        ch_cnt;    // allocated Character cnt
  28.       int        min_ch;    // min ASCII char code
  29.       int        max_ch;    // max ASCII char code
  30.       Character *ch;        // allocated Character array
  31.  
  32.    public:
  33.  
  34.       Font( );
  35.       Font( int bgn_ch, int end_ch );
  36.      ~Font( );
  37.       int chmin( void ) { return min_ch; }
  38.       int chmax( void ) { return max_ch; }
  39.       int chcnt( void ) { return ch_cnt; }
  40.       int  strwidth( char *str );
  41.       int  strheight( char *str );
  42.       void drawstr( int x, int y, int clr, char *str );
  43. };
  44.  
  45. // constants for Font.fstatus
  46.  
  47. const int fntNOINIT  =  0;   // font never initialized
  48. const int fntOKAY    =  1;   // font successfully instantiated
  49. const int fntFAILED  = -1;   // some kind of failure
  50.  
  51. #endif
  52.