/src/poppler/splash/SplashFTFontEngine.cc
Line | Count | Source |
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, 2024-2026 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 | | // Copyright (C) 2024-2026 g10 Code GmbH, Author: Sune Stolborg Vuorela <sune@vuorela.dk> |
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 | | #include <config.h> |
28 | | |
29 | | #include "SplashFTFontFile.h" |
30 | | #include "SplashFontFileID.h" |
31 | | #include "SplashFTFontEngine.h" |
32 | | |
33 | | //------------------------------------------------------------------------ |
34 | | // SplashFTFontEngine |
35 | | //------------------------------------------------------------------------ |
36 | | |
37 | | SplashFTFontEngine::SplashFTFontEngine(bool aaA, bool enableFreeTypeHintingA, bool enableSlightHintingA, FT_Library libA) |
38 | 147k | { |
39 | 147k | aa = aaA; |
40 | 147k | enableFreeTypeHinting = enableFreeTypeHintingA; |
41 | 147k | enableSlightHinting = enableSlightHintingA; |
42 | 147k | lib = libA; |
43 | 147k | } |
44 | | |
45 | | SplashFTFontEngine *SplashFTFontEngine::init(bool aaA, bool enableFreeTypeHintingA, bool enableSlightHintingA) |
46 | 147k | { |
47 | 147k | FT_Library libA; |
48 | | |
49 | 147k | if (FT_Init_FreeType(&libA)) { |
50 | 0 | return nullptr; |
51 | 0 | } |
52 | 147k | return new SplashFTFontEngine(aaA, enableFreeTypeHintingA, enableSlightHintingA, libA); |
53 | 147k | } |
54 | | |
55 | | SplashFTFontEngine::~SplashFTFontEngine() |
56 | 147k | { |
57 | 147k | FT_Done_FreeType(lib); |
58 | 147k | } |
59 | | |
60 | | std::shared_ptr<SplashFontFile> SplashFTFontEngine::loadType1Font(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, const std::array<const char *, 256> &enc, int faceIndex) |
61 | 29.6k | { |
62 | 29.6k | return SplashFTFontFile::loadType1Font(this, std::move(idA), std::move(src), enc, faceIndex); |
63 | 29.6k | } |
64 | | |
65 | | std::shared_ptr<SplashFontFile> SplashFTFontEngine::loadType1CFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, const std::array<const char *, 256> &enc, int faceIndex) |
66 | 23.5k | { |
67 | 23.5k | return SplashFTFontFile::loadType1Font(this, std::move(idA), std::move(src), enc, faceIndex); |
68 | 23.5k | } |
69 | | |
70 | | std::shared_ptr<SplashFontFile> SplashFTFontEngine::loadOpenTypeT1CFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, const std::array<const char *, 256> &enc, int faceIndex) |
71 | 111 | { |
72 | 111 | return SplashFTFontFile::loadType1Font(this, std::move(idA), std::move(src), enc, faceIndex); |
73 | 111 | } |
74 | | |
75 | | std::shared_ptr<SplashFontFile> SplashFTFontEngine::loadCIDFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, int faceIndex) |
76 | 2.56k | { |
77 | 2.56k | return SplashFTFontFile::loadCIDFont(this, std::move(idA), std::move(src), {}, faceIndex); |
78 | 2.56k | } |
79 | | |
80 | | std::shared_ptr<SplashFontFile> SplashFTFontEngine::loadOpenTypeCFFFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, std::vector<int> &&codeToGID, int faceIndex) |
81 | 338 | { |
82 | 338 | return SplashFTFontFile::loadCIDFont(this, std::move(idA), std::move(src), std::move(codeToGID), faceIndex); |
83 | 338 | } |
84 | | |
85 | | std::shared_ptr<SplashFontFile> SplashFTFontEngine::loadTrueTypeFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, std::vector<int> &&codeToGID, int faceIndex) |
86 | 113k | { |
87 | 113k | return SplashFTFontFile::loadTrueTypeFont(this, std::move(idA), std::move(src), std::move(codeToGID), faceIndex); |
88 | 113k | } |