FontInfo.h 2.43 KB
Newer Older
1 2
//========================================================================
//
Albert Astals Cid's avatar
Albert Astals Cid committed
3
// FontInfo.h
4 5
//
// Copyright (C) 2005 Kristian Høgsberg <krh@redhat.com>
6
// Copyright (C) 2005-2008, 2010, 2011, 2018 Albert Astals Cid <aacid@kde.org>
7
// Copyright (C) 2005 Brad Hards <bradh@frogmouth.net>
Albert Astals Cid's avatar
Albert Astals Cid committed
8
// Copyright (C) 2009 Pino Toscano <pino@kde.org>
Albert Astals Cid's avatar
Albert Astals Cid committed
9
// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com>
Thomas Freitag's avatar
Thomas Freitag committed
10
// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
11 12 13 14 15 16 17 18 19 20 21 22 23 24
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
//
//========================================================================

//========================================================================
//
// Based on code from pdffonts.cc
//
// Copyright 2001-2007 Glyph & Cog, LLC
//
//========================================================================

25 26 27
#ifndef FONT_INFO_H
#define FONT_INFO_H

28
#include "Object.h"
29 30
#include "goo/GooList.h"

31 32 33
class GfxFont;
class PDFDoc;

34 35
class FontInfo {
public:
36 37 38 39
  enum Type {
    unknown,
    Type1,
    Type1C,
40
    Type1COT,
41 42
    Type3,
    TrueType,
43
    TrueTypeOT,
44 45
    CIDType0,
    CIDType0C,
46 47 48
    CIDType0COT,
    CIDTrueType,
    CIDTrueTypeOT
49 50
  };
    
51
  // Constructor.
Thomas Freitag's avatar
Thomas Freitag committed
52
  FontInfo(GfxFont *fontA, XRef *xrefA);
53 54 55 56 57
  // Copy constructor
  FontInfo(FontInfo& f);
  // Destructor.
  ~FontInfo();

58 59
  FontInfo& operator=(const FontInfo &) = delete;

60
  GooString *getName()      { return name; };
61
  GooString *getSubstituteName() { return substituteName; };
Albert Astals Cid's avatar
Albert Astals Cid committed
62
  GooString *getFile()      { return file; };
63
  GooString *getEncoding()      { return encoding; };
64
  Type       getType()      { return type; };
65 66 67
  bool      getEmbedded()  { return emb; };
  bool      getSubset()    { return subset; };
  bool      getToUnicode() { return hasToUnicode; };
68 69
  Ref        getRef()       { return fontRef; };
  Ref        getEmbRef()    { return embRef; };
70 71 72

private:
  GooString *name;
73
  GooString *substituteName;
Albert Astals Cid's avatar
Albert Astals Cid committed
74
  GooString *file;
75
  GooString *encoding;
76
  Type type;
77 78 79
  bool emb;
  bool subset;
  bool hasToUnicode;
80
  Ref fontRef;
81
  Ref embRef;
82 83 84 85 86 87
};

class FontInfoScanner {
public:

  // Constructor.
88
  FontInfoScanner(PDFDoc *doc, int firstPage = 0);
89 90 91 92 93 94 95 96 97
  // Destructor.
  ~FontInfoScanner();

  GooList *scan(int nPages);

private:

  PDFDoc *doc;
  int currentPage;
98
  std::set<int> fonts;
99
  std::set<int> visitedObjects;
100

Thomas Freitag's avatar
Thomas Freitag committed
101
  void scanFonts(XRef *xrefA, Dict *resDict, GooList *fontsList);
102 103 104
};

#endif