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

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

Issue 19670019: pdfviewer: fix type3 font, make SkPdfObject::get parameter const (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/pdfparser/native/SkPdfObject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #ifndef __DEFINED__SkPdfFont 1 #ifndef __DEFINED__SkPdfFont
2 #define __DEFINED__SkPdfFont 2 #define __DEFINED__SkPdfFont
3 3
4 #include "SkPdfHeaders_autogen.h" 4 #include "SkPdfHeaders_autogen.h"
5 #include "SkPdfMapper_autogen.h" 5 #include "SkPdfMapper_autogen.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "SkTypeface.h" 10 #include "SkTypeface.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 Type3FontChar* fChars; 330 Type3FontChar* fChars;
331 331
332 public: 332 public:
333 SkPdfType3Font(SkNativeParsedPDF* parsed, SkPdfType3FontDictionary* dict) { 333 SkPdfType3Font(SkNativeParsedPDF* parsed, SkPdfType3FontDictionary* dict) {
334 fBaseFont = fontFromName(parsed, dict, dict->BaseFont(parsed).c_str()); 334 fBaseFont = fontFromName(parsed, dict, dict->BaseFont(parsed).c_str());
335 335
336 if (dict->has_Encoding()) { 336 if (dict->has_Encoding()) {
337 if (dict->isEncodingAName(parsed)) { 337 if (dict->isEncodingAName(parsed)) {
338 fEncoding = SkPdfEncoding::fromName(dict->getEncodingAsName(par sed).c_str()); 338 fEncoding = SkPdfEncoding::fromName(dict->getEncodingAsName(par sed).c_str());
339 } else if (dict->isEncodingAEncodingdictionary(parsed)) { 339 } else if (dict->isEncodingAEncodingdictionary(parsed)) {
340 // technically, there is no encoding. 340 // No encoding.
341 fEncoding = SkPdfCIDToGIDMapIdentityEncoding::instance(); 341 fEncoding = SkPdfDefaultEncoding::instance();
342 fEncodingDict = dict->getEncodingAsEncodingdictionary(parsed); 342 fEncodingDict = dict->getEncodingAsEncodingdictionary(parsed);
343 } 343 }
344 } 344 }
345 345
346 // null? 346 // null?
347 fCharProcs = dict->CharProcs(parsed); 347 fCharProcs = dict->CharProcs(parsed);
348 348
349 fToUnicode = NULL; 349 fToUnicode = NULL;
350 if (dict->has_ToUnicode()) { 350 if (dict->has_ToUnicode()) {
351 fToUnicode = new SkPdfToUnicode(parsed, dict->ToUnicode(parsed)); 351 fToUnicode = new SkPdfToUnicode(parsed, dict->ToUnicode(parsed));
(...skipping 22 matching lines...) Expand all
374 374
375 const SkPdfArray* diffs = fEncodingDict->Differences(parsed); 375 const SkPdfArray* diffs = fEncodingDict->Differences(parsed);
376 unsigned int j = fFirstChar; 376 unsigned int j = fFirstChar;
377 for (unsigned int i = 0 ; i < diffs->size(); i++) { 377 for (unsigned int i = 0 ; i < diffs->size(); i++) {
378 if ((*diffs)[i]->isInteger()) { 378 if ((*diffs)[i]->isInteger()) {
379 j = (unsigned int)(*diffs)[i]->intValue(); 379 j = (unsigned int)(*diffs)[i]->intValue();
380 } else if ((*diffs)[i]->isName()) { 380 } else if ((*diffs)[i]->isName()) {
381 if (j < fFirstChar || j > fLastChar) { 381 if (j < fFirstChar || j > fLastChar) {
382 printf("break; error 2\n"); 382 printf("break; error 2\n");
383 } 383 }
384 fChars[j - fFirstChar].fObj = fCharProcs->get((*diffs)[i]->nameV alue()); 384 fChars[j - fFirstChar].fObj = fCharProcs->get((*diffs)[i]);
385 j++; 385 j++;
386 } else { 386 } else {
387 // err 387 // err
388 } 388 }
389 } 389 }
390 } 390 }
391 391
392 public: 392 public:
393 virtual double drawOneChar(unsigned int ch, SkPaint* paint, PdfContext* pdfC ontext, SkCanvas* canvas) { 393 virtual double drawOneChar(unsigned int ch, SkPaint* paint, PdfContext* pdfC ontext, SkCanvas* canvas) {
394 if (ch < fFirstChar || ch > fLastChar || !fChars[ch - fFirstChar].fObj) { 394 if (ch < fFirstChar || ch > fLastChar || !fChars[ch - fFirstChar].fObj) {
(...skipping 15 matching lines...) Expand all
410 SkDoubleToScalar(0.0)); 410 SkDoubleToScalar(0.0));
411 return fChars[ch - fFirstChar].fWidth; 411 return fChars[ch - fFirstChar].fWidth;
412 } 412 }
413 413
414 virtual void afterWord(SkPaint* paint, SkMatrix* matrix) { 414 virtual void afterWord(SkPaint* paint, SkMatrix* matrix) {
415 415
416 } 416 }
417 }; 417 };
418 418
419 #endif // __DEFINED__SkPdfFont 419 #endif // __DEFINED__SkPdfFont
OLDNEW
« no previous file with comments | « no previous file | experimental/PdfViewer/pdfparser/native/SkPdfObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698