Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1526)

Side by Side Diff: experimental/PdfViewer/SkPdfFont.cpp

Issue 20538002: pdfviewer: limit the characters we support in ToUnicode, to 0xffff (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | experimental/PdfViewer/pdf_viewer_main.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | experimental/PdfViewer/pdf_viewer_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698