1//========================================================================
2//
3// SplashFontEngine.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, 2011, 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// Copyright (C) 2018 Oliver Sander <oliver.sander@tu-dresden.de>
21//
22// To see a description of the changes please see the Changelog file that
23// came with your tarball or type make ChangeLog if you are building from git
24//
25//========================================================================
26
27#ifndef SPLASHFONTENGINE_H
28#define SPLASHFONTENGINE_H
29
30#include <array>
31
32#include "SplashTypes.h"
33#include "poppler_private_export.h"
34
35class SplashT1FontEngine;
36class SplashFTFontEngine;
37class SplashDTFontEngine;
38class SplashDT4FontEngine;
39class SplashFontFile;
40class SplashFontFileID;
41class SplashFont;
42class SplashFontSrc;
43
44//------------------------------------------------------------------------
45// SplashFontEngine
46//------------------------------------------------------------------------
47
48class POPPLER_PRIVATE_EXPORT SplashFontEngine
49{
50public:
51 // Create a font engine.
52 SplashFontEngine(bool enableFreeType, bool enableFreeTypeHinting, bool enableSlightHinting, bool aa);
53
54 ~SplashFontEngine();
55
56 SplashFontEngine(const SplashFontEngine &) = delete;
57 SplashFontEngine &operator=(const SplashFontEngine &) = delete;
58
59 // Get a font file from the cache. Returns NULL if there is no
60 // matching entry in the cache.
61 SplashFontFile *getFontFile(SplashFontFileID *id);
62
63 // Load fonts - these create new SplashFontFile objects.
64 SplashFontFile *loadType1Font(SplashFontFileID *idA, SplashFontSrc *src, const char **enc);
65 SplashFontFile *loadType1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc);
66 SplashFontFile *loadOpenTypeT1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc);
67 SplashFontFile *loadCIDFont(SplashFontFileID *idA, SplashFontSrc *src);
68 SplashFontFile *loadOpenTypeCFFFont(SplashFontFileID *idA, SplashFontSrc *src, int *codeToGID, int codeToGIDLen);
69 SplashFontFile *loadTrueTypeFont(SplashFontFileID *idA, SplashFontSrc *src, int *codeToGID, int codeToGIDLen, int faceIndex = 0);
70
71 // Get a font - this does a cache lookup first, and if not found,
72 // creates a new SplashFont object and adds it to the cache. The
73 // matrix, mat = textMat * ctm:
74 // [ mat[0] mat[1] ]
75 // [ mat[2] mat[3] ]
76 // specifies the font transform in PostScript style:
77 // [x' y'] = [x y] * mat
78 // Note that the Splash y axis points downward.
79 SplashFont *getFont(SplashFontFile *fontFile, const SplashCoord *textMat, const SplashCoord *ctm);
80 bool getAA();
81 void setAA(bool aa);
82
83private:
84 std::array<SplashFont *, 16> fontCache;
85
86 SplashFTFontEngine *ftEngine;
87};
88
89#endif
90

source code of poppler/splash/SplashFontEngine.h