Coverage Report

Created: 2026-10-14 08:19

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/poppler/cpp/poppler-font-private.h
Line
Count
Source
1
/*
2
 * Copyright (C) 2009, Pino Toscano <pino@kde.org>
3
 * Copyright (C) 2015, Tamas Szekeres <szekerest@gmail.com>
4
 * Copyright (C) 2020, Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
5
 * Copyright (C) 2021, 2024, 2025, Albert Astals Cid <aacid@kde.org>
6
 * Copyright (C) 2026 g10 Code GmbH, Author: Sune Stolborg Vuorela <sune@vuorela.dk>
7
 *
8
 * This program is free software; you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation; either version 2, or (at your option)
11
 * any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
21
 */
22
23
#include "poppler-font.h"
24
25
#include "poppler-document-private.h"
26
27
#include "FontInfo.h"
28
29
#include <algorithm>
30
31
using namespace poppler;
32
33
class poppler::font_info_private
34
{
35
public:
36
0
    font_info_private() : type(font_info::unknown), is_embedded(false), is_subset(false) { }
37
39.9k
    explicit font_info_private(FontInfo *fi) : type(static_cast<font_info::type_enum>(fi->getType())), is_embedded(fi->getEmbedded()), is_subset(fi->getSubset())
38
39.9k
    {
39
39.9k
        const std::optional<std::string> &fiName = fi->getName();
40
39.9k
        if (fiName) {
41
36.3k
            font_name = *fiName;
42
36.3k
        }
43
39.9k
        const std::optional<std::string> &fiFile = fi->getFile();
44
39.9k
        if (fiFile) {
45
15.7k
            font_file = *fiFile;
46
15.7k
        }
47
48
39.9k
        ref = fi->getRef();
49
39.9k
        emb_ref = fi->getEmbRef();
50
39.9k
    }
51
52
    std::string font_name;
53
    std::string font_file;
54
    font_info::type_enum type : 5;
55
    bool is_embedded : 1;
56
    bool is_subset : 1;
57
58
    Ref ref;
59
    Ref emb_ref;
60
};
61
62
class poppler::font_iterator_private
63
{
64
public:
65
19.3k
    font_iterator_private(int start_page, document_private *dd) : font_info_scanner(dd->doc.get(), start_page), total_pages(dd->doc->getNumPages()), current_page((std::max)(start_page, 0)) { }
66
19.3k
    ~font_iterator_private() = default;
67
68
    FontInfoScanner font_info_scanner;
69
    int total_pages;
70
    int current_page;
71
};