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, Albert Astals Cid <aacid@kde.org> |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2, or (at your option) |
10 | * any later version. |
11 | * |
12 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU General Public License |
18 | * along with this program; if not, write to the Free Software |
19 | * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. |
20 | */ |
21 | |
22 | #include "poppler-font.h" |
23 | |
24 | #include "poppler-document-private.h" |
25 | |
26 | #include "FontInfo.h" |
27 | |
28 | #include <algorithm> |
29 | |
30 | using namespace poppler; |
31 | |
32 | class poppler::font_info_private |
33 | { |
34 | public: |
35 | font_info_private() : type(font_info::unknown), is_embedded(false), is_subset(false) { } |
36 | explicit font_info_private(FontInfo *fi) : type((font_info::type_enum)fi->getType()), is_embedded(fi->getEmbedded()), is_subset(fi->getSubset()) |
37 | { |
38 | if (fi->getName()) { |
39 | font_name = fi->getName()->c_str(); |
40 | } |
41 | if (fi->getFile()) { |
42 | font_file = fi->getFile()->c_str(); |
43 | } |
44 | |
45 | ref = fi->getRef(); |
46 | emb_ref = fi->getEmbRef(); |
47 | } |
48 | |
49 | std::string font_name; |
50 | std::string font_file; |
51 | font_info::type_enum type : 5; |
52 | bool is_embedded : 1; |
53 | bool is_subset : 1; |
54 | |
55 | Ref ref; |
56 | Ref emb_ref; |
57 | }; |
58 | |
59 | class poppler::font_iterator_private |
60 | { |
61 | public: |
62 | font_iterator_private(int start_page, document_private *dd) : font_info_scanner(dd->doc, start_page), total_pages(dd->doc->getNumPages()), current_page((std::max)(a: start_page, b: 0)) { } |
63 | ~font_iterator_private() { } |
64 | |
65 | FontInfoScanner font_info_scanner; |
66 | int total_pages; |
67 | int current_page; |
68 | }; |
69 | |