| OLD | NEW |
| (Empty) |
| 1 #ifndef __DEFINED__SkPdfType0FontDictionary | |
| 2 #define __DEFINED__SkPdfType0FontDictionary | |
| 3 | |
| 4 #include "SkPdfEnums_autogen.h" | |
| 5 #include "SkPdfArray_autogen.h" | |
| 6 #include "SkPdfFontDictionary_autogen.h" | |
| 7 | |
| 8 // Entries in a Type 0 font dictionary | |
| 9 class SkPdfType0FontDictionary : public SkPdfFontDictionary { | |
| 10 public: | |
| 11 virtual SkPdfObjectType getType() const { return kType0FontDictionary_SkPdfObj
ectType;} | |
| 12 virtual SkPdfObjectType getTypeEnd() const { return kType0FontDictionary__End_
SkPdfObjectType;} | |
| 13 public: | |
| 14 virtual SkPdfType0FontDictionary* asType0FontDictionary() {return this;} | |
| 15 virtual const SkPdfType0FontDictionary* asType0FontDictionary() const {return
this;} | |
| 16 | |
| 17 private: | |
| 18 virtual SkPdfCIDFontDictionary* asCIDFontDictionary() {return NULL;} | |
| 19 virtual const SkPdfCIDFontDictionary* asCIDFontDictionary() const {return NULL
;} | |
| 20 | |
| 21 virtual SkPdfType1FontDictionary* asType1FontDictionary() {return NULL;} | |
| 22 virtual const SkPdfType1FontDictionary* asType1FontDictionary() const {return
NULL;} | |
| 23 | |
| 24 virtual SkPdfMultiMasterFontDictionary* asMultiMasterFontDictionary() {return
NULL;} | |
| 25 virtual const SkPdfMultiMasterFontDictionary* asMultiMasterFontDictionary() co
nst {return NULL;} | |
| 26 | |
| 27 virtual SkPdfTrueTypeFontDictionary* asTrueTypeFontDictionary() {return NULL;} | |
| 28 virtual const SkPdfTrueTypeFontDictionary* asTrueTypeFontDictionary() const {r
eturn NULL;} | |
| 29 | |
| 30 public: | |
| 31 private: | |
| 32 public: | |
| 33 SkPdfType0FontDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObje
ct* podofoObj = NULL) : SkPdfFontDictionary(podofoDoc, podofoObj) {} | |
| 34 | |
| 35 virtual bool valid() const {return true;} | |
| 36 | |
| 37 SkPdfType0FontDictionary& operator=(const SkPdfType0FontDictionary& from) {thi
s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi
s;} | |
| 38 | |
| 39 /** (Required) The type of PDF object that this dictionary describes; must be | |
| 40 * Font for a font dictionary. | |
| 41 **/ | |
| 42 bool has_Type() const { | |
| 43 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); | |
| 44 } | |
| 45 | |
| 46 std::string Type() const { | |
| 47 std::string ret; | |
| 48 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; | |
| 49 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 50 return ""; | |
| 51 } | |
| 52 | |
| 53 /** (Required) The type of font; must be Type0 for a Type 0 font. | |
| 54 **/ | |
| 55 bool has_Subtype() const { | |
| 56 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subty
pe", "", NULL)); | |
| 57 } | |
| 58 | |
| 59 std::string Subtype() const { | |
| 60 std::string ret; | |
| 61 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", "
", &ret)) return ret; | |
| 62 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 63 return ""; | |
| 64 } | |
| 65 | |
| 66 /** (Required) The PostScript name of the font. In principle, this is an arbitra
ry | |
| 67 * name, since there is no font program associated directly with a Type 0 font | |
| 68 * dictionary. The conventions described here ensure maximum compatibility | |
| 69 * with existing Acrobat products. | |
| 70 * If the descendant is a Type 0 CIDFont, this name should be the concatenation | |
| 71 * of the CIDFont's BaseFont name, a hyphen, and the CMap name given in the | |
| 72 * Encoding entry (or the CMapName entry in the CMap program itself). If the | |
| 73 * descendant is a Type 2 CIDFont, this name should be the same as the | |
| 74 * CIDFont's BaseFont name. | |
| 75 **/ | |
| 76 bool has_BaseFont() const { | |
| 77 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseF
ont", "", NULL)); | |
| 78 } | |
| 79 | |
| 80 std::string BaseFont() const { | |
| 81 std::string ret; | |
| 82 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseFont",
"", &ret)) return ret; | |
| 83 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 84 return ""; | |
| 85 } | |
| 86 | |
| 87 /** (Required) The name of a predefined CMap, or a stream containing a CMap | |
| 88 * program, that maps character codes to font numbers and CIDs. If the descen- | |
| 89 * dant is a Type 2 CIDFont whose associated TrueType font program is not em- | |
| 90 * bedded in the PDF file, the Encoding entry must be a predefined CMap name | |
| 91 * (see "Glyph Selection in CIDFonts" on page 339). | |
| 92 **/ | |
| 93 bool has_Encoding() const { | |
| 94 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encod
ing", "", NULL)); | |
| 95 } | |
| 96 | |
| 97 bool isEncodingAName() const { | |
| 98 SkPdfObject* ret = NULL; | |
| 99 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding
", "", &ret)) return false; | |
| 100 return ret->podofo()->GetDataType() == ePdfDataType_Name; | |
| 101 } | |
| 102 | |
| 103 std::string getEncodingAsName() const { | |
| 104 std::string ret = ""; | |
| 105 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding",
"", &ret)) return ret; | |
| 106 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 107 return ""; | |
| 108 } | |
| 109 | |
| 110 bool isEncodingAStream() const { | |
| 111 SkPdfObject* ret = NULL; | |
| 112 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding
", "", &ret)) return false; | |
| 113 return ret->podofo()->HasStream(); | |
| 114 } | |
| 115 | |
| 116 SkPdfStream* getEncodingAsStream() const { | |
| 117 SkPdfStream* ret = NULL; | |
| 118 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding"
, "", &ret)) return ret; | |
| 119 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 120 return NULL; | |
| 121 } | |
| 122 | |
| 123 /** (Required) An array specifying one or more fonts or CIDFonts that are | |
| 124 * descendants of this composite font. This array is indexed by the font number | |
| 125 * that is obtained by mapping a character code through the CMap specified in | |
| 126 * the Encoding entry. | |
| 127 * Note: In all PDF versions up to and including PDF 1.4, DescendantFonts must | |
| 128 * be a one-element array containing a CIDFont dictionary. | |
| 129 **/ | |
| 130 bool has_DescendantFonts() const { | |
| 131 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Desce
ndantFonts", "", NULL)); | |
| 132 } | |
| 133 | |
| 134 SkPdfArray DescendantFonts() const { | |
| 135 SkPdfArray ret; | |
| 136 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Descendant
Fonts", "", &ret)) return ret; | |
| 137 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 138 return SkPdfArray(); | |
| 139 } | |
| 140 | |
| 141 /** (Optional) A stream containing a CMap file that maps character codes to | |
| 142 * Unicode values (see Section 5.9, "ToUnicode CMaps"). | |
| 143 **/ | |
| 144 bool has_ToUnicode() const { | |
| 145 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUni
code", "", NULL)); | |
| 146 } | |
| 147 | |
| 148 SkPdfStream* ToUnicode() const { | |
| 149 SkPdfStream* ret; | |
| 150 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUnicode
", "", &ret)) return ret; | |
| 151 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 152 return NULL; | |
| 153 } | |
| 154 | |
| 155 }; | |
| 156 | |
| 157 #endif // __DEFINED__SkPdfType0FontDictionary | |
| OLD | NEW |