]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | //======================================================================== |
2 | // | |
3 | // SplashFontEngine.h | |
4 | // | |
5 | //======================================================================== | |
6 | ||
7 | #ifndef SPLASHFONTENGINE_H | |
8 | #define SPLASHFONTENGINE_H | |
9 | ||
10 | #include <config.h> | |
11 | ||
12 | #ifdef USE_GCC_PRAGMAS | |
13 | #pragma interface | |
14 | #endif | |
15 | ||
16 | #include "gtypes.h" | |
17 | ||
18 | class SplashT1FontEngine; | |
19 | class SplashFTFontEngine; | |
20 | class SplashDTFontEngine; | |
21 | class SplashDT4FontEngine; | |
22 | class SplashFontFile; | |
23 | class SplashFontFileID; | |
24 | class SplashFont; | |
25 | ||
26 | //------------------------------------------------------------------------ | |
27 | ||
28 | #define splashFontCacheSize 16 | |
29 | ||
30 | //------------------------------------------------------------------------ | |
31 | // SplashFontEngine | |
32 | //------------------------------------------------------------------------ | |
33 | ||
34 | class SplashFontEngine { | |
35 | public: | |
36 | ||
37 | // Create a font engine. | |
38 | SplashFontEngine( | |
39 | #if HAVE_T1LIB_H | |
40 | GBool enableT1lib, | |
41 | #endif | |
42 | #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H | |
43 | GBool enableFreeType, | |
44 | #endif | |
45 | GBool aa); | |
46 | ||
47 | ~SplashFontEngine(); | |
48 | ||
49 | // Get a font file from the cache. Returns NULL if there is no | |
50 | // matching entry in the cache. | |
51 | SplashFontFile *getFontFile(SplashFontFileID *id); | |
52 | ||
53 | // Load fonts - these create new SplashFontFile objects. | |
54 | SplashFontFile *loadType1Font(SplashFontFileID *idA, char *fileName, | |
55 | GBool deleteFile, char **enc); | |
56 | SplashFontFile *loadType1CFont(SplashFontFileID *idA, char *fileName, | |
57 | GBool deleteFile, char **enc); | |
58 | SplashFontFile *loadCIDFont(SplashFontFileID *idA, char *fileName, | |
59 | GBool deleteFile); | |
60 | SplashFontFile *loadTrueTypeFont(SplashFontFileID *idA, char *fileName, | |
61 | GBool deleteFile, | |
62 | Gushort *codeToGID, int codeToGIDLen); | |
63 | ||
64 | // Get a font - this does a cache lookup first, and if not found, | |
65 | // creates a new SplashFont object and adds it to the cache. The | |
66 | // matrix: | |
67 | // [ mat[0] mat[1] ] | |
68 | // [ mat[2] mat[3] ] | |
69 | // specifies the font transform in PostScript style: | |
70 | // [x' y'] = [x y] * mat | |
71 | // Note that the Splash y axis points downward. | |
72 | SplashFont *getFont(SplashFontFile *fontFile, SplashCoord *mat); | |
73 | ||
74 | private: | |
75 | ||
76 | SplashFont *fontCache[splashFontCacheSize]; | |
77 | ||
78 | #if HAVE_T1LIB_H | |
79 | SplashT1FontEngine *t1Engine; | |
80 | #endif | |
81 | #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H | |
82 | SplashFTFontEngine *ftEngine; | |
83 | #endif | |
84 | }; | |
85 | ||
86 | #endif |