]> www.fi.muni.cz Git - evince.git/blob - pdf/xpdf/T1Font.h
6c1e8f81f7af53f72986ee2739afda0862439b07
[evince.git] / pdf / xpdf / T1Font.h
1 //========================================================================
2 //
3 // T1Font.h
4 //
5 // An X wrapper for the t1lib Type 1 font rasterizer.
6 //
7 //========================================================================
8
9 #ifndef T1FONT_H
10 #define T1FONT_H
11
12 #if HAVE_T1LIB_H
13
14 #ifdef __GNUC__
15 #pragma interface
16 #endif
17
18 #include <X11/Xlib.h>
19 #include <t1lib.h>
20 #include "SFont.h"
21
22 class FontEncoding;
23
24 //------------------------------------------------------------------------
25
26 class T1FontEngine: public SFontEngine {
27 public:
28
29   T1FontEngine(Display *display, Visual *visual, int depth,
30                Colormap colormap, GBool aa, GBool aaHigh);
31   GBool isOk() { return ok; }
32   virtual ~T1FontEngine();
33
34 private:
35
36   GBool aa;                     // use anti-aliasing?
37   GBool aaHigh;                 // use high-res anti-aliasing?
38   GBool ok;
39
40   friend class T1FontFile;
41   friend class T1Font;
42 };
43
44 //------------------------------------------------------------------------
45
46 class T1FontFile: public SFontFile {
47 public:
48
49   T1FontFile(T1FontEngine *engine, char *fontFileName,
50              FontEncoding *fontEnc);
51   GBool isOk() { return ok; }
52   virtual ~T1FontFile();
53
54 private:
55
56   T1FontEngine *engine;
57   int id;                       // t1lib font ID
58   char **enc;
59   char *encStr;
60   GBool ok;
61
62   friend class T1Font;
63 };
64
65 //------------------------------------------------------------------------
66
67 struct T1FontCacheTag {
68   Gushort code;
69   Gushort mru;                  // valid bit (0x8000) and MRU index
70   int x, y, w, h;               // offset and size of glyph
71 };
72
73 class T1Font: public SFont {
74 public:
75
76   T1Font(T1FontFile *fontFile, double *m);
77   GBool isOk() { return ok; }
78   virtual ~T1Font();
79   virtual GBool drawChar(Drawable d, int w, int h, GC gc,
80                          int x, int y, int r, int g, int b, Gushort c);
81
82 private:
83
84   Guchar *getGlyphPixmap(Gushort c, int *x, int *y, int *w, int *h);
85
86   T1FontFile *fontFile;
87   int id;
88   float size;
89   XImage *image;
90   int glyphW, glyphH;           // size of glyph pixmaps
91   int glyphSize;                // size of glyph pixmaps, in bytes
92   Guchar *cache;                // glyph pixmap cache
93   T1FontCacheTag *cacheTags;    // cache tags, i.e., char codes
94   int cacheSets;                // number of sets in cache
95   int cacheAssoc;               // cache associativity (glyphs per set)
96   GBool ok;
97 };
98
99 #endif // HAVE_T1LIB_H
100
101 #endif