1 //========================================================================
2 //
3 // SplashFTFontFile.h
4 //
5 // Copyright 2003-2013 Glyph & Cog, LLC
6 //
7 //========================================================================
8 
9 #ifndef SPLASHFTFONTFILE_H
10 #define SPLASHFTFONTFILE_H
11 
12 #include <aconf.h>
13 
14 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
15 
16 #ifdef USE_GCC_PRAGMAS
17 #pragma interface
18 #endif
19 
20 #include <ft2build.h>
21 #include FT_FREETYPE_H
22 #include "SplashFontFile.h"
23 
24 class SplashFontFileID;
25 class SplashFTFontEngine;
26 
27 //------------------------------------------------------------------------
28 // SplashFTFontFile
29 //------------------------------------------------------------------------
30 
31 class SplashFTFontFile: public SplashFontFile {
32 public:
33 
34   static SplashFontFile *loadType1Font(SplashFTFontEngine *engineA,
35 				       SplashFontFileID *idA,
36 #if LOAD_FONTS_FROM_MEM
37 				       GString *fontBufA,
38 #else
39 				       char *fileNameA, GBool deleteFileA,
40 #endif
41 				       const char **encA,
42 				       GBool useLightHintingA);
43   static SplashFontFile *loadCIDFont(SplashFTFontEngine *engineA,
44 				     SplashFontFileID *idA,
45 #if LOAD_FONTS_FROM_MEM
46 				     GString *fontBufA,
47 #else
48 				     char *fileNameA, GBool deleteFileA,
49 #endif
50 				     int *codeToGIDA, int codeToGIDLenA);
51   static SplashFontFile *loadTrueTypeFont(SplashFTFontEngine *engineA,
52 					  SplashFontFileID *idA,
53 #if LOAD_FONTS_FROM_MEM
54 					  GString *fontBufA,
55 #else
56 					  char *fileNameA,
57 					  GBool deleteFileA,
58 #endif
59 					  int fontNum,
60 					  int *codeToGIDA,
61 					  int codeToGIDLenA);
62 
63   virtual ~SplashFTFontFile();
64 
65   // Create a new SplashFTFont, i.e., a scaled instance of this font
66   // file.
67   virtual SplashFont *makeFont(SplashCoord *mat,
68 			       SplashCoord *textMat);
69 
70 private:
71 
72   SplashFTFontFile(SplashFTFontEngine *engineA,
73 		   SplashFontFileID *idA,
74 #if LOAD_FONTS_FROM_MEM
75 		   GString *fontBufA,
76 #else
77 		   char *fileNameA, GBool deleteFileA,
78 #endif
79 		   FT_Face faceA,
80 		   int *codeToGIDA, int codeToGIDLenA,
81 		   GBool trueTypeA, GBool useLightHintingA);
82 
83   SplashFTFontEngine *engine;
84   FT_Face face;
85   int *codeToGID;
86   int codeToGIDLen;
87   GBool trueType;
88   GBool useLightHinting;
89 
90   friend class SplashFTFont;
91 };
92 
93 #endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
94 
95 #endif
96