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

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

Issue 17294008: load font manually, for now Type0 (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 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
1 #ifndef __DEFINED__SkPdfType0FontDictionary 1 #ifndef __DEFINED__SkPdfType0FontDictionary
2 #define __DEFINED__SkPdfType0FontDictionary 2 #define __DEFINED__SkPdfType0FontDictionary
3 3
4 #include "SkPdfEnums_autogen.h" 4 #include "SkPdfEnums_autogen.h"
5 #include "SkPdfArray_autogen.h" 5 #include "SkPdfArray_autogen.h"
6 #include "SkPdfFontDictionary_autogen.h" 6 #include "SkPdfFontDictionary_autogen.h"
7 7
8 // Entries in a Type 0 font dictionary 8 // Entries in a Type 0 font dictionary
9 class SkPdfType0FontDictionary : public SkPdfFontDictionary { 9 class SkPdfType0FontDictionary : public SkPdfFontDictionary {
10 public: 10 public:
11 virtual SkPdfObjectType getType() const { return kType0FontDictionary_SkPdfObj ectType;} 11 virtual SkPdfObjectType getType() const { return kType0FontDictionary_SkPdfObj ectType;}
12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kType0Fo ntDictionary_SkPdfObjectType + 1);} 12 virtual SkPdfObjectType getTypeEnd() const { return kType0FontDictionary__End_ SkPdfObjectType;}
13 public: 13 public:
14 virtual SkPdfType0FontDictionary* asType0FontDictionary() {return this;} 14 virtual SkPdfType0FontDictionary* asType0FontDictionary() {return this;}
15 virtual const SkPdfType0FontDictionary* asType0FontDictionary() const {return this;} 15 virtual const SkPdfType0FontDictionary* asType0FontDictionary() const {return this;}
16 16
17 private: 17 private:
18 virtual SkPdfCIDFontDictionary* asCIDFontDictionary() {return NULL;} 18 virtual SkPdfCIDFontDictionary* asCIDFontDictionary() {return NULL;}
19 virtual const SkPdfCIDFontDictionary* asCIDFontDictionary() const {return NULL ;} 19 virtual const SkPdfCIDFontDictionary* asCIDFontDictionary() const {return NULL ;}
20 20
21 virtual SkPdfTrueTypeFontDictionary* asTrueTypeFontDictionary() {return NULL;}
22 virtual const SkPdfTrueTypeFontDictionary* asTrueTypeFontDictionary() const {r eturn NULL;}
23
24 virtual SkPdfType1FontDictionary* asType1FontDictionary() {return NULL;} 21 virtual SkPdfType1FontDictionary* asType1FontDictionary() {return NULL;}
25 virtual const SkPdfType1FontDictionary* asType1FontDictionary() const {return NULL;} 22 virtual const SkPdfType1FontDictionary* asType1FontDictionary() const {return NULL;}
26 23
27 virtual SkPdfMultiMasterFontDictionary* asMultiMasterFontDictionary() {return NULL;} 24 virtual SkPdfMultiMasterFontDictionary* asMultiMasterFontDictionary() {return NULL;}
28 virtual const SkPdfMultiMasterFontDictionary* asMultiMasterFontDictionary() co nst {return NULL;} 25 virtual const SkPdfMultiMasterFontDictionary* asMultiMasterFontDictionary() co nst {return NULL;}
29 26
30 virtual SkPdfType3FontDictionary* asType3FontDictionary() {return NULL;} 27 virtual SkPdfTrueTypeFontDictionary* asTrueTypeFontDictionary() {return NULL;}
31 virtual const SkPdfType3FontDictionary* asType3FontDictionary() const {return NULL;} 28 virtual const SkPdfTrueTypeFontDictionary* asTrueTypeFontDictionary() const {r eturn NULL;}
32 29
33 public: 30 public:
34 private: 31 private:
35 public: 32 public:
36 SkPdfType0FontDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObje ct* podofoObj = NULL) : SkPdfFontDictionary(podofoDoc, podofoObj) {} 33 SkPdfType0FontDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObje ct* podofoObj = NULL) : SkPdfFontDictionary(podofoDoc, podofoObj) {}
37 34
38 virtual bool valid() const {return true;} 35 virtual bool valid() const {return true;}
39 36
40 SkPdfType0FontDictionary& operator=(const SkPdfType0FontDictionary& from) {thi s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi s;} 37 SkPdfType0FontDictionary& operator=(const SkPdfType0FontDictionary& from) {thi s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi s;}
41 38
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // TODO(edisonn): warn about missing required field, assert for known good p dfs 106 // TODO(edisonn): warn about missing required field, assert for known good p dfs
110 return ""; 107 return "";
111 } 108 }
112 109
113 bool isEncodingAStream() const { 110 bool isEncodingAStream() const {
114 SkPdfObject* ret = NULL; 111 SkPdfObject* ret = NULL;
115 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding ", "", &ret)) return false; 112 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding ", "", &ret)) return false;
116 return ret->podofo()->HasStream(); 113 return ret->podofo()->HasStream();
117 } 114 }
118 115
119 SkPdfStream getEncodingAsStream() const { 116 SkPdfStream* getEncodingAsStream() const {
120 SkPdfStream ret = SkPdfStream(); 117 SkPdfStream* ret = NULL;
121 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding" , "", &ret)) return ret; 118 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding" , "", &ret)) return ret;
122 // TODO(edisonn): warn about missing required field, assert for known good p dfs 119 // TODO(edisonn): warn about missing required field, assert for known good p dfs
123 return SkPdfStream(); 120 return NULL;
124 } 121 }
125 122
126 /** (Required) An array specifying one or more fonts or CIDFonts that are 123 /** (Required) An array specifying one or more fonts or CIDFonts that are
127 * descendants of this composite font. This array is indexed by the font number 124 * descendants of this composite font. This array is indexed by the font number
128 * that is obtained by mapping a character code through the CMap specified in 125 * that is obtained by mapping a character code through the CMap specified in
129 * the Encoding entry. 126 * the Encoding entry.
130 * Note: In all PDF versions up to and including PDF 1.4, DescendantFonts must 127 * Note: In all PDF versions up to and including PDF 1.4, DescendantFonts must
131 * be a one-element array containing a CIDFont dictionary. 128 * be a one-element array containing a CIDFont dictionary.
132 **/ 129 **/
133 bool has_DescendantFonts() const { 130 bool has_DescendantFonts() const {
134 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Desce ndantFonts", "", NULL)); 131 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Desce ndantFonts", "", NULL));
135 } 132 }
136 133
137 SkPdfArray DescendantFonts() const { 134 SkPdfArray DescendantFonts() const {
138 SkPdfArray ret; 135 SkPdfArray ret;
139 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Descendant Fonts", "", &ret)) return ret; 136 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Descendant Fonts", "", &ret)) return ret;
140 // TODO(edisonn): warn about missing required field, assert for known good p dfs 137 // TODO(edisonn): warn about missing required field, assert for known good p dfs
141 return SkPdfArray(); 138 return SkPdfArray();
142 } 139 }
143 140
144 /** (Optional) A stream containing a CMap file that maps character codes to 141 /** (Optional) A stream containing a CMap file that maps character codes to
145 * Unicode values (see Section 5.9, "ToUnicode CMaps"). 142 * Unicode values (see Section 5.9, "ToUnicode CMaps").
146 **/ 143 **/
147 bool has_ToUnicode() const { 144 bool has_ToUnicode() const {
148 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUni code", "", NULL)); 145 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUni code", "", NULL));
149 } 146 }
150 147
151 SkPdfStream ToUnicode() const { 148 SkPdfStream* ToUnicode() const {
152 SkPdfStream ret; 149 SkPdfStream* ret;
153 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUnicode ", "", &ret)) return ret; 150 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUnicode ", "", &ret)) return ret;
154 // TODO(edisonn): warn about missing required field, assert for known good p dfs 151 // TODO(edisonn): warn about missing required field, assert for known good p dfs
155 return SkPdfStream(); 152 return NULL;
156 } 153 }
157 154
158 }; 155 };
159 156
160 #endif // __DEFINED__SkPdfType0FontDictionary 157 #endif // __DEFINED__SkPdfType0FontDictionary
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698