reworked font backend
[swftools.git] / lib / pdf / InfoOutputDev.h
1 #ifndef __infooutputdev_h__
2 #define __infooutputdev_h__
3
4 #include "GfxFont.h"
5 #include "OutputDev.h"
6 #include "SplashFont.h"
7 #include "SplashOutputDev.h"
8 #include "SplashPath.h"
9 #include "GHash.h"
10
11 struct GlyphInfo
12 {
13     SplashPath*path;
14     int unicode;
15     int glyphid;
16 };
17
18 struct FontInfo
19 {
20     FontInfo();
21     ~FontInfo();
22
23     GfxFont*font;
24     double max_size;
25     int num_glyphs;
26     GlyphInfo**glyphs;
27     int*charid2glyph;
28     SplashFont*splash_font;
29 };
30
31 extern char*getFontID(GfxFont*font);
32
33 class InfoOutputDev: public OutputDev 
34 {
35     GHash* id2font;
36     FontInfo* currentfont;
37     SplashOutputDev*splash;
38     public:
39     int x1,y1,x2,y2;
40     int num_links;
41     int num_images;
42     int num_fonts;
43
44     InfoOutputDev(XRef*xref);
45     virtual ~InfoOutputDev(); 
46     virtual GBool useTilingPatternFill();
47     virtual GBool upsideDown();
48     virtual GBool useDrawChar();
49     virtual GBool interpretType3Chars();
50     virtual void startPage(int pageNum, GfxState *state, double crop_x1, double crop_y1, double crop_x2, double crop_y2);
51     virtual void drawLink(Link *link, Catalog *catalog);
52     virtual double getMaximumFontSize(char*id);
53     virtual void updateFont(GfxState *state);
54     virtual void drawChar(GfxState *state, double x, double y,
55                           double dx, double dy,
56                           double originX, double originY,
57                           CharCode code, int nBytes, Unicode *u, int uLen);
58     virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
59                                int width, int height, GBool invert,
60                                GBool inlineImg);
61     virtual void drawImage(GfxState *state, Object *ref, Stream *str,
62                            int width, int height, GfxImageColorMap *colorMap,
63                            int *maskColors, GBool inlineImg);
64     virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
65                                   int width, int height,
66                                   GfxImageColorMap *colorMap,
67                                   Stream *maskStr,
68                                   int maskWidth, int maskHeight,
69                                   GBool maskInvert);
70     virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
71                                       int width, int height,
72                                       GfxImageColorMap *colorMap,
73                                       Stream *maskStr,
74                                       int maskWidth, int maskHeight,
75                                       GfxImageColorMap *maskColorMap);
76     virtual FontInfo* getFont(char*id);
77 };
78
79 #endif //__infooutputdev_h__