summaryrefslogtreecommitdiff
path: root/cpp/poppler-font-private.h
diff options
context:
space:
mode:
authorsuzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>2020-05-01 08:04:14 +0000
committerAlbert Astals Cid <tsdgeos@yahoo.es>2020-05-19 21:06:58 +0000
commit60400514324d6e5d0a1c50ce4af84320d350e967 (patch)
treefa798eb40ff36d81139f4d60e0296c065a04c8fe /cpp/poppler-font-private.h
parentbf33c25b0f1be07a9a3cedaf6773de22e4305b80 (diff)
[cpp] Add the font infos to the text_box object.
Diffstat (limited to 'cpp/poppler-font-private.h')
-rw-r--r--cpp/poppler-font-private.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/cpp/poppler-font-private.h b/cpp/poppler-font-private.h
new file mode 100644
index 00000000..b24cbaf0
--- /dev/null
+++ b/cpp/poppler-font-private.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino@kde.org>
+ * Copyright (C) 2015, Tamas Szekeres <szekerest@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "poppler-font.h"
+
+#include "poppler-document-private.h"
+
+#include "FontInfo.h"
+
+#include <algorithm>
+
+using namespace poppler;
+
+class poppler::font_info_private
+{
+public:
+ font_info_private()
+ : type(font_info::unknown)
+ , is_embedded(false)
+ , is_subset(false)
+ {
+ }
+ font_info_private(FontInfo *fi)
+ : type((font_info::type_enum)fi->getType())
+ , is_embedded(fi->getEmbedded())
+ , is_subset(fi->getSubset())
+ {
+ if (fi->getName()) {
+ font_name = fi->getName()->c_str();
+ }
+ if (fi->getFile()) {
+ font_file = fi->getFile()->c_str();
+ }
+
+ ref.num = fi->getRef().num;
+ ref.gen = fi->getRef().gen;
+ emb_ref.num = fi->getEmbRef().num;
+ emb_ref.gen = fi->getEmbRef().gen;
+ }
+
+ std::string font_name;
+ std::string font_file;
+ font_info::type_enum type : 5;
+ bool is_embedded : 1;
+ bool is_subset : 1;
+
+ Ref ref;
+ Ref emb_ref;
+};
+
+
+class poppler::font_iterator_private
+{
+public:
+ 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)(start_page, 0))
+ {
+ }
+ ~font_iterator_private()
+ {
+ }
+
+ FontInfoScanner font_info_scanner;
+ int total_pages;
+ int current_page;
+};