]> git.ipfire.org Git - thirdparty/cups.git/blob - pdftops/T1Font.h
Import cups.org releases
[thirdparty/cups.git] / pdftops / 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 *displayA, Visual *visualA, int depthA,
30 Colormap colormapA, GBool aaA, GBool aaHighA);
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 *engineA, char *fontFileName,
50 FontEncoding *fontEnc, double *bboxA);
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 double bbox[4];
61 GBool ok;
62
63 friend class T1Font;
64 };
65
66 //------------------------------------------------------------------------
67
68 struct T1FontCacheTag {
69 Gushort code;
70 Gushort mru; // valid bit (0x8000) and MRU index
71 int x, y, w, h; // offset and size of glyph
72 };
73
74 class T1Font: public SFont {
75 public:
76
77 T1Font(T1FontFile *fontFileA, double *m);
78 GBool isOk() { return ok; }
79 virtual ~T1Font();
80 virtual GBool drawChar(Drawable d, int w, int h, GC gc,
81 int x, int y, int r, int g, int b, Gushort c);
82
83 private:
84
85 Guchar *getGlyphPixmap(Gushort c, int *x, int *y, int *w, int *h);
86
87 T1FontFile *fontFile;
88 int id;
89 float size;
90 XImage *image;
91 int glyphW, glyphH; // size of glyph pixmaps
92 int glyphSize; // size of glyph pixmaps, in bytes
93 Guchar *cache; // glyph pixmap cache
94 T1FontCacheTag *cacheTags; // cache tags, i.e., char codes
95 int cacheSets; // number of sets in cache
96 int cacheAssoc; // cache associativity (glyphs per set)
97 GBool ok;
98 };
99
100 #endif // HAVE_T1LIB_H
101
102 #endif