Coverage Report

Created: 2026-10-14 08:19

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/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
149k
{
39
149k
    aa = aaA;
40
149k
    enableFreeTypeHinting = enableFreeTypeHintingA;
41
149k
    enableSlightHinting = enableSlightHintingA;
42
149k
    lib = libA;
43
149k
}
44
45
SplashFTFontEngine *SplashFTFontEngine::init(bool aaA, bool enableFreeTypeHintingA, bool enableSlightHintingA)
46
149k
{
47
149k
    FT_Library libA;
48
49
149k
    if (FT_Init_FreeType(&libA)) {
50
0
        return nullptr;
51
0
    }
52
149k
    return new SplashFTFontEngine(aaA, enableFreeTypeHintingA, enableSlightHintingA, libA);
53
149k
}
54
55
SplashFTFontEngine::~SplashFTFontEngine()
56
149k
{
57
149k
    FT_Done_FreeType(lib);
58
149k
}
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
28.1k
{
62
28.1k
    return SplashFTFontFile::loadType1Font(this, std::move(idA), std::move(src), enc, faceIndex);
63
28.1k
}
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.3k
{
67
23.3k
    return SplashFTFontFile::loadType1Font(this, std::move(idA), std::move(src), enc, faceIndex);
68
23.3k
}
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
117
{
72
117
    return SplashFTFontFile::loadType1Font(this, std::move(idA), std::move(src), enc, faceIndex);
73
117
}
74
75
std::shared_ptr<SplashFontFile> SplashFTFontEngine::loadCIDFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, int faceIndex)
76
2.40k
{
77
2.40k
    return SplashFTFontFile::loadCIDFont(this, std::move(idA), std::move(src), {}, faceIndex);
78
2.40k
}
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
364
{
82
364
    return SplashFTFontFile::loadCIDFont(this, std::move(idA), std::move(src), std::move(codeToGID), faceIndex);
83
364
}
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
111k
{
87
111k
    return SplashFTFontFile::loadTrueTypeFont(this, std::move(idA), std::move(src), std::move(codeToGID), faceIndex);
88
111k
}