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