home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / tex / lametex_.z / lametex_ / lametex / src / Font.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-02  |  1.9 KB  |  98 lines

  1. /* Font.h
  2.  *
  3.  * Anything having to do with changing the style, family, or size of the
  4.  * fonts is handled through this Font class.
  5.  *
  6.  * Copyright 1992 Jonathan Monsarrat. Permission given to freely distribute,
  7.  * edit and use as long as this copyright statement remains intact.
  8.  *
  9.  */
  10.  
  11. #include <fstream.h>
  12.  
  13. const MAXFONTS = 100;
  14. /* The list of what fonts are used, and in what order and with what
  15.  * characters
  16.  */
  17. class FontUsed {
  18.    char _style[MAXSTRING];   // combines font style and font size
  19.    char _petname[MAXSTRING];  // The name we use for this font
  20.    int _charused[256];
  21.    int _font;
  22.  
  23.  public:
  24.    FontUsed(char *, char *, int);
  25.    void used(char *);
  26.    int font();
  27.    int match(char *);
  28.    char *petname();
  29.    void dump(ofstream &);
  30. };
  31.  
  32.  
  33. /* Any change to the font type, size, or style */
  34. class Font : public Param {
  35.  public:
  36.    enum FontTypes {
  37.       // Base Sizes
  38.       Base10pt,
  39.       Base11pt,
  40.       Base12pt,
  41.  
  42.       // Font Styles
  43.       Bold,
  44.       Italic,
  45.       Roman,
  46.       SansSerif,
  47.       Slant,
  48.       SmallCaps,
  49.       Typewriter,
  50.  
  51.       // Font Sizes
  52.       Tiny,
  53.       Scriptsize, 
  54.       Footnotesize,
  55.       Small,
  56.       Normalsize,
  57.       large,
  58.       Large,
  59.       LARGE,
  60.       huge,
  61.       Huge,
  62.  
  63.       // Font Commands
  64.       Base,
  65.       Currentused,
  66.       FunnyPrint,
  67.       Pending,
  68.       Size,
  69.       Style,
  70.       ShutDown,
  71.       Used
  72.    };
  73.  
  74.    Font();
  75.    Font(Font *);
  76.    ~Font();
  77.    Param *copy();
  78.    int set(int, float, char*);
  79.    float get(int, char*);
  80.    static FontUsed *_fonts_used[MAXFONTS];
  81.    static int _num_fonts_used;
  82.    int do_command(char *, char *, int, int);
  83.    void postscript_set(int);
  84.    void revert(Param *);
  85.    void shutdown();
  86.    void use_command(char *, char *, int);
  87.  private:
  88.    int _basesize;
  89.    int _fontsize;
  90.    char _fontstyle[3];
  91.    char _fontsizecmd[15];
  92.    int _currentused;
  93.    int _pending;
  94.    int _pending_whitespace;
  95.    void newsize(float);
  96.    void set_fontstyle(char *);
  97. };
  98.