File indexing completed on 2025-12-10 10:23:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #ifndef FONT_INFO_H
0028 #define FONT_INFO_H
0029
0030 #include "Object.h"
0031 #include "poppler_private_export.h"
0032
0033 #include <optional>
0034 #include <string>
0035 #include <unordered_set>
0036
0037 class GfxFont;
0038 class PDFDoc;
0039
0040 class POPPLER_PRIVATE_EXPORT FontInfo
0041 {
0042 public:
0043 enum Type
0044 {
0045 unknown,
0046 Type1,
0047 Type1C,
0048 Type1COT,
0049 Type3,
0050 TrueType,
0051 TrueTypeOT,
0052 CIDType0,
0053 CIDType0C,
0054 CIDType0COT,
0055 CIDTrueType,
0056 CIDTrueTypeOT
0057 };
0058
0059
0060 FontInfo(GfxFont *fontA, XRef *xrefA);
0061
0062 FontInfo(const FontInfo &f) = default;
0063
0064 FontInfo &operator=(const FontInfo &) = delete;
0065
0066 const std::optional<std::string> &getName() const { return name; };
0067 const std::optional<std::string> &getSubstituteName() const { return substituteName; };
0068 const std::optional<std::string> &getFile() const { return file; };
0069 const std::string &getEncoding() const { return encoding; };
0070 Type getType() const { return type; };
0071 bool getEmbedded() const { return emb; };
0072 bool getSubset() const { return subset; };
0073 bool getToUnicode() const { return hasToUnicode; };
0074 Ref getRef() const { return fontRef; };
0075 Ref getEmbRef() const { return embRef; };
0076
0077 private:
0078 std::optional<std::string> name;
0079 std::optional<std::string> substituteName;
0080 std::optional<std::string> file;
0081 std::string encoding;
0082 Type type;
0083 bool emb;
0084 bool subset;
0085 bool hasToUnicode;
0086 Ref fontRef;
0087 Ref embRef;
0088 };
0089
0090 class POPPLER_PRIVATE_EXPORT FontInfoScanner
0091 {
0092 public:
0093
0094 explicit FontInfoScanner(PDFDoc *doc, int firstPage = 0);
0095
0096 ~FontInfoScanner();
0097
0098 std::vector<FontInfo *> scan(int nPages);
0099
0100 private:
0101 PDFDoc *doc;
0102 int currentPage;
0103 std::unordered_set<int> fonts;
0104 std::unordered_set<int> visitedObjects;
0105
0106 void scanFonts(XRef *xrefA, Dict *resDict, std::vector<FontInfo *> *fontsList);
0107 };
0108
0109 #endif