OLD | NEW |
| (Empty) |
1 #ifndef __DEFINED__SkPdfType3FontDictionary | |
2 #define __DEFINED__SkPdfType3FontDictionary | |
3 | |
4 #include "SkPdfUtils.h" | |
5 #include "SkPdfEnums_autogen.h" | |
6 #include "SkPdfArray_autogen.h" | |
7 #include "SkPdfType1FontDictionary_autogen.h" | |
8 | |
9 // Entries in a Type 3 font dictionary | |
10 class SkPdfType3FontDictionary : public SkPdfType1FontDictionary { | |
11 public: | |
12 virtual SkPdfObjectType getType() const { return kType3FontDictionary_SkPdfObj
ectType;} | |
13 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kType3Fo
ntDictionary_SkPdfObjectType + 1);} | |
14 public: | |
15 virtual SkPdfType3FontDictionary* asType3FontDictionary() {return this;} | |
16 virtual const SkPdfType3FontDictionary* asType3FontDictionary() const {return
this;} | |
17 | |
18 private: | |
19 virtual SkPdfMultiMasterFontDictionary* asMultiMasterFontDictionary() {return
NULL;} | |
20 virtual const SkPdfMultiMasterFontDictionary* asMultiMasterFontDictionary() co
nst {return NULL;} | |
21 | |
22 virtual SkPdfTrueTypeFontDictionary* asTrueTypeFontDictionary() {return NULL;} | |
23 virtual const SkPdfTrueTypeFontDictionary* asTrueTypeFontDictionary() const {r
eturn NULL;} | |
24 | |
25 public: | |
26 private: | |
27 public: | |
28 SkPdfType3FontDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObje
ct* podofoObj = NULL) : SkPdfType1FontDictionary(podofoDoc, podofoObj) {} | |
29 | |
30 SkPdfType3FontDictionary(const SkPdfType3FontDictionary& from) : SkPdfType1Fon
tDictionary(from.fPodofoDoc, from.fPodofoObj) {} | |
31 | |
32 virtual bool valid() const {return true;} | |
33 | |
34 SkPdfType3FontDictionary& operator=(const SkPdfType3FontDictionary& from) {thi
s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi
s;} | |
35 | |
36 /** (Required) The type of PDF object that this dictionary describes; must be | |
37 * Font for a font dictionary. | |
38 **/ | |
39 bool has_Type() const { | |
40 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); | |
41 } | |
42 | |
43 std::string Type() const; | |
44 /** (Required) The type of font; must be Type3 for a Type 3 font. | |
45 **/ | |
46 bool has_Subtype() const { | |
47 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subty
pe", "", NULL)); | |
48 } | |
49 | |
50 std::string Subtype() const; | |
51 /** (Required in PDF 1.0; optional otherwise) See Table 5.8 on page 317. | |
52 **/ | |
53 bool has_Name() const { | |
54 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name"
, "", NULL)); | |
55 } | |
56 | |
57 std::string Name() const; | |
58 /** (Required) A rectangle (see Section 3.8.3, "Rectangles"), expressed in the | |
59 * glyph coordinate system, specifying the font bounding box. This is the small
- | |
60 * est rectangle enclosing the shape that would result if all of the glyphs of
the | |
61 * font were placed with their origins coincident and then filled. | |
62 * If all four elements of the rectangle are zero, no assumptions are made base
d | |
63 * on the font bounding box. If any element is nonzero, it is essential that th
e | |
64 * font bounding box be accurate; if any glyph's marks fall outside this bound- | |
65 * ing box, incorrect behavior may result. | |
66 **/ | |
67 bool has_FontBBox() const { | |
68 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontB
Box", "", NULL)); | |
69 } | |
70 | |
71 SkRect* FontBBox() const; | |
72 /** (Required) An array of six numbers specifying the font matrix, mapping | |
73 * glyph space to text space (see Section 5.1.3, "Glyph Positioning and | |
74 * Metrics"). A common practice is to define glyphs in terms of a 1000-unit | |
75 * glyph coordinate system, in which case the font matrix
is | |
76 * [0.001 0 0 0.001 0 0]. | |
77 **/ | |
78 bool has_FontMatrix() const { | |
79 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontM
atrix", "", NULL)); | |
80 } | |
81 | |
82 SkMatrix* FontMatrix() const; | |
83 /** (Required) A dictionary in which each key is a character name and the value | |
84 * associated with that key is a content stream that constructs and paints the | |
85 * glyph for that character. The stream must include as its first operator eith
er | |
86 * d0 or d1. This is followed by operators describing one or more graphics | |
87 * objects, which may include path, text, or image objects. See below for more | |
88 * details about Type 3 glyph descriptions. | |
89 **/ | |
90 bool has_CharProcs() const { | |
91 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CharP
rocs", "", NULL)); | |
92 } | |
93 | |
94 SkPdfDictionary* CharProcs() const; | |
95 /** (Required) An encoding dictionary whose Differences array specifies the | |
96 * complete character encoding for this font (see Section 5.5.5, "Character | |
97 * Encoding"; also see implementation note 46 in Appendix H). | |
98 **/ | |
99 bool has_Encoding() const { | |
100 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encod
ing", "", NULL)); | |
101 } | |
102 | |
103 bool isEncodingAName() const { | |
104 SkPdfObject* ret = NULL; | |
105 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding
", "", &ret)) return false; | |
106 return ret->podofo()->GetDataType() == ePdfDataType_Name; | |
107 } | |
108 | |
109 std::string getEncodingAsName() const; | |
110 bool isEncodingAEncodingdictionary() const { | |
111 SkPdfObject* ret = NULL; | |
112 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding
", "", &ret)) return false; | |
113 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary; | |
114 } | |
115 | |
116 SkPdfEncodingDictionary* getEncodingAsEncodingdictionary() const; | |
117 /** (Required) The first character code defined in the font's Widths array. | |
118 **/ | |
119 bool has_FirstChar() const { | |
120 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "First
Char", "", NULL)); | |
121 } | |
122 | |
123 long FirstChar() const; | |
124 /** (Required) The last character code defined in the font's Widths array. | |
125 **/ | |
126 bool has_LastChar() const { | |
127 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LastC
har", "", NULL)); | |
128 } | |
129 | |
130 long LastChar() const; | |
131 /** (Required; indirect reference preferred) An array of (LastChar - FirstChar +
1) | |
132 * widths, each element being the glyph width for the character whose code is | |
133 * FirstChar plus the array index. For character codes outside the range FirstC
har | |
134 * to LastChar, the width is 0. These widths are interpreted in glyph space as | |
135 * specified by FontMatrix (unlike the widths of a Type 1 font, which are in | |
136 * thousandths of a unit of text space). | |
137 * Note: If FontMatrix specifies a rotation, only the horizontal component of t
he | |
138 * transformed width is used. That is, the resulting displacement is always hor
izon- | |
139 * tal in text space, as is the case for all simple fonts. | |
140 **/ | |
141 bool has_Widths() const { | |
142 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Width
s", "", NULL)); | |
143 } | |
144 | |
145 SkPdfArray* Widths() const; | |
146 /** (Optional but strongly recommended; PDF 1.2) A list of the named resources, | |
147 * such as fonts and images, required by the glyph descriptions in this font (s
ee | |
148 * Section 3.7.2, "Resource Dictionaries"). If any glyph descriptions refer to | |
149 * named resources but this dictionary is absent, the names are looked up in th
e | |
150 * resource dictionary of the page on which the font is used. (See implementa- | |
151 * tion note 47 in Appendix H.) | |
152 **/ | |
153 bool has_Resources() const { | |
154 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Resou
rces", "", NULL)); | |
155 } | |
156 | |
157 SkPdfDictionary* Resources() const; | |
158 /** (Optional; PDF 1.2) A stream containing a CMap file that maps character | |
159 * codes to Unicode values (see Section 5.9, "ToUnicode CMaps"). | |
160 **/ | |
161 bool has_ToUnicode() const { | |
162 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUni
code", "", NULL)); | |
163 } | |
164 | |
165 SkPdfStream* ToUnicode() const; | |
166 }; | |
167 | |
168 #endif // __DEFINED__SkPdfType3FontDictionary | |
OLD | NEW |