~ubuntu-branches/debian/experimental/cups-filters/experimental

« back to all changes in this revision

Viewing changes to pdftopdf/P2PFont.h

  • Committer: Package Import Robot
  • Author(s): Till Kamppeter
  • Date: 2012-07-22 18:57:32 UTC
  • mfrom: (1.1.17)
  • Revision ID: package-import@ubuntu.com-20120722185732-26kkte5p1lth3rt5
Tags: 1.0.20-0bzr1
* New upstream release
   - pdftops: Added another workaround for Kyocera printers: Some
     models get very slow on images which request interpolation,
     so now we remove the image interpolation requests by additional
     PostScript code only inserted for Kyocera printers (LP: #1026974).
   - Made the Poppler-based filters pdftopdf and pdftoopvp build with
     both Poppler 0.18.x and 0.20.x (Upstream bug #1055).
   - Fixes according to Coverity scan results (Upstream bug #1054).
   - Switched build system to autotools. This especially fixes several
     build problems in Gentoo. Also build-tested with CUPS 1.6.0b1.
   - Fixes for compatibility with clang/gcc-4.7.
   - textonly: Filter did not work as a pipe with copies=1 (Upstream bug
     #1032).
   - texttopdf: Avoid trimming the results of FcFontSort(), as this may
     miss some reasonable candidates under certain circumstances. BTW,
     fix passing a non-pointer as a pointer to "result" (Closes: #670055).
   - Corrected documentation. The option for the maximum image rendering
     resolution in pdftops is "pdftops-max-image-resolution", not
     "pdftops-max-image-resolution-default".
* debian/patches/fcfontsort-no-trim.patch: Removed, fixed upstream.
* debian/rules: Updated options for ./configure and make for the new autotools
  build system.
* debian/watch: Switched to bz2 upstream packages.
* debian/rules, debian/copyright, debian/cups-filters.docs: Updated for
  renamed documentation files.
* debian/control, debian/libfontembed1.install,
  debian/libfontembed-dev.install: Added new binary packages for libfontembed.
* debian/copyright: Updated for recent file additions, and rearrangement of
  directories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 
3
 
Copyright (c) 2006-2007, BBR Inc.  All rights reserved.
4
 
 
5
 
Permission is hereby granted, free of charge, to any person obtaining
6
 
a copy of this software and associated documentation files (the
7
 
"Software"), to deal in the Software without restriction, including
8
 
without limitation the rights to use, copy, modify, merge, publish,
9
 
distribute, sublicense, and/or sell copies of the Software, and to
10
 
permit persons to whom the Software is furnished to do so, subject to
11
 
the following conditions:
12
 
 
13
 
The above copyright notice and this permission notice shall be included
14
 
in all copies or substantial portions of the Software.
15
 
 
16
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
 
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
 
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
 
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
 
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
 
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
 
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
 
 
24
 
*/
25
 
/*
26
 
 P2PFont.h
27
 
 pdftopdf Font manager
28
 
*/
29
 
#ifndef _P2PFONT_H_
30
 
#define _P2PFONT_H_
31
 
 
32
 
#include "goo/gmem.h"
33
 
#include "GfxFont.h"
34
 
#include "P2PObject.h"
35
 
#include "P2PResources.h"
36
 
#include "Dict.h"
37
 
#include "XRef.h"
38
 
#include "PDFFTrueTypeFont.h"
39
 
#include "P2PCMap.h"
40
 
 
41
 
class P2PCIDToGID;
42
 
 
43
 
class P2PFontFile : public P2PObject {
44
 
public:
45
 
  ~P2PFontFile();
46
 
  static P2PFontFile *getFontFile(GooString *fileNameA,
47
 
    GfxFont *fontA, GfxFontType typeA, int faceIndexA);
48
 
  GooString *getFileName() {
49
 
    return fileName;
50
 
  }
51
 
  void output(P2POutputStream *str, XRef *xref);
52
 
  void outputCIDToGID(GBool wmode, P2POutputStream *str, XRef *xref);
53
 
  GBool isIdentity();
54
 
  P2PCIDToGID *getCIDToGID(GBool wmode);
55
 
  void refChar(CharCode cid) {
56
 
    if (charRefTable == 0) return;
57
 
    if (maxRefCID < cid) maxRefCID = cid;
58
 
    /* mark reference bit */
59
 
    charRefTable[cid / 8] |= (1 << (cid & (8-1)));
60
 
  }
61
 
  UGooString *getFontName() { return fontName; }
62
 
private:
63
 
  static char *getNextTag();
64
 
  P2PFontFile(GooString *fileNameA, GfxFont *fontA,
65
 
    GfxFontType typeA, int faceIndexA);
66
 
  static P2PFontFile **fontFileList;
67
 
  static int nFontFiles;
68
 
  static int fontFileListSize;
69
 
  static char nextTag[7];
70
 
 
71
 
  GooString *fileName;
72
 
  GfxFont *font;
73
 
  int faceIndex;
74
 
  GfxFontType type;
75
 
  P2PCIDToGID *CIDToGID;
76
 
  P2PCIDToGID *CIDToGID_V;
77
 
  unsigned char *charRefTable;
78
 
  CharCode maxRefCID;
79
 
  PDFFTrueTypeFont tfont;
80
 
  UGooString *fontName;
81
 
  P2PCMapCache cmapCache;
82
 
};
83
 
 
84
 
class P2PCIDToGID : public P2PObject {
85
 
public:
86
 
  P2PCIDToGID(P2PFontFile *fontFileA, GBool wmodeA);
87
 
  ~P2PCIDToGID();
88
 
  void output(P2POutputStream *str, XRef *xref);
89
 
private:
90
 
  P2PFontFile *fontFile;
91
 
  GBool wmode;
92
 
};
93
 
 
94
 
class P2PFontDescriptor : public P2PObject {
95
 
public:
96
 
  P2PFontDescriptor(Object *descriptorA, GfxFont *fontA,
97
 
    GooString *fileName, GfxFontType type, int faceIndexA, XRef *xref,
98
 
    int num, int gen);
99
 
  ~P2PFontDescriptor();
100
 
  void output(P2POutputStream *str, XRef *xref);
101
 
  P2PFontFile *getFontFile() { return fontFile; }
102
 
  GfxFontType getType() { return type; }
103
 
private:
104
 
  P2PFontFile *fontFile;
105
 
  Object descriptor;
106
 
  GfxFontType type;
107
 
};
108
 
 
109
 
class P2PCIDFontDict : public P2PObject {
110
 
public:
111
 
  P2PCIDFontDict(Object *fontDictA, GfxFont *fontA, GfxFontType typeA,
112
 
    GfxFontType embeddedTypeA,
113
 
    P2PFontDescriptor *fontDescriptorA, int num = -1, int gen = -1);
114
 
  ~P2PCIDFontDict();
115
 
  void output(P2POutputStream *str, XRef *xref);
116
 
  P2PFontDescriptor *getFontDescriptor() { return fontDescriptor; }
117
 
private:
118
 
  Object fontDict;
119
 
  GfxFontType type;
120
 
  GfxFontType embeddedType;
121
 
  P2PFontDescriptor *fontDescriptor;
122
 
  GfxFont *font;
123
 
};
124
 
 
125
 
class P2PDescendantFontsWrapper : public P2PObject {
126
 
public:
127
 
  P2PDescendantFontsWrapper(P2PObject *elementA);
128
 
  ~P2PDescendantFontsWrapper();
129
 
  void output(P2POutputStream *str, XRef *xref);
130
 
private:
131
 
  P2PObject *element;
132
 
};
133
 
 
134
 
class P2PFontDict : public P2PObject {
135
 
public:
136
 
  P2PFontDict(Object *fontDictA, XRef *xref, int num = -1, int gen = -1);
137
 
  ~P2PFontDict();
138
 
  void output(P2POutputStream *str, XRef *xref);
139
 
  P2PCIDFontDict *getCIDFontDict() { return cidFontDict; }
140
 
  void showText(GooString *s);
141
 
  UGooString *getEmbeddingFontName();
142
 
private:
143
 
  void doReadFontDescriptor(Object *dictObj, GfxFontType type,
144
 
    const char *name, XRef *xref);
145
 
  void read8bitFontDescriptor(GfxFontType type, const char *name,
146
 
    XRef *xref);
147
 
  void readCIDFontDescriptor(GfxFontType type, const char *name,
148
 
    XRef *xref);
149
 
  P2PFontDescriptor *fontDescriptor;
150
 
  GfxFont *font;
151
 
  Object fontDict;
152
 
  GfxFontType embeddedType;
153
 
  P2PCIDFontDict *cidFontDict;
154
 
};
155
 
 
156
 
class P2PFontResource : public P2PObject {
157
 
public:
158
 
  void setup(P2PResources *resources, XRef *xref);
159
 
  void setup(Dict *resources, XRef *xref);
160
 
  P2PFontDict *lookup(const UGooString &key);
161
 
  P2PFontDict *lookupExtGState(const UGooString &key);
162
 
  P2PFontResource();
163
 
  ~P2PFontResource();
164
 
  void output(P2POutputStream *str, XRef *xref);
165
 
  int getNDicts() { return nDicts; }
166
 
private:
167
 
  int getNExtGState() { return nExtGState; }
168
 
  void doSetup(Dict *fontResource, XRef *xref);
169
 
  void doSetupExtGState(Dict *extGState, XRef *xref);
170
 
  int nDicts;
171
 
  UGooString **keys;
172
 
  P2PFontDict **fontDicts;
173
 
  int nExtGState;
174
 
  UGooString **extGStateKeys;
175
 
  P2PFontDict **extGStateFonts;
176
 
};
177
 
 
178
 
#endif