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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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)); |
352 } | 352 } |
353 | 353 |
354 fFirstChar = dict->FirstChar(parsed); | 354 fFirstChar = (unsigned int)dict->FirstChar(parsed); |
355 fLastChar = dict->LastChar(parsed); | 355 fLastChar = (unsigned int)dict->LastChar(parsed); |
356 fFonMatrix = dict->has_FontMatrix() ? dict->FontMatrix(parsed) : SkMatri
x::I(); | 356 fFonMatrix = dict->has_FontMatrix() ? dict->FontMatrix(parsed) : SkMatri
x::I(); |
357 | 357 |
358 if (dict->has_FontBBox()) { | 358 if (dict->has_FontBBox()) { |
359 fFontBBox = dict->FontBBox(parsed); | 359 fFontBBox = dict->FontBBox(parsed); |
360 } | 360 } |
361 | 361 |
362 fChars = new Type3FontChar[fLastChar - fFirstChar + 1]; | 362 fChars = new Type3FontChar[fLastChar - fFirstChar + 1]; |
363 | 363 |
364 memset(fChars, 0, sizeof(fChars[0]) * (fLastChar - fFirstChar + 1)); | 364 memset(fChars, 0, sizeof(fChars[0]) * (fLastChar - fFirstChar + 1)); |
365 | 365 |
366 | 366 |
367 const SkPdfArray* widths = dict->Widths(parsed); | 367 const SkPdfArray* widths = dict->Widths(parsed); |
368 for (unsigned int i = 0 ; i < widths->size(); i++) { | 368 for (unsigned int i = 0 ; i < widths->size(); i++) { |
369 if ((fFirstChar + i) < fFirstChar || (fFirstChar + i) > fLastChar) { | 369 if ((fFirstChar + i) < fFirstChar || (fFirstChar + i) > fLastChar) { |
370 printf("break; error 1\n"); | 370 printf("break; error 1\n"); |
371 } | 371 } |
372 fChars[i].fWidth = (*widths)[i]->numberValue(); | 372 fChars[i].fWidth = (*widths)[i]->numberValue(); |
373 } | 373 } |
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 = (*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]->nameV
alue()); |
385 j++; | 385 j++; |
386 } else { | 386 } else { |
387 // err | 387 // err |
388 } | 388 } |
389 } | 389 } |
(...skipping 20 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 |