OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |