1//========================================================================
2//
3// SplashFTFontEngine.cc
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, 2011, 2012, 2022 Albert Astals Cid <aacid@kde.org>
16// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com>
17// Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com>
18// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com>
19// Copyright (C) 2019 Christian Persch <chpe@src.gnome.org>
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#include <config.h>
27
28#include <cstdio>
29#ifdef HAVE_UNISTD_H
30# include <unistd.h>
31#endif
32#include "goo/gmem.h"
33#include "goo/GooString.h"
34#include "goo/gfile.h"
35#include "fofi/FoFiTrueType.h"
36#include "fofi/FoFiType1C.h"
37#include "SplashFTFontFile.h"
38#include "SplashFTFontEngine.h"
39
40//------------------------------------------------------------------------
41// SplashFTFontEngine
42//------------------------------------------------------------------------
43
44SplashFTFontEngine::SplashFTFontEngine(bool aaA, bool enableFreeTypeHintingA, bool enableSlightHintingA, FT_Library libA)
45{
46 aa = aaA;
47 enableFreeTypeHinting = enableFreeTypeHintingA;
48 enableSlightHinting = enableSlightHintingA;
49 lib = libA;
50}
51
52SplashFTFontEngine *SplashFTFontEngine::init(bool aaA, bool enableFreeTypeHintingA, bool enableSlightHintingA)
53{
54 FT_Library libA;
55
56 if (FT_Init_FreeType(alibrary: &libA)) {
57 return nullptr;
58 }
59 return new SplashFTFontEngine(aaA, enableFreeTypeHintingA, enableSlightHintingA, libA);
60}
61
62SplashFTFontEngine::~SplashFTFontEngine()
63{
64 FT_Done_FreeType(library: lib);
65}
66
67SplashFontFile *SplashFTFontEngine::loadType1Font(SplashFontFileID *idA, SplashFontSrc *src, const char **enc)
68{
69 return SplashFTFontFile::loadType1Font(engineA: this, idA, src, encA: enc);
70}
71
72SplashFontFile *SplashFTFontEngine::loadType1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc)
73{
74 return SplashFTFontFile::loadType1Font(engineA: this, idA, src, encA: enc);
75}
76
77SplashFontFile *SplashFTFontEngine::loadOpenTypeT1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc)
78{
79 return SplashFTFontFile::loadType1Font(engineA: this, idA, src, encA: enc);
80}
81
82SplashFontFile *SplashFTFontEngine::loadCIDFont(SplashFontFileID *idA, SplashFontSrc *src)
83{
84 return SplashFTFontFile::loadCIDFont(engineA: this, idA, src, codeToGIDA: nullptr, codeToGIDLenA: 0);
85}
86
87SplashFontFile *SplashFTFontEngine::loadOpenTypeCFFFont(SplashFontFileID *idA, SplashFontSrc *src, int *codeToGID, int codeToGIDLen)
88{
89 return SplashFTFontFile::loadCIDFont(engineA: this, idA, src, codeToGIDA: codeToGID ? codeToGID : nullptr, codeToGIDLenA: codeToGID ? codeToGIDLen : 0);
90}
91
92SplashFontFile *SplashFTFontEngine::loadTrueTypeFont(SplashFontFileID *idA, SplashFontSrc *src, int *codeToGID, int codeToGIDLen, int faceIndex)
93{
94 SplashFontFile *ret;
95 ret = SplashFTFontFile::loadTrueTypeFont(engineA: this, idA, src, codeToGIDA: codeToGID, codeToGIDLenA: codeToGIDLen, faceIndexA: faceIndex);
96 return ret;
97}
98

source code of poppler/splash/SplashFTFontEngine.cc