1 //======================================================================== 2 // 3 // FontInfo.h 4 // 5 // Copyright (C) 2005 Kristian Høgsberg <krh@redhat.com> 6 // Copyright (C) 2005-2008, 2010, 2011 Albert Astals Cid <aacid@kde.org> 7 // Copyright (C) 2005 Brad Hards <bradh@frogmouth.net> 8 // Copyright (C) 2009 Pino Toscano <pino@kde.org> 9 // Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> 10 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> 11 // 12 // To see a description of the changes please see the Changelog file that 13 // came with your tarball or type make ChangeLog if you are building from git 14 // 15 //======================================================================== 16 17 //======================================================================== 18 // 19 // Based on code from pdffonts.cc 20 // 21 // Copyright 2001-2007 Glyph & Cog, LLC 22 // 23 //======================================================================== 24 25 #ifndef FONT_INFO_H 26 #define FONT_INFO_H 27 28 #include "Object.h" 29 #include "goo/gtypes.h" 30 #include "goo/GooList.h" 31 32 class GfxFont; 33 class PDFDoc; 34 35 class FontInfo { 36 public: 37 enum Type { 38 unknown, 39 Type1, 40 Type1C, 41 Type1COT, 42 Type3, 43 TrueType, 44 TrueTypeOT, 45 CIDType0, 46 CIDType0C, 47 CIDType0COT, 48 CIDTrueType, 49 CIDTrueTypeOT 50 }; 51 52 // Constructor. 53 FontInfo(GfxFont *fontA, XRef *xrefA); 54 // Copy constructor 55 FontInfo(FontInfo& f); 56 // Destructor. 57 ~FontInfo(); 58 getName()59 GooString *getName() { return name; }; getSubstituteName()60 GooString *getSubstituteName() { return substituteName; }; getFile()61 GooString *getFile() { return file; }; getEncoding()62 GooString *getEncoding() { return encoding; }; getType()63 Type getType() { return type; }; getEmbedded()64 GBool getEmbedded() { return emb; }; getSubset()65 GBool getSubset() { return subset; }; getToUnicode()66 GBool getToUnicode() { return hasToUnicode; }; getRef()67 Ref getRef() { return fontRef; }; getEmbRef()68 Ref getEmbRef() { return embRef; }; 69 70 private: 71 GooString *name; 72 GooString *substituteName; 73 GooString *file; 74 GooString *encoding; 75 Type type; 76 GBool emb; 77 GBool subset; 78 GBool hasToUnicode; 79 Ref fontRef; 80 Ref embRef; 81 }; 82 83 class FontInfoScanner { 84 public: 85 86 // Constructor. 87 FontInfoScanner(PDFDoc *doc, int firstPage = 0); 88 // Destructor. 89 ~FontInfoScanner(); 90 91 GooList *scan(int nPages); 92 93 private: 94 95 PDFDoc *doc; 96 int currentPage; 97 std::set<int> fonts; 98 std::set<int> visitedObjects; 99 100 void scanFonts(XRef *xrefA, Dict *resDict, GooList *fontsList); 101 }; 102 103 #endif 104