Subversion Repositories Scribus

Rev

Rev 21075 | Rev 22436 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20103 avox 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
 
31
    struct ResourceDictionary
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
 
62
struct PdfPageTree
63
{
22434 jghali 64
        QList<PdfId> Kids;
65
        QMap<int, PdfId> KidsMap;
20103 avox 66
};
67
 
68
 
69
struct PdfPageData
70
{
71
    PdfId ObjNum;
21075 craig 72
        PdfId Thumb;
20103 avox 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
 
82
struct PdfOutlines
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
 
106
struct PdfOCGInfo
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 {
157
    /// as used in PDF, with leading '/'
158
    QByteArray name;
159
    /// how it's embedded
160
    FontMethod method;
161
    /// maps document gids to unicode
162
    FontEncoding encoding;
163
    /// used for content or for forms
164
    FontUsage usage;
165
    /// maps documents gids to font gids
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