CIDFonts: look for external replacement.
[swftools.git] / pdf2swf / swfoutput.h
1 /* swfoutput.h
2    Header file for swfoutput.cc (and swfoutput_x11.cc).
3
4    Part of the swftools package.
5
6    Copyright (c) 2001 Matthias Kramm <kramm@quiss.org> 
7
8    This file is distributed under the GPL, see file COPYING for details */
9
10 #ifndef __swfoutput_h__
11 #define __swfoutput_h__
12
13 #include <t1lib.h>
14 extern "C" {
15 #include "../lib/rfxswf.h"
16 }
17
18 extern int enablezlib; //default:0
19 extern int opennewwindow; //default:0
20 extern int ignoredraworder; //default:0
21 extern int drawonlyshapes; //default:0
22 extern int jpegquality; //default:100;
23 extern int storeallcharacters; // default:0
24 extern int insertstoptag; //default:0
25
26 typedef long int twip;
27
28 struct swfmatrix {
29     double m11,m12,m21,m22,m13,m23;
30 };
31
32 struct swfcoord {
33     twip x;
34     twip y;
35 };
36
37 class SWFFont
38 {
39     T1_OUTLINE**outline;
40     char**charname;
41     int*width;
42     char*used;
43
44     char*name;
45     int charnum;
46
47     U16*char2swfcharid;
48     U16*swfcharid2char;
49     int swfcharpos;
50
51     char**standardtable;
52     int standardtablesize;
53
54     public:
55     
56     int t1id;
57     char*fontid;
58     unsigned int swfid;
59
60     SWFFont(char*name, int t1id, char*filename);
61     SWFFont::~SWFFont();
62     T1_OUTLINE*getOutline(char*charname);
63     int getSWFCharID(char*name, int charnr);
64     int getWidth(char*name);
65     char*getName();
66     char*getCharName(int t);
67     int getCharWidth(int t) {return width[t];}
68 };
69
70 struct swfoutput 
71 {
72     //int t1font;
73     double fontm11,fontm12,fontm21,fontm22;
74     unsigned short int linewidth;
75     SWFFont*font;
76     RGBA strokergb;
77     RGBA fillrgb;
78 };
79
80 #define DRAWMODE_STROKE 1
81 #define DRAWMODE_FILL 2
82 #define DRAWMODE_EOFILL 3
83 #define DRAWMODE_CLIP 4
84 #define DRAWMODE_EOCLIP 5
85
86 void swfoutput_init(struct swfoutput*, char*filename, int sizex, int sizey);
87 void swfoutput_setprotected(); //write PROTECT tag
88
89 void swfoutput_newpage(struct swfoutput*);
90
91 void swfoutput_setfont(struct swfoutput*, char*fontid, int t1font, char*filename);
92 int swfoutput_queryfont(struct swfoutput*, char*fontid);
93 void swfoutput_setdrawmode(struct swfoutput*, int drawmode);
94 void swfoutput_setfillcolor(struct swfoutput*, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
95 void swfoutput_setstrokecolor(struct swfoutput*, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
96 void swfoutput_setfontmatrix(struct swfoutput*,double,double,double,double);
97 void swfoutput_setlinewidth(struct swfoutput*, double linewidth);
98
99 void swfoutput_drawchar(struct swfoutput*,double x,double y,char*a, int charnr);
100 void swfoutput_drawpath(struct swfoutput*, T1_OUTLINE*outline, struct swfmatrix*m);
101 void swfoutput_startclip(struct swfoutput*, T1_OUTLINE*outline, struct swfmatrix*m);
102 void swfoutput_endclip(struct swfoutput*);
103 int swfoutput_drawimagejpeg(struct swfoutput*, RGBA*pic, int sizex,int sizey, 
104         double x1,double y1,
105         double x2,double y2,
106         double x3,double y3,
107         double x4,double y4);
108 int swfoutput_drawimagelossless(struct swfoutput*, RGBA*pic, int sizex, int sizey,
109         double x1,double y1,
110         double x2,double y2,
111         double x3,double y3,
112         double x4,double y4);
113 int swfoutput_drawimagelosslessN(struct swfoutput*, U8*pic, RGBA*pal, int sizex, int sizey,
114         double x1,double y1,
115         double x2,double y2,
116         double x3,double y3,
117         double x4,double y4, int n);
118 void swfoutput_drawimageagain(struct swfoutput*, int id, int sizex, int sizey,
119         double x1,double y1,
120         double x2,double y2,
121         double x3,double y3,
122         double x4,double y4);
123
124 void swfoutput_linktopage(struct swfoutput*, int page, swfcoord*points);
125 void swfoutput_linktourl(struct swfoutput*, char*url, swfcoord*points);
126 void swfoutput_namedlink(struct swfoutput*obj, char*name, swfcoord*points);
127
128 void swfoutput_destroy(struct swfoutput*);
129
130 #endif //__swfoutput_h__