| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 190 |
| 191 SkPdfFont* fontFromName(SkNativeParsedPDF* doc, SkPdfObject* obj, const char* fo
ntName) { | 191 SkPdfFont* fontFromName(SkNativeParsedPDF* doc, SkPdfObject* obj, const char* fo
ntName) { |
| 192 SkTypeface* typeface = SkTypefaceFromPdfStandardFont(fontName, false, false)
; | 192 SkTypeface* typeface = SkTypefaceFromPdfStandardFont(fontName, false, false)
; |
| 193 if (typeface != NULL) { | 193 if (typeface != NULL) { |
| 194 return new SkPdfStandardFont(typeface); | 194 return new SkPdfStandardFont(typeface); |
| 195 } | 195 } |
| 196 | 196 |
| 197 // TODO(edisonn): perf - make a map | 197 // TODO(edisonn): perf - make a map |
| 198 for (unsigned int i = 0 ; i < doc->objects(); i++) { | 198 for (unsigned int i = 0 ; i < doc->objects(); i++) { |
| 199 SkPdfObject* obj = doc->object(i); | 199 SkPdfObject* obj = doc->object(i); |
| 200 if (!obj->isDictionary()) { | 200 if (!obj || !obj->isDictionary()) { |
| 201 continue; | 201 continue; |
| 202 } | 202 } |
| 203 | 203 |
| 204 SkPdfFontDescriptorDictionary* fd = obj->asDictionary()->asFontDescripto
rDictionary(); | 204 SkPdfFontDescriptorDictionary* fd = obj->asDictionary()->asFontDescripto
rDictionary(); |
| 205 | 205 |
| 206 if (!fd->valid()) { | 206 if (!fd->valid()) { |
| 207 continue; | 207 continue; |
| 208 } | 208 } |
| 209 | 209 |
| 210 if (fd->has_FontName() && fd->FontName(doc) == fontName) { | 210 if (fd->has_FontName() && fd->FontName(doc) == fontName) { |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 SkPdfEncoding* SkPdfEncoding::fromName(const char* name) { | 444 SkPdfEncoding* SkPdfEncoding::fromName(const char* name) { |
| 445 SkPdfEncoding* encoding = getStandardEncodings()[name]; | 445 SkPdfEncoding* encoding = getStandardEncodings()[name]; |
| 446 | 446 |
| 447 #ifdef PDF_TRACE | 447 #ifdef PDF_TRACE |
| 448 if (encoding == NULL) { | 448 if (encoding == NULL) { |
| 449 printf("Encoding not found: %s\n", name); | 449 printf("Encoding not found: %s\n", name); |
| 450 } | 450 } |
| 451 #endif | 451 #endif |
| 452 return encoding; | 452 return encoding; |
| 453 } | 453 } |
| OLD | NEW |