Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: experimental/PdfViewer/SkPdfType3FontDictionary_autogen.h

Issue 17748002: Basic support for Type3 Fonts in Pdf + various refactorings (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #ifndef __DEFINED__SkPdfType3FontDictionary
2 #define __DEFINED__SkPdfType3FontDictionary
3
4 #include "SkPdfEnums_autogen.h"
5 #include "SkPdfArray_autogen.h"
6 #include "SkPdfType0FontDictionary_autogen.h"
7
8 // Entries in a Type 3 font dictionary
9 class SkPdfType3FontDictionary : public SkPdfType0FontDictionary {
10 public:
11 virtual SkPdfObjectType getType() const { return kType3FontDictionary_SkPdfObj ectType;}
12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kType3Fo ntDictionary_SkPdfObjectType + 1);}
13 public:
14 virtual SkPdfType3FontDictionary* asType3FontDictionary() {return this;}
15 virtual const SkPdfType3FontDictionary* asType3FontDictionary() const {return this;}
16
17 private:
18 public:
19 private:
20 public:
21 SkPdfType3FontDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObje ct* podofoObj = NULL) : SkPdfType0FontDictionary(podofoDoc, podofoObj) {}
22
23 virtual bool valid() const {return true;}
24
25 SkPdfType3FontDictionary& operator=(const SkPdfType3FontDictionary& from) {thi s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi s;}
26
27 /** (Required) The type of PDF object that this dictionary describes; must be
28 * Font for a font dictionary.
29 **/
30 bool has_Type() const {
31 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type" , "", NULL));
32 }
33
34 std::string Type() const {
35 std::string ret;
36 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "", &ret)) return ret;
37 // TODO(edisonn): warn about missing required field, assert for known good p dfs
38 return "";
39 }
40
41 /** (Required) The type of font; must be Type3 for a Type 3 font.
42 **/
43 bool has_Subtype() const {
44 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subty pe", "", NULL));
45 }
46
47 std::string Subtype() const {
48 std::string ret;
49 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", " ", &ret)) return ret;
50 // TODO(edisonn): warn about missing required field, assert for known good p dfs
51 return "";
52 }
53
54 /** (Required in PDF 1.0; optional otherwise) See Table 5.8 on page 317.
55 **/
56 bool has_Name() const {
57 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name" , "", NULL));
58 }
59
60 std::string Name() const {
61 std::string ret;
62 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name", "", &ret)) return ret;
63 // TODO(edisonn): warn about missing required field, assert for known good p dfs
64 return "";
65 }
66
67 /** (Required) A rectangle (see Section 3.8.3, "Rectangles"), expressed in the
68 * glyph coordinate system, specifying the font bounding box. This is the small -
69 * est rectangle enclosing the shape that would result if all of the glyphs of the
70 * font were placed with their origins coincident and then filled.
71 * If all four elements of the rectangle are zero, no assumptions are made base d
72 * on the font bounding box. If any element is nonzero, it is essential that th e
73 * font bounding box be accurate; if any glyph's marks fall outside this bound-
74 * ing box, incorrect behavior may result.
75 **/
76 bool has_FontBBox() const {
77 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontB Box", "", NULL));
78 }
79
80 SkRect FontBBox() const {
81 SkRect ret;
82 if (SkRectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontBBox" , "", &ret)) return ret;
83 // TODO(edisonn): warn about missing required field, assert for known good p dfs
84 return SkRect();
85 }
86
87 /** (Required) An array of six numbers specifying the font matrix, mapping
88 * glyph space to text space (see Section 5.1.3, "Glyph Positioning and
89 * Metrics"). A common practice is to define glyphs in terms of a 1000-unit
90 **/
91 bool has_FontMatrix() const {
92 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontM atrix", "", NULL));
93 }
94
95 SkPdfArray FontMatrix() const {
96 SkPdfArray ret;
97 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontMatrix ", "", &ret)) return ret;
98 // TODO(edisonn): warn about missing required field, assert for known good p dfs
99 return SkPdfArray();
100 }
101
102 };
103
104 #endif // __DEFINED__SkPdfType3FontDictionary
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698