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