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