summaryrefslogtreecommitdiff
path: root/support/lametex/src/Font.h
blob: 7f691d3f2408fa21d9a55cd81925f6fbedc9d746 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* Font.h
 *
 * Anything having to do with changing the style, family, or size of the
 * fonts is handled through this Font class.
 *
 * Copyright 1992 Jonathan Monsarrat. Permission given to freely distribute,
 * edit and use as long as this copyright statement remains intact.
 *
 */

#include <fstream.h>

const MAXFONTS = 100;
/* The list of what fonts are used, and in what order and with what
 * characters
 */
class FontUsed {
   char _style[MAXSTRING];   // combines font style and font size
   char _petname[MAXSTRING];  // The name we use for this font
   int _charused[256];
   int _font;

 public:
   FontUsed(char *, char *, int);
   void used(char *);
   int font();
   int match(char *);
   char *petname();
   void dump(ofstream &);
};


/* Any change to the font type, size, or style */
class Font : public Param {
 public:
   enum FontTypes {
      // Base Sizes
      Base10pt,
      Base11pt,
      Base12pt,

      // Font Styles
      Bold,
      Italic,
      Roman,
      SansSerif,
      Slant,
      SmallCaps,
      Typewriter,

      // Font Sizes
      Tiny,
      Scriptsize, 
      Footnotesize,
      Small,
      Normalsize,
      large,
      Large,
      LARGE,
      huge,
      Huge,

      // Font Commands
      Base,
      Currentused,
      FunnyPrint,
      Pending,
      Size,
      Style,
      ShutDown,
      Used
   };

   Font();
   Font(Font *);
   ~Font();
   Param *copy();
   int set(int, float, char*);
   float get(int, char*);
   static FontUsed *_fonts_used[MAXFONTS];
   static int _num_fonts_used;
   int do_command(char *, char *, int, int);
   void postscript_set(int);
   void revert(Param *);
   void shutdown();
   void use_command(char *, char *, int);
 private:
   int _basesize;
   int _fontsize;
   char _fontstyle[3];
   char _fontsizecmd[15];
   int _currentused;
   int _pending;
   int _pending_whitespace;
   void newsize(float);
   void set_fontstyle(char *);
};