OLD | NEW |
1 #include "SkPdfFont.h" | 1 #include "SkPdfFont.h" |
2 | 2 |
3 #include "SkStream.h" | 3 #include "SkStream.h" |
4 #include "SkTypeface.h" | 4 #include "SkTypeface.h" |
5 #include "SkPdfNativeTokenizer.h" | 5 #include "SkPdfNativeTokenizer.h" |
6 | 6 |
7 std::map<std::string, SkPdfStandardFontEntry>& getStandardFonts() { | 7 std::map<std::string, SkPdfStandardFontEntry>& getStandardFonts() { |
8 static std::map<std::string, SkPdfStandardFontEntry> gPdfStandardFonts; | 8 static std::map<std::string, SkPdfStandardFontEntry> gPdfStandardFonts; |
9 | 9 |
10 // TODO (edisonn): , vs - ? what does it mean? | 10 // TODO (edisonn): , vs - ? what does it mean? |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 // TODO(edisonn): report error? | 248 // TODO(edisonn): report error? |
249 return NULL; | 249 return NULL; |
250 } | 250 } |
251 } | 251 } |
252 | 252 |
253 SkPdfFont* SkPdfFont::fontFromPdfDictionary(SkNativeParsedPDF* doc, SkPdfFontDic
tionary* dict) { | 253 SkPdfFont* SkPdfFont::fontFromPdfDictionary(SkNativeParsedPDF* doc, SkPdfFontDic
tionary* dict) { |
254 if (dict == NULL) { | 254 if (dict == NULL) { |
255 return NULL; // TODO(edisonn): report default one? | 255 return NULL; // TODO(edisonn): report default one? |
256 } | 256 } |
257 | 257 |
258 if (dict->data() == NULL) { | 258 if (!dict->hasData(SkPdfObject::kFont_Data)) { |
259 dict->setData(fontFromPdfDictionaryOnce(doc, dict)); | 259 dict->setData(fontFromPdfDictionaryOnce(doc, dict), SkPdfObject::kFont_D
ata); |
260 } | 260 } |
261 return (SkPdfFont*)dict->data(); | 261 return (SkPdfFont*)dict->data(SkPdfObject::kFont_Data); |
262 } | 262 } |
263 | 263 |
264 | 264 |
265 | 265 |
266 SkPdfType0Font* SkPdfFont::fontFromType0FontDictionary(SkNativeParsedPDF* doc, S
kPdfType0FontDictionary* dict) { | 266 SkPdfType0Font* SkPdfFont::fontFromType0FontDictionary(SkNativeParsedPDF* doc, S
kPdfType0FontDictionary* dict) { |
267 if (dict == NULL) { | 267 if (dict == NULL) { |
268 return NULL; // default one? | 268 return NULL; // default one? |
269 } | 269 } |
270 | 270 |
271 return new SkPdfType0Font(doc, dict); | 271 return new SkPdfType0Font(doc, dict); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 SkPdfEncoding* SkPdfEncoding::fromName(const char* name) { | 445 SkPdfEncoding* SkPdfEncoding::fromName(const char* name) { |
446 SkPdfEncoding* encoding = getStandardEncodings()[name]; | 446 SkPdfEncoding* encoding = getStandardEncodings()[name]; |
447 | 447 |
448 #ifdef PDF_TRACE | 448 #ifdef PDF_TRACE |
449 if (encoding == NULL) { | 449 if (encoding == NULL) { |
450 printf("Encoding not found: %s\n", name); | 450 printf("Encoding not found: %s\n", name); |
451 } | 451 } |
452 #endif | 452 #endif |
453 return encoding; | 453 return encoding; |
454 } | 454 } |
OLD | NEW |