/src/xpdf-4.04/splash/SplashFontFile.h
Line | Count | Source (jump to first uncovered line) |
1 | | //======================================================================== |
2 | | // |
3 | | // SplashFontFile.h |
4 | | // |
5 | | // Copyright 2003-2013 Glyph & Cog, LLC |
6 | | // |
7 | | //======================================================================== |
8 | | |
9 | | #ifndef SPLASHFONTFILE_H |
10 | | #define SPLASHFONTFILE_H |
11 | | |
12 | | #include <aconf.h> |
13 | | |
14 | | #ifdef USE_GCC_PRAGMAS |
15 | | #pragma interface |
16 | | #endif |
17 | | |
18 | | #include "gtypes.h" |
19 | | #include "SplashTypes.h" |
20 | | |
21 | | #if MULTITHREADED |
22 | | #include "GMutex.h" |
23 | | #endif |
24 | | |
25 | | class GString; |
26 | | class SplashFontEngine; |
27 | | class SplashFont; |
28 | | class SplashFontFileID; |
29 | | |
30 | | //------------------------------------------------------------------------ |
31 | | // SplashFontType |
32 | | //------------------------------------------------------------------------ |
33 | | |
34 | | enum SplashFontType { |
35 | | splashFontType1, // GfxFontType.fontType1 |
36 | | splashFontType1C, // GfxFontType.fontType1C |
37 | | splashFontOpenTypeT1C, // GfxFontType.fontType1COT |
38 | | splashFontCID, // GfxFontType.fontCIDType0/fontCIDType0C |
39 | | splashFontOpenTypeCFF, // GfxFontType.fontCIDType0COT |
40 | | splashFontTrueType // GfxFontType.fontTrueType/fontTrueTypeOT/ |
41 | | // fontCIDType2/fontCIDType2OT |
42 | | }; |
43 | | |
44 | | //------------------------------------------------------------------------ |
45 | | // SplashFontFile |
46 | | //------------------------------------------------------------------------ |
47 | | |
48 | | class SplashFontFile { |
49 | | public: |
50 | | |
51 | | virtual ~SplashFontFile(); |
52 | | |
53 | | // Create a new SplashFont, i.e., a scaled instance of this font |
54 | | // file. |
55 | | virtual SplashFont *makeFont(SplashCoord *mat, SplashCoord *textMat) = 0; |
56 | | |
57 | | // Get the font file ID. |
58 | 0 | SplashFontFileID *getID() { return id; } |
59 | | |
60 | | // Increment the reference count. |
61 | | void incRefCnt(); |
62 | | |
63 | | // Decrement the reference count. If the new value is zero, delete |
64 | | // the SplashFontFile object. |
65 | | void decRefCnt(); |
66 | | |
67 | | protected: |
68 | | |
69 | | SplashFontFile(SplashFontFileID *idA, |
70 | | SplashFontType fontTypeA, |
71 | | #if LOAD_FONTS_FROM_MEM |
72 | | GString *fontBufA |
73 | | #else |
74 | | char *fileNameA, GBool deleteFileA |
75 | | #endif |
76 | | ); |
77 | | |
78 | | SplashFontFileID *id; |
79 | | SplashFontType fontType; |
80 | | #if LOAD_FONTS_FROM_MEM |
81 | | GString *fontBuf; |
82 | | #else |
83 | | GString *fileName; |
84 | | GBool deleteFile; |
85 | | #endif |
86 | | #if MULTITHREADED |
87 | | GAtomicCounter refCnt; |
88 | | #else |
89 | | int refCnt; |
90 | | #endif |
91 | | |
92 | | friend class SplashFontEngine; |
93 | | }; |
94 | | |
95 | | #endif |