Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-10 10:23:45

0001 //========================================================================
0002 //
0003 // FontInfo.h
0004 //
0005 // Copyright (C) 2005 Kristian Høgsberg <krh@redhat.com>
0006 // Copyright (C) 2005-2008, 2010, 2011, 2018, 2019, 2021 Albert Astals Cid <aacid@kde.org>
0007 // Copyright (C) 2005 Brad Hards <bradh@frogmouth.net>
0008 // Copyright (C) 2009 Pino Toscano <pino@kde.org>
0009 // Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com>
0010 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
0011 // Copyright (C) 2019, 2021, 2022 Oliver Sander <oliver.sander@tu-dresden.de>
0012 // Copyright (C) 2019 Adam Reichold <adam.reichold@t-online.de>
0013 //
0014 // To see a description of the changes please see the Changelog file that
0015 // came with your tarball or type make ChangeLog if you are building from git
0016 //
0017 //========================================================================
0018 
0019 //========================================================================
0020 //
0021 // Based on code from pdffonts.cc
0022 //
0023 // Copyright 2001-2007 Glyph & Cog, LLC
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     // Constructor.
0060     FontInfo(GfxFont *fontA, XRef *xrefA);
0061     // Copy constructor
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     // Constructor.
0094     explicit FontInfoScanner(PDFDoc *doc, int firstPage = 0);
0095     // Destructor.
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