| OLD | NEW |
| 1 #ifndef __DEFINED__SkPdfCIDFontDictionary | 1 #ifndef __DEFINED__SkPdfCIDFontDictionary |
| 2 #define __DEFINED__SkPdfCIDFontDictionary | 2 #define __DEFINED__SkPdfCIDFontDictionary |
| 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 CIDFont dictionary |
| 8 class SkPdfCIDFontDictionary : public SkPdfFontDictionary { | 9 class SkPdfCIDFontDictionary : public SkPdfFontDictionary { |
| 9 public: | 10 public: |
| 10 virtual SkPdfObjectType getType() const { return kCIDFontDictionary_SkPdfObjec
tType;} | 11 virtual SkPdfObjectType getType() const { return kCIDFontDictionary_SkPdfObjec
tType;} |
| 11 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kCIDFont
Dictionary_SkPdfObjectType + 1);} | 12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kCIDFont
Dictionary_SkPdfObjectType + 1);} |
| 12 public: | 13 public: |
| 13 virtual SkPdfCIDFontDictionary* asCIDFontDictionary() {return this;} | 14 virtual SkPdfCIDFontDictionary* asCIDFontDictionary() {return this;} |
| 14 virtual const SkPdfCIDFontDictionary* asCIDFontDictionary() const {return this
;} | 15 virtual const SkPdfCIDFontDictionary* asCIDFontDictionary() const {return this
;} |
| 15 | 16 |
| 16 private: | 17 private: |
| 17 virtual SkPdfTrueTypeFontDictionary* asTrueTypeFontDictionary() {return NULL;} | 18 virtual SkPdfTrueTypeFontDictionary* asTrueTypeFontDictionary() {return NULL;} |
| (...skipping 13 matching lines...) Expand all Loading... |
| 31 | 32 |
| 32 public: | 33 public: |
| 33 private: | 34 private: |
| 34 public: | 35 public: |
| 35 SkPdfCIDFontDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObject
* podofoObj = NULL) : SkPdfFontDictionary(podofoDoc, podofoObj) {} | 36 SkPdfCIDFontDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObject
* podofoObj = NULL) : SkPdfFontDictionary(podofoDoc, podofoObj) {} |
| 36 | 37 |
| 37 virtual bool valid() const {return true;} | 38 virtual bool valid() const {return true;} |
| 38 | 39 |
| 39 SkPdfCIDFontDictionary& operator=(const SkPdfCIDFontDictionary& from) {this->f
PodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *this;} | 40 SkPdfCIDFontDictionary& operator=(const SkPdfCIDFontDictionary& from) {this->f
PodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *this;} |
| 40 | 41 |
| 42 /** (Required) The type of PDF object that this dictionary describes; must be |
| 43 * Font for a CIDFont dictionary. |
| 44 **/ |
| 45 bool has_Type() const { |
| 46 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); |
| 47 } |
| 48 |
| 41 std::string Type() const { | 49 std::string Type() const { |
| 42 std::string ret; | 50 std::string ret; |
| 43 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; | 51 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; |
| 44 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 52 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 45 return ""; | 53 return ""; |
| 46 } | 54 } |
| 47 | 55 |
| 56 /** (Required) The type of CIDFont; CIDFontType0 or CIDFontType2. |
| 57 **/ |
| 58 bool has_Subtype() const { |
| 59 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subty
pe", "", NULL)); |
| 60 } |
| 61 |
| 48 std::string Subtype() const { | 62 std::string Subtype() const { |
| 49 std::string ret; | 63 std::string ret; |
| 50 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", "
", &ret)) return ret; | 64 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", "
", &ret)) return ret; |
| 51 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 65 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 52 return ""; | 66 return ""; |
| 53 } | 67 } |
| 54 | 68 |
| 69 /** (Required) The PostScript name of the CIDFont. For Type 0 CIDFonts, this |
| 70 * is usually the value of the CIDFontName entry in the CIDFont program. For |
| 71 * Type 2 CIDFonts, it is derived the same way as for a simple TrueType font; |
| 72 * see Section 5.5.2, "TrueType Fonts." In either case, the name can have a sub
- |
| 73 * set prefix if appropriate; see Section 5.5.3, "Font Subsets." |
| 74 **/ |
| 75 bool has_BaseFont() const { |
| 76 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseF
ont", "", NULL)); |
| 77 } |
| 78 |
| 55 std::string BaseFont() const { | 79 std::string BaseFont() const { |
| 56 std::string ret; | 80 std::string ret; |
| 57 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseFont",
"", &ret)) return ret; | 81 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseFont",
"", &ret)) return ret; |
| 58 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 82 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 59 return ""; | 83 return ""; |
| 60 } | 84 } |
| 61 | 85 |
| 86 /** (Required) A dictionary containing entries that define the character collec- |
| 87 * tion of the CIDFont. See Table 5.12 on page 337. |
| 88 **/ |
| 89 bool has_CIDSystemInfo() const { |
| 90 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSy
stemInfo", "", NULL)); |
| 91 } |
| 92 |
| 62 SkPdfDictionary* CIDSystemInfo() const { | 93 SkPdfDictionary* CIDSystemInfo() const { |
| 63 SkPdfDictionary* ret; | 94 SkPdfDictionary* ret; |
| 64 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSy
stemInfo", "", &ret)) return ret; | 95 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSy
stemInfo", "", &ret)) return ret; |
| 65 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 96 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 66 return NULL; | 97 return NULL; |
| 67 } | 98 } |
| 68 | 99 |
| 100 /** (Required; must be an indirect reference) A font descriptor describing the |
| 101 * CIDFont's default metrics other than its glyph widths (see Section 5.7, |
| 102 * "Font Descriptors"). |
| 103 **/ |
| 104 bool has_FontDescriptor() const { |
| 105 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontD
escriptor", "", NULL)); |
| 106 } |
| 107 |
| 69 SkPdfDictionary* FontDescriptor() const { | 108 SkPdfDictionary* FontDescriptor() const { |
| 70 SkPdfDictionary* ret; | 109 SkPdfDictionary* ret; |
| 71 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontD
escriptor", "", &ret)) return ret; | 110 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontD
escriptor", "", &ret)) return ret; |
| 72 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 111 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 73 return NULL; | 112 return NULL; |
| 74 } | 113 } |
| 75 | 114 |
| 115 /** (Optional) The default width for glyphs in the CIDFont (see "Glyph Met- |
| 116 * rics in CIDFonts" on page 340). Default value: 1000. |
| 117 **/ |
| 118 bool has_DW() const { |
| 119 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW",
"", NULL)); |
| 120 } |
| 121 |
| 76 long DW() const { | 122 long DW() const { |
| 77 long ret; | 123 long ret; |
| 78 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW", "", &r
et)) return ret; | 124 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW", "", &r
et)) return ret; |
| 79 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 125 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 80 return 0; | 126 return 0; |
| 81 } | 127 } |
| 82 | 128 |
| 129 /** (Optional) A description of the widths for the glyphs in the CIDFont. The |
| 130 * array's elements have a variable format that can specify individual widths |
| 131 * for consecutive CIDs or one width for a range of CIDs (see "Glyph Metrics |
| 132 * in CIDFonts" on page 340). Default value: none (the DW value is used for |
| 133 * all glyphs). |
| 134 **/ |
| 135 bool has_W() const { |
| 136 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W", "
", NULL)); |
| 137 } |
| 138 |
| 83 SkPdfArray W() const { | 139 SkPdfArray W() const { |
| 84 SkPdfArray ret; | 140 SkPdfArray ret; |
| 85 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W", "", &r
et)) return ret; | 141 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W", "", &r
et)) return ret; |
| 86 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 142 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 87 return SkPdfArray(); | 143 return SkPdfArray(); |
| 88 } | 144 } |
| 89 | 145 |
| 146 /** (Optional; applies only to CIDFonts used for vertical writing) An array of t
wo |
| 147 * numbers specifying the default metrics for vertical writing (see "Glyph |
| 148 * Metrics in CIDFonts" on page 340). Default value: [880 -1000]. |
| 149 **/ |
| 150 bool has_DW2() const { |
| 151 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW2",
"", NULL)); |
| 152 } |
| 153 |
| 90 SkPdfArray DW2() const { | 154 SkPdfArray DW2() const { |
| 91 SkPdfArray ret; | 155 SkPdfArray ret; |
| 92 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW2", "",
&ret)) return ret; | 156 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW2", "",
&ret)) return ret; |
| 93 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 157 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 94 return SkPdfArray(); | 158 return SkPdfArray(); |
| 95 } | 159 } |
| 96 | 160 |
| 161 /** (Optional; applies only to CIDFonts used for vertical writing) A description
of |
| 162 * the metrics for vertical writing for the glyphs in the CIDFont (see "Glyph |
| 163 * Metrics in CIDFonts" on page 340). Default value: none (the DW2 value is |
| 164 * used for all glyphs). |
| 165 **/ |
| 166 bool has_W2() const { |
| 167 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W2",
"", NULL)); |
| 168 } |
| 169 |
| 97 SkPdfArray W2() const { | 170 SkPdfArray W2() const { |
| 98 SkPdfArray ret; | 171 SkPdfArray ret; |
| 99 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W2", "", &
ret)) return ret; | 172 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W2", "", &
ret)) return ret; |
| 100 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 173 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 101 return SkPdfArray(); | 174 return SkPdfArray(); |
| 102 } | 175 } |
| 103 | 176 |
| 177 /** (Optional; Type 2 CIDFonts only) A specification of the mapping from CIDs |
| 178 * to glyph indices. If the value is a stream, the bytes in the stream contain
the |
| 179 * mapping from CIDs to glyph indices: the glyph index for a particular CID |
| 180 * value c is a 2-byte value stored in bytes 2 x c and 2 x c + 1, where the fir
st |
| 181 * byte is the high-order byte. If the value of CIDToGIDMap is a name, it must |
| 182 * be Identity, indicating that the mapping between CIDs and glyph indices is |
| 183 * the identity mapping. Default value: Identity. |
| 184 * This entry may appear only in a Type 2 CIDFont whose associated True- |
| 185 * Type font program is embedded in the PDF file (see the next section). |
| 186 **/ |
| 187 bool has_CIDToGIDMap() const { |
| 188 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDTo
GIDMap", "", NULL)); |
| 189 } |
| 190 |
| 104 bool isCIDToGIDMapAStream() const { | 191 bool isCIDToGIDMapAStream() const { |
| 105 SkPdfObject* ret = NULL; | 192 SkPdfObject* ret = NULL; |
| 106 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGID
Map", "", &ret)) return false; | 193 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGID
Map", "", &ret)) return false; |
| 107 return ret->podofo()->HasStream(); | 194 return ret->podofo()->HasStream(); |
| 108 } | 195 } |
| 109 | 196 |
| 110 SkPdfStream getCIDToGIDMapAsStream() const { | 197 SkPdfStream getCIDToGIDMapAsStream() const { |
| 111 SkPdfStream ret = SkPdfStream(); | 198 SkPdfStream ret = SkPdfStream(); |
| 112 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGIDM
ap", "", &ret)) return ret; | 199 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGIDM
ap", "", &ret)) return ret; |
| 113 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 200 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 114 return SkPdfStream(); | 201 return SkPdfStream(); |
| 115 } | 202 } |
| 116 | 203 |
| 117 bool isCIDToGIDMapAName() const { | 204 bool isCIDToGIDMapAName() const { |
| 118 SkPdfObject* ret = NULL; | 205 SkPdfObject* ret = NULL; |
| 119 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGID
Map", "", &ret)) return false; | 206 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGID
Map", "", &ret)) return false; |
| 120 return ret->podofo()->GetDataType() == ePdfDataType_Name; | 207 return ret->podofo()->GetDataType() == ePdfDataType_Name; |
| 121 } | 208 } |
| 122 | 209 |
| 123 std::string getCIDToGIDMapAsName() const { | 210 std::string getCIDToGIDMapAsName() const { |
| 124 std::string ret = ""; | 211 std::string ret = ""; |
| 125 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGIDMap
", "", &ret)) return ret; | 212 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGIDMap
", "", &ret)) return ret; |
| 126 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 213 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 127 return ""; | 214 return ""; |
| 128 } | 215 } |
| 129 | 216 |
| 130 }; | 217 }; |
| 131 | 218 |
| 132 #endif // __DEFINED__SkPdfCIDFontDictionary | 219 #endif // __DEFINED__SkPdfCIDFontDictionary |
| OLD | NEW |