OLD | NEW |
| (Empty) |
1 #ifndef __DEFINED__SkPdfType1FontDictionary | |
2 #define __DEFINED__SkPdfType1FontDictionary | |
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 1 font dictionary | |
10 class SkPdfType1FontDictionary : public SkPdfFontDictionary { | |
11 public: | |
12 virtual SkPdfObjectType getType() const { return kType1FontDictionary_SkPdfObj
ectType;} | |
13 virtual SkPdfObjectType getTypeEnd() const { return kType1FontDictionary__End_
SkPdfObjectType;} | |
14 public: | |
15 virtual SkPdfType1FontDictionary* asType1FontDictionary() {return this;} | |
16 virtual const SkPdfType1FontDictionary* asType1FontDictionary() const {return
this;} | |
17 | |
18 private: | |
19 virtual SkPdfType0FontDictionary* asType0FontDictionary() {return NULL;} | |
20 virtual const SkPdfType0FontDictionary* asType0FontDictionary() const {return
NULL;} | |
21 | |
22 public: | |
23 private: | |
24 public: | |
25 SkPdfType1FontDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObje
ct* podofoObj = NULL) : SkPdfFontDictionary(podofoDoc, podofoObj) {} | |
26 | |
27 SkPdfType1FontDictionary(const SkPdfType1FontDictionary& from) : SkPdfFontDict
ionary(from.fPodofoDoc, from.fPodofoObj) {} | |
28 | |
29 virtual bool valid() const {return true;} | |
30 | |
31 SkPdfType1FontDictionary& operator=(const SkPdfType1FontDictionary& from) {thi
s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi
s;} | |
32 | |
33 /** (Required) The type of PDF object that this dictionary describes; must be | |
34 * Font for a font dictionary. | |
35 **/ | |
36 bool has_Type() const { | |
37 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); | |
38 } | |
39 | |
40 std::string Type() const; | |
41 /** (Required) The type of font; must be Type1 for a Type 1 font. | |
42 **/ | |
43 bool has_Subtype() const { | |
44 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subty
pe", "", NULL)); | |
45 } | |
46 | |
47 std::string Subtype() const; | |
48 /** (Required in PDF 1.0; optional otherwise) The name by which this font is ref
- | |
49 * erenced in the Font subdictionary of the current resource dictionary. | |
50 * Note: This entry is obsolescent and its use is no longer recommended. (See | |
51 * implementation note 42 in Appendix H.) | |
52 **/ | |
53 bool has_Name() const { | |
54 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name"
, "", NULL)); | |
55 } | |
56 | |
57 std::string Name() const; | |
58 /** (Required) The PostScript name of the font. For Type 1 fonts, this is usuall
y | |
59 * the value of the FontName entry in the font program; for more information, | |
60 * see Section 5.2 of the PostScript Language Reference, Third Edition. The Pos
t- | |
61 * Script name of the font can be used to find the font's definition in the vie
wer | |
62 * application or its environment. It is also the name that will be used when | |
63 * printing to a PostScript output device. | |
64 **/ | |
65 bool has_BaseFont() const { | |
66 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseF
ont", "", NULL)); | |
67 } | |
68 | |
69 std::string BaseFont() const; | |
70 /** (Required except for the standard 14 fonts) The first character code defined
in | |
71 * the font's Widths array. | |
72 **/ | |
73 bool has_FirstChar() const { | |
74 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "First
Char", "", NULL)); | |
75 } | |
76 | |
77 long FirstChar() const; | |
78 /** (Required except for the standard 14 fonts) The last character code defined
in | |
79 * the font's Widths array. | |
80 **/ | |
81 bool has_LastChar() const { | |
82 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LastC
har", "", NULL)); | |
83 } | |
84 | |
85 long LastChar() const; | |
86 /** (Required except for the standard 14 fonts; indirect reference preferred) An
array | |
87 * of (LastChar - FirstChar + 1) widths, each element being the glyph width for | |
88 * the character whose code is FirstChar plus the array index. For character | |
89 * codes outside the range FirstChar to LastChar, the value of MissingWidth fro
m | |
90 * the FontDescriptor entry for this font is used. The glyph widths are measure
d | |
91 * in units in which 1000 units corresponds to 1 unit in text space. These widt
hs | |
92 * must be consistent with the actual widths given in the font program itself. | |
93 * (See implementation note 43 in Appendix H.) For more information on | |
94 * glyph widths and other glyph metrics, see Section 5.1.3, "Glyph Positioning | |
95 * and Metrics." | |
96 **/ | |
97 bool has_Widths() const { | |
98 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Width
s", "", NULL)); | |
99 } | |
100 | |
101 SkPdfArray* Widths() const; | |
102 /** (Required except for the standard 14 fonts; must be an indirect reference) A
font | |
103 * descriptor describing the font's metrics other than its glyph widths (see Se
c- | |
104 * tion 5.7, "Font Descriptors"). | |
105 * Note: For the standard 14 fonts, the entries FirstChar, LastChar, Widths,
and | |
106 * FontDescriptor must either all be present or all absent. Ordinarily, they
are ab- | |
107 * sent; specifying them enables a standard font to be overridden (see "Stan
dard | |
108 * Type 1 Fonts," below). | |
109 **/ | |
110 bool has_FontDescriptor() const { | |
111 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontD
escriptor", "", NULL)); | |
112 } | |
113 | |
114 SkPdfFontDescriptorDictionary* FontDescriptor() const; | |
115 /** (Optional) A specification of the font's character encoding, if different fr
om | |
116 * its built-in encoding. The value of Encoding may be either the name of a pre
- | |
117 * defined encoding (MacRomanEncoding, MacExpertEncoding, or WinAnsi- | |
118 * Encoding, as described in Appendix D) or an encoding dictionary that | |
119 * specifies differences from the font's built-in encoding or from a specified
pre- | |
120 * defined encoding (see Section 5.5.5, "Character Encoding"). | |
121 **/ | |
122 bool has_Encoding() const { | |
123 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encod
ing", "", NULL)); | |
124 } | |
125 | |
126 bool isEncodingAName() const { | |
127 SkPdfObject* ret = NULL; | |
128 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding
", "", &ret)) return false; | |
129 return ret->podofo()->GetDataType() == ePdfDataType_Name; | |
130 } | |
131 | |
132 std::string getEncodingAsName() const; | |
133 bool isEncodingADictionary() const { | |
134 SkPdfObject* ret = NULL; | |
135 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding
", "", &ret)) return false; | |
136 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary; | |
137 } | |
138 | |
139 SkPdfDictionary* getEncodingAsDictionary() const; | |
140 /** (Optional; PDF 1.2) A stream containing a CMap file that maps character | |
141 * codes to Unicode values (see Section 5.9, "ToUnicode CMaps"). | |
142 **/ | |
143 bool has_ToUnicode() const { | |
144 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUni
code", "", NULL)); | |
145 } | |
146 | |
147 SkPdfStream* ToUnicode() const; | |
148 }; | |
149 | |
150 #endif // __DEFINED__SkPdfType1FontDictionary | |
OLD | NEW |