FontInfo.h 2.46 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>
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 31
#include "goo/gtypes.h"
#include "goo/GooList.h"

32 33 34
class GfxFont;
class PDFDoc;

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

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

61
  GooString *getName()      { return name; };
62
  GooString *getSubstituteName() { return substituteName; };
63
  GooString *getFile()      { return file; };
64
  GooString *getEncoding()      { return encoding; };
65
  Type       getType()      { return type; };
66 67 68
  GBool      getEmbedded()  { return emb; };
  GBool      getSubset()    { return subset; };
  GBool      getToUnicode() { return hasToUnicode; };
69 70
  Ref        getRef()       { return fontRef; };
  Ref        getEmbRef()    { return embRef; };
71 72 73

private:
  GooString *name;
74
  GooString *substituteName;
75
  GooString *file;
76
  GooString *encoding;
77
  Type type;
78 79 80 81
  GBool emb;
  GBool subset;
  GBool hasToUnicode;
  Ref fontRef;
82
  Ref embRef;
83 84 85 86 87 88
};

class FontInfoScanner {
public:

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

  GooList *scan(int nPages);

private:

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

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

#endif