2 A special output device which collects information about a PDF file,
3 like fonts, Type3 glyphs and so on.
5 This file is part of swftools.
7 Swftools is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 Swftools is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with swftools; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
21 #ifndef __infooutputdev_h__
22 #define __infooutputdev_h__
24 #include "popplercompat.h"
26 #include "OutputDev.h"
27 #include "SplashOutputDev.h"
31 #include <splash/SplashTypes.h>
32 #include <splash/SplashPath.h>
33 #include <splash/SplashFont.h>
34 #include <splash/SplashFontFile.h>
36 #include "xpdf/config.h"
37 #include "SplashTypes.h"
38 #include "SplashPath.h"
39 #include "SplashFont.h"
40 #include "SplashFontFile.h"
44 #include <goo/GooHash.h>
48 #include "../gfxdevice.h"
49 #include "../gfxtools.h"
50 #include "../gfxfont.h"
53 #define INTERNAL_FONT_SIZE 1024.0
54 #define GLYPH_IS_SPACE(g) ((!(g)->line || ((g)->line->type==gfx_moveTo && !(g)->line->next)) && (g)->advance)
67 typedef struct _fontclass
{
68 float m00
,m01
,m10
,m11
;
80 gfxfont_t
* createGfxFont();
82 fontclass_t
*fontclass
;
83 FontInfo(fontclass_t
*fontclass
);
86 gfxmatrix_t
get_gfxmatrix(GfxState
*state
);
87 gfxfont_t
* getGfxFont();
95 double ascender
,descender
;
98 void resetPositioning();
107 float average_advance
;
113 extern char*getFontID(GfxFont
*font
);
114 extern gfxmatrix_t
gfxmatrix_from_state(GfxState
*state
);
116 class InfoOutputDev
: public OutputDev
118 GlyphInfo
* currentglyph
;
119 SplashOutputDev
*splash
;
120 char previous_was_char
;
125 FontInfo
*current_type3_font
;
126 SplashFont
*current_splash_font
;
138 double average_char_size
;
140 void dumpfonts(gfxdevice_t
*dev
);
141 FontInfo
* getFontInfo(GfxState
*state
);
143 InfoOutputDev(XRef
*xref
);
144 virtual ~InfoOutputDev();
145 virtual GBool
useTilingPatternFill();
146 virtual GBool
upsideDown();
147 virtual GBool
needNonText();
148 virtual GBool
useDrawChar();
149 virtual GBool
interpretType3Chars();
150 virtual GBool
checkPageSlice(Page
*page
, double hDPI
, double vDPI
,
151 int rotate
, GBool useMediaBox
, GBool crop
,
152 int sliceX
, int sliceY
, int sliceW
, int sliceH
,
153 GBool printing
, Catalog
*catalog
,
154 GBool (*abortCheckCbk
)(void *data
) = NULL
,
155 void *abortCheckCbkData
= NULL
);
156 virtual void startPage(int pageNum
, GfxState
*state
);
157 virtual void endPage();
158 virtual void drawLink(Link
*link
, Catalog
*catalog
);
159 virtual void updateFont(GfxState
*state
);
161 virtual void saveState(GfxState
*state
);
162 virtual void restoreState(GfxState
*state
);
164 virtual GBool
beginType3Char(GfxState
*state
, double x
, double y
, double dx
, double dy
, CharCode code
, Unicode
*u
, int uLen
);
165 virtual void type3D0(GfxState
*state
, double wx
, double wy
);
166 virtual void type3D1(GfxState
*state
, double wx
, double wy
, double llx
, double lly
, double urx
, double ury
);
167 virtual void endType3Char(GfxState
*state
);
169 virtual void fill(GfxState
*state
);
170 virtual void eoFill(GfxState
*state
);
172 virtual void drawChar(GfxState
*state
, double x
, double y
,
173 double dx
, double dy
,
174 double originX
, double originY
,
175 CharCode code
, int nBytes
, Unicode
*u
, int uLen
);
177 virtual void updateTextMat(GfxState
*state
);
179 virtual void drawImageMask(GfxState
*state
, Object
*ref
, Stream
*str
,
180 int width
, int height
, GBool invert
,
183 virtual void drawImage(GfxState
*state
, Object
*ref
, Stream
*str
,
184 int width
, int height
, GfxImageColorMap
*colorMap
,
186 int *maskColors
, GBool inlineImg
);
187 virtual void drawMaskedImage(GfxState
*state
, Object
*ref
, Stream
*str
,
188 int width
, int height
,
189 GfxImageColorMap
*colorMap
,
192 int maskWidth
, int maskHeight
,
194 POPPLER_MASK_INTERPOLATE
);
195 virtual void drawSoftMaskedImage(GfxState
*state
, Object
*ref
, Stream
*str
,
196 int width
, int height
,
197 GfxImageColorMap
*colorMap
,
200 int maskWidth
, int maskHeight
,
201 GfxImageColorMap
*maskColorMap
202 POPPLER_MASK_INTERPOLATE
);
205 FontInfo
* getOrCreateFontInfo(GfxState
*state
);
208 #endif //__infooutputdev_h__