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

« back to all changes in this revision

Viewing changes to filter/pdftopdf/P2PGfx.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
  P2PGfx.h
 
3
  developped by BBR Inc. 2006-2007
 
4
 
 
5
  This file is based on Gfx.h
 
6
  Gfx.h copyright notice is follows
 
7
  and is licensed under GPL.
 
8
*/
 
9
//========================================================================
 
10
//
 
11
// Gfx.h
 
12
//
 
13
// Copyright 1996-2003 Glyph & Cog, LLC
 
14
//
 
15
//========================================================================
 
16
 
 
17
#ifndef _P2PGFX_H_
 
18
#define _P2PGFX_H_
 
19
 
 
20
#ifdef USE_GCC_PRAGMAS
 
21
#pragma interface
 
22
#endif
 
23
 
 
24
#include "goo/gtypes.h"
 
25
#include "Object.h"
 
26
#include "Gfx.h"
 
27
#include "P2POutputStream.h"
 
28
#include "P2PResources.h"
 
29
#include "P2PFont.h"
 
30
#include "P2PMatrix.h"
 
31
 
 
32
class GooString;
 
33
class XRef;
 
34
class Array;
 
35
class Stream;
 
36
class Parser;
 
37
class Dict;
 
38
class P2PGfx;
 
39
 
 
40
//------------------------------------------------------------------------
 
41
// P2PGfx
 
42
//------------------------------------------------------------------------
 
43
 
 
44
class P2PGfx {
 
45
public:
 
46
 
 
47
  // Constructor
 
48
  P2PGfx(XRef *xrefA, P2POutputStream *strA, P2PFontResource *fontResourceA,
 
49
    P2PResources *resourcesA);
 
50
  ~P2PGfx();
 
51
 
 
52
  // Interpret a stream or array of streams.
 
53
  void outputContents(Object *obj, P2PResourceMap *mappingTableA,
 
54
    Dict *orgResourceA, P2PMatrix *matA);
 
55
 
 
56
private:
 
57
  struct P2POperator {
 
58
    char name[4];
 
59
    int numArgs;
 
60
    TchkType tchk[maxArgs];
 
61
    void (P2PGfx::*func)(Object args[], int numArgs);
 
62
  };
 
63
 
 
64
  class P2PGfxState {
 
65
  public:
 
66
    P2PGfxState() {
 
67
      font = 0;
 
68
      next = 0;
 
69
    }
 
70
 
 
71
    void clean() {
 
72
        while (next != 0) {
 
73
            restore();
 
74
        }
 
75
    }
 
76
 
 
77
    ~P2PGfxState() {
 
78
        clean();
 
79
    }
 
80
 
 
81
    void copy(P2PGfxState *src) {
 
82
      font = src->font;
 
83
    }
 
84
 
 
85
    P2PGfxState(P2PGfxState *src, P2PGfxState *nextA) {
 
86
      copy(src);
 
87
      next = nextA;
 
88
    }
 
89
 
 
90
    P2PFontDict *getFont() { return font; }
 
91
 
 
92
    void setFont(P2PFontDict *fontA) {
 
93
      if (fontA != 0) font = fontA;
 
94
    }
 
95
 
 
96
    void save() {
 
97
      next = new P2PGfxState(this,next);
 
98
    }
 
99
 
 
100
    void restore() {
 
101
      if (next != 0) {
 
102
        /* remove next */
 
103
        P2PGfxState *oldNext = next;
 
104
        next = oldNext->next;
 
105
        oldNext->next = 0;
 
106
 
 
107
        copy(oldNext);
 
108
        delete oldNext;
 
109
      }
 
110
    }
 
111
  private:
 
112
    P2PFontDict *font; // current font
 
113
    P2PGfxState *next;
 
114
  };
 
115
 
 
116
  XRef *xref;                   // the xref table for this PDF file
 
117
  P2POutputStream *str;         // output stream
 
118
  P2PResourceMap *mappingTable; // resouce name mapping table
 
119
  P2PFontResource *fontResource; // font resource
 
120
  P2PGfxState state;
 
121
  Dict *orgCSResource; // Color Space resource dictionay of original page
 
122
  P2PResources *resources;
 
123
  P2PMatrix *mat;
 
124
 
 
125
  Parser *parser;               // parser for page content stream(s)
 
126
 
 
127
  static P2POperator opTab[];   // table of operators
 
128
 
 
129
  void go();
 
130
  void execOp(Object *cmd, Object args[], int numArgs);
 
131
  P2POperator *findOp(char *name);
 
132
  GBool checkArg(Object *arg, TchkType type);
 
133
  int getPos();
 
134
  void outputOp(const char *name, Object args[], int numArgs);
 
135
  void opSetStrokeColorSpace(Object args[], int numArgs);
 
136
  void opXObject(Object args[], int numArgs);
 
137
  void opSetStrokeColorN(Object args[], int numArgs);
 
138
  void opSetFont(Object args[], int numArgs);
 
139
  void opSetFillColorSpace(Object args[], int numArgs);
 
140
  void opSetExtGState(Object args[], int numArgs);
 
141
  void opSetFillColorN(Object args[], int numArgs);
 
142
  void opShFill(Object args[], int numArgs);
 
143
  void opMoveSetShowText(Object args[], int numArgs);
 
144
  void opMoveShowText(Object args[], int numArgs);
 
145
  void opShowSpaceText(Object args[], int numArgs);
 
146
  void opShowText(Object args[], int numArgs);
 
147
  void opSave(Object args[], int numArgs);
 
148
  void opRestore(Object args[], int numArgs);
 
149
  void opBeginImage(Object args[], int numArgs);
 
150
  void doImage(Stream *istr);
 
151
};
 
152
 
 
153
#endif