1 //========================================================================
2 //
3 // SplashFTFontEngine.h
4 //
5 //========================================================================
6 
7 //========================================================================
8 //
9 // Modified under the Poppler project - http://poppler.freedesktop.org
10 //
11 // All changes made under the Poppler project to this file are licensed
12 // under GPL version 2 or later
13 //
14 // Copyright (C) 2006 Takashi Iwai <tiwai@suse.de>
15 // Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com>
16 // Copyright (C) 2009, 2018 Albert Astals Cid <aacid@kde.org>
17 // Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com>
18 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
19 // Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com>
20 //
21 // To see a description of the changes please see the Changelog file that
22 // came with your tarball or type make ChangeLog if you are building from git
23 //
24 //========================================================================
25 
26 #ifndef SPLASHFTFONTENGINE_H
27 #define SPLASHFTFONTENGINE_H
28 
29 #include <ft2build.h>
30 #include FT_FREETYPE_H
31 
32 class SplashFontFile;
33 class SplashFontFileID;
34 class SplashFontSrc;
35 
36 //------------------------------------------------------------------------
37 // SplashFTFontEngine
38 //------------------------------------------------------------------------
39 
40 class SplashFTFontEngine
41 {
42 public:
43     static SplashFTFontEngine *init(bool aaA, bool enableFreeTypeHintingA, bool enableSlightHinting);
44 
45     ~SplashFTFontEngine();
46 
47     SplashFTFontEngine(const SplashFTFontEngine &) = delete;
48     SplashFTFontEngine &operator=(const SplashFTFontEngine &) = delete;
49 
50     // Load fonts.
51     SplashFontFile *loadType1Font(SplashFontFileID *idA, SplashFontSrc *src, const char **enc);
52     SplashFontFile *loadType1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc);
53     SplashFontFile *loadOpenTypeT1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc);
54     SplashFontFile *loadCIDFont(SplashFontFileID *idA, SplashFontSrc *src);
55     SplashFontFile *loadOpenTypeCFFFont(SplashFontFileID *idA, SplashFontSrc *src, int *codeToGID, int codeToGIDLen);
56     SplashFontFile *loadTrueTypeFont(SplashFontFileID *idA, SplashFontSrc *src, int *codeToGID, int codeToGIDLen, int faceIndex = 0);
getAA()57     bool getAA() { return aa; }
setAA(bool aaA)58     void setAA(bool aaA) { aa = aaA; }
59 
60 private:
61     SplashFTFontEngine(bool aaA, bool enableFreeTypeHintingA, bool enableSlightHintingA, FT_Library libA);
62 
63     bool aa;
64     bool enableFreeTypeHinting;
65     bool enableSlightHinting;
66     FT_Library lib;
67     bool useCIDs;
68 
69     friend class SplashFTFontFile;
70     friend class SplashFTFont;
71 };
72 
73 #endif
74