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