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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 | 304 |
305 return new SkPdfMultiMasterFont(doc, dict); | 305 return new SkPdfMultiMasterFont(doc, dict); |
306 } | 306 } |
307 | 307 |
308 static int skstoi(const SkPdfObject* str) { | 308 static int skstoi(const SkPdfObject* str) { |
309 // TODO(edisonn): report err of it is not a (hex) string | 309 // TODO(edisonn): report err of it is not a (hex) string |
310 int ret = 0; | 310 int ret = 0; |
311 for (unsigned int i = 0 ; i < str->len(); i++) { | 311 for (unsigned int i = 0 ; i < str->len(); i++) { |
312 ret = (ret << 8) + ((unsigned char*)str->c_str())[i]; | 312 ret = (ret << 8) + ((unsigned char*)str->c_str())[i]; |
313 } | 313 } |
314 return ret; | 314 // TODO(edisonn): character larger than 0x0000ffff not supported right now. |
| 315 return ret & 0x0000ffff; |
315 } | 316 } |
316 | 317 |
317 #define tokenIsKeyword(token,keyword) (token.fType == kKeyword_TokenType && toke
n.fKeywordLength==sizeof(keyword)-1 && strncmp(token.fKeyword, keyword, sizeof(k
eyword)-1) == 0) | 318 #define tokenIsKeyword(token,keyword) (token.fType == kKeyword_TokenType && toke
n.fKeywordLength==sizeof(keyword)-1 && strncmp(token.fKeyword, keyword, sizeof(k
eyword)-1) == 0) |
318 | 319 |
319 SkPdfToUnicode::SkPdfToUnicode(SkNativeParsedPDF* parsed, SkPdfStream* stream) :
fParsed(parsed) { | 320 SkPdfToUnicode::SkPdfToUnicode(SkNativeParsedPDF* parsed, SkPdfStream* stream) :
fParsed(parsed) { |
320 fCMapEncoding = NULL; | 321 fCMapEncoding = NULL; |
321 fCMapEncodingFlag = NULL; | 322 fCMapEncodingFlag = NULL; |
322 | 323 |
323 if (stream) { | 324 if (stream) { |
324 // Since font will be cached, the font has to sit in the per doc allocat
or, not to be | 325 // Since font will be cached, the font has to sit in the per doc allocat
or, not to be |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 SkPdfEncoding* SkPdfEncoding::fromName(const char* name) { | 445 SkPdfEncoding* SkPdfEncoding::fromName(const char* name) { |
445 SkPdfEncoding* encoding = getStandardEncodings()[name]; | 446 SkPdfEncoding* encoding = getStandardEncodings()[name]; |
446 | 447 |
447 #ifdef PDF_TRACE | 448 #ifdef PDF_TRACE |
448 if (encoding == NULL) { | 449 if (encoding == NULL) { |
449 printf("Encoding not found: %s\n", name); | 450 printf("Encoding not found: %s\n", name); |
450 } | 451 } |
451 #endif | 452 #endif |
452 return encoding; | 453 return encoding; |
453 } | 454 } |
OLD | NEW |