| OLD | NEW |
| (Empty) |
| 1 #ifndef __DEFINED__SkPdfCIDFontDictionary | |
| 2 #define __DEFINED__SkPdfCIDFontDictionary | |
| 3 | |
| 4 #include "SkPdfEnums_autogen.h" | |
| 5 #include "SkPdfArray_autogen.h" | |
| 6 #include "SkPdfFontDictionary_autogen.h" | |
| 7 | |
| 8 // Entries in a CIDFont dictionary | |
| 9 class SkPdfCIDFontDictionary : public SkPdfFontDictionary { | |
| 10 public: | |
| 11 virtual SkPdfObjectType getType() const { return kCIDFontDictionary_SkPdfObjec
tType;} | |
| 12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kCIDFont
Dictionary_SkPdfObjectType + 1);} | |
| 13 public: | |
| 14 virtual SkPdfCIDFontDictionary* asCIDFontDictionary() {return this;} | |
| 15 virtual const SkPdfCIDFontDictionary* asCIDFontDictionary() const {return this
;} | |
| 16 | |
| 17 private: | |
| 18 virtual SkPdfType0FontDictionary* asType0FontDictionary() {return NULL;} | |
| 19 virtual const SkPdfType0FontDictionary* asType0FontDictionary() const {return
NULL;} | |
| 20 | |
| 21 virtual SkPdfType3FontDictionary* asType3FontDictionary() {return NULL;} | |
| 22 virtual const SkPdfType3FontDictionary* asType3FontDictionary() const {return
NULL;} | |
| 23 | |
| 24 virtual SkPdfType1FontDictionary* asType1FontDictionary() {return NULL;} | |
| 25 virtual const SkPdfType1FontDictionary* asType1FontDictionary() const {return
NULL;} | |
| 26 | |
| 27 virtual SkPdfMultiMasterFontDictionary* asMultiMasterFontDictionary() {return
NULL;} | |
| 28 virtual const SkPdfMultiMasterFontDictionary* asMultiMasterFontDictionary() co
nst {return NULL;} | |
| 29 | |
| 30 virtual SkPdfTrueTypeFontDictionary* asTrueTypeFontDictionary() {return NULL;} | |
| 31 virtual const SkPdfTrueTypeFontDictionary* asTrueTypeFontDictionary() const {r
eturn NULL;} | |
| 32 | |
| 33 public: | |
| 34 private: | |
| 35 public: | |
| 36 SkPdfCIDFontDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObject
* podofoObj = NULL) : SkPdfFontDictionary(podofoDoc, podofoObj) {} | |
| 37 | |
| 38 virtual bool valid() const {return true;} | |
| 39 | |
| 40 SkPdfCIDFontDictionary& operator=(const SkPdfCIDFontDictionary& from) {this->f
PodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *this;} | |
| 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 | |
| 49 std::string Type() const { | |
| 50 std::string ret; | |
| 51 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; | |
| 52 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 53 return ""; | |
| 54 } | |
| 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 | |
| 62 std::string Subtype() const { | |
| 63 std::string ret; | |
| 64 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", "
", &ret)) return ret; | |
| 65 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 66 return ""; | |
| 67 } | |
| 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 | |
| 79 std::string BaseFont() const { | |
| 80 std::string ret; | |
| 81 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseFont",
"", &ret)) return ret; | |
| 82 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 83 return ""; | |
| 84 } | |
| 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 | |
| 93 SkPdfDictionary* CIDSystemInfo() const { | |
| 94 SkPdfDictionary* ret; | |
| 95 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSy
stemInfo", "", &ret)) return ret; | |
| 96 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 97 return NULL; | |
| 98 } | |
| 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 | |
| 108 SkPdfDictionary* FontDescriptor() const { | |
| 109 SkPdfDictionary* ret; | |
| 110 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontD
escriptor", "", &ret)) return ret; | |
| 111 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 112 return NULL; | |
| 113 } | |
| 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 | |
| 122 long DW() const { | |
| 123 long ret; | |
| 124 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW", "", &r
et)) return ret; | |
| 125 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 126 return 0; | |
| 127 } | |
| 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 | |
| 139 SkPdfArray W() const { | |
| 140 SkPdfArray ret; | |
| 141 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W", "", &r
et)) return ret; | |
| 142 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 143 return SkPdfArray(); | |
| 144 } | |
| 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 | |
| 154 SkPdfArray DW2() const { | |
| 155 SkPdfArray ret; | |
| 156 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW2", "",
&ret)) return ret; | |
| 157 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 158 return SkPdfArray(); | |
| 159 } | |
| 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 | |
| 170 SkPdfArray W2() const { | |
| 171 SkPdfArray ret; | |
| 172 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W2", "", &
ret)) return ret; | |
| 173 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 174 return SkPdfArray(); | |
| 175 } | |
| 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 | |
| 191 bool isCIDToGIDMapAStream() const { | |
| 192 SkPdfObject* ret = NULL; | |
| 193 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGID
Map", "", &ret)) return false; | |
| 194 return ret->podofo()->HasStream(); | |
| 195 } | |
| 196 | |
| 197 SkPdfStream* getCIDToGIDMapAsStream() const { | |
| 198 SkPdfStream* ret = NULL; | |
| 199 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGIDM
ap", "", &ret)) return ret; | |
| 200 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 201 return NULL; | |
| 202 } | |
| 203 | |
| 204 bool isCIDToGIDMapAName() const { | |
| 205 SkPdfObject* ret = NULL; | |
| 206 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGID
Map", "", &ret)) return false; | |
| 207 return ret->podofo()->GetDataType() == ePdfDataType_Name; | |
| 208 } | |
| 209 | |
| 210 std::string getCIDToGIDMapAsName() const { | |
| 211 std::string ret = ""; | |
| 212 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGIDMap
", "", &ret)) return ret; | |
| 213 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 214 return ""; | |
| 215 } | |
| 216 | |
| 217 }; | |
| 218 | |
| 219 #endif // __DEFINED__SkPdfCIDFontDictionary | |
| OLD | NEW |