Scribus
Open source desktop publishing at your fingertips
pdfstructs.h
1 //
2 // pdfstruct.h
3 // Scribus
4 //
5 // Created by Andreas Vox on 25.12.14.
6 //
7 //
8 
9 #ifndef Scribus_pdfstructs_h
10 #define Scribus_pdfstructs_h
11 
12 #include<QByteArray>
13 #include<QList>
14 #include<QMap>
15 #include<QRect>
16 #include<QString>
17 
18 class PageItem;
19 
20 typedef uint PdfId;
21 
22 namespace Pdf {
23  typedef QMap<QByteArray, PdfId> ResourceMap;
24 
25  struct Resource
26  {
27  QByteArray ResName;
28  PdfId ResNum;
29  };
30 
32  {
33  ResourceMap XObject;
34  ResourceMap Font;
35  ResourceMap Shading;
36  ResourceMap Pattern;
37  ResourceMap ExtGState;
38  ResourceMap Properties;
39  QList<Resource> ColorSpace;
40  };
41 
42 }
43 
44 
45 
46 struct PdfDest
47 {
48  QString Name;
49  int PageNr;
50  QString Act;
51 };
52 
53 
54 struct PdfCatalog
55 {
56  PdfId Outlines;
57  PdfId PageTree;
58  PdfId Dest;
59 };
60 
61 
63 {
64  QMap<int, int> Kids;
65  int Count;
66 };
67 
68 
70 {
71  PdfId ObjNum;
72  int Thumb;
73  Pdf::ResourceMap XObjects;
74  Pdf::ResourceMap ImgObjects;
75  Pdf::ResourceMap FObjects;
76  QList<PdfId> AObjects;
77  QList<PdfId> FormObjects;
78  QList<PageItem*> radioButtonList;
79 };
80 
81 
83 {
84  PdfId First;
85  PdfId Last;
86  PdfId Count;
87 };
88 
89 
90 struct PdfBead
91 {
92  PdfId Parent;
93  PdfId Next;
94  PdfId Prev;
95  int Page;
96  QRect Rect;
97 };
98 
99 struct PdfICCD : public Pdf::Resource
100 {
101  int components;
102  QByteArray ICCArray;
103 };
104 
105 
107 {
108  PdfId ObjNum;
109  bool visible;
110  QByteArray Name;
111 };
112 
113 
114 enum FontMethod {
115  Use_System = 0,
116  Use_Embedded = 1,
117  Use_Subset = 2,
118  Use_Type3 = 3,
119  Use_XForm = 4
120 };
121 
122 
123 enum FontEncoding {
124  Encode_256 = 256,
125  Encode_224 = 224,
126  Encode_IdentityH = 1,
127  Encode_Subset = 0
128 };
129 
130 
131 enum FontUsage {
132  Used_in_Content = 16,
133  Used_in_Forms = 32
134 };
135 
136 
137 
138 /*
139 
140  QByteArray fontFile : ttf
141  QByteArray pdfName : psname w/o special chars
142  FaceEncoding encoding : document gid -> unicode / name
143  QMap<uint,uint> gmap : document gid -> font gid
144  {t1, t1c, ttf} x {sfnt, ps} x {plain, ttfc, cff, fond, zip}
145 
146  = Encoding, data, method
147  * IdentityH, ttf / cff cid, xxxx Tj
148  * IdentityH, subset ttf cid, gmap[xxxx] Tj
149  * enc224, type3 outlines, /Foyy Tf xx Tj
150  * enc256, xform outlines, /objyyxx Do
151  * enc224, pfa/pfb/t42, /Foyy Tf xx Tj
152  * stdenc, -/- cc Tj
153 
154  face -> contours, metrics, cmap, font descriptor, rawdata
155  */
156 struct PdfFont {
158  QByteArray name;
160  FontMethod method;
162  FontEncoding encoding;
164  FontUsage usage;
166  QMap<uint,uint> glyphmap;
167 };
168 
169 
170 struct PdfSpotC : public Pdf::Resource
171 {
172  // no additional data
173 };
174 
175 
176 //struct PdfGraphicsData
177 //{
178 // PdfId ResNumG;
179 // PdfId ResNumX;
180 // QString ResNamG;
181 // QString ResNamX;
182 // QString data;
183 //};
184 
185 
186 #endif
Definition: pdfstructs.h:46
Definition: pdfstructs.h:69
QMap< uint, uint > glyphmap
maps documents gids to font gids
Definition: pdfstructs.h:166
Definition: pdfstructs.h:31
FontEncoding encoding
maps document gids to unicode
Definition: pdfstructs.h:162
Definition: pdfstructs.h:54
Definition: pdfstructs.h:106
Definition: pdfstructs.h:22
Definition: pdfstructs.h:25
Definition: pdfstructs.h:62
Definition: pdfstructs.h:99
Definition: pdfstructs.h:156
Definition: pdfstructs.h:90
Definition: pageitem.h:92
Definition: pdfstructs.h:82
Definition: pdfstructs.h:170
FontMethod method
how it's embedded
Definition: pdfstructs.h:160
QByteArray name
as used in PDF, with leading '/'
Definition: pdfstructs.h:158
FontUsage usage
used for content or for forms
Definition: pdfstructs.h:164