OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkPdfFont.h" | 8 #include "SkPdfFont.h" |
9 | 9 |
10 #include "SkPdfNativeTokenizer.h" | 10 #include "SkPdfNativeTokenizer.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 ret = (ret << 8) + ((unsigned char*)str->c_str())[i]; | 322 ret = (ret << 8) + ((unsigned char*)str->c_str())[i]; |
323 } | 323 } |
324 // TODO(edisonn): character larger than 0x0000ffff not supported right now. | 324 // TODO(edisonn): character larger than 0x0000ffff not supported right now. |
325 return ret & 0x0000ffff; | 325 return ret & 0x0000ffff; |
326 } | 326 } |
327 | 327 |
328 #define tokenIsKeyword(token,keyword) (token.fType == kKeyword_TokenType && \ | 328 #define tokenIsKeyword(token,keyword) (token.fType == kKeyword_TokenType && \ |
329 token.fKeywordLength==sizeof(keyword)-1 &&
\ | 329 token.fKeywordLength==sizeof(keyword)-1 &&
\ |
330 strncmp(token.fKeyword, keyword, sizeof(ke
yword)-1) == 0) | 330 strncmp(token.fKeyword, keyword, sizeof(ke
yword)-1) == 0) |
331 | 331 |
332 SkPdfToUnicode::SkPdfToUnicode(SkPdfNativeDoc* parsed, SkPdfStream* stream) : fP
arsed(parsed) { | 332 SkPdfToUnicode::SkPdfToUnicode(SkPdfNativeDoc* parsed, SkPdfStream* stream) { |
333 fCMapEncoding = NULL; | 333 fCMapEncoding = NULL; |
334 fCMapEncodingFlag = NULL; | 334 fCMapEncodingFlag = NULL; |
335 | 335 |
336 if (stream) { | 336 if (stream) { |
337 // Since font will be cached, the font has to sit in the per doc allocat
or, not to be | 337 // Since font will be cached, the font has to sit in the per doc allocat
or, not to be |
338 // freed after the page is done drawing. | 338 // freed after the page is done drawing. |
339 SkPdfNativeTokenizer tokenizer(stream, parsed->allocator(), parsed); | 339 SkPdfNativeTokenizer tokenizer(stream, parsed->allocator(), parsed); |
340 PdfToken token; | 340 PdfToken token; |
341 | 341 |
342 fCMapEncoding = new unsigned short[256 * 256]; | 342 fCMapEncoding = new unsigned short[256 * 256]; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 encoding = NULL; | 459 encoding = NULL; |
460 } | 460 } |
461 | 461 |
462 #ifdef PDF_TRACE | 462 #ifdef PDF_TRACE |
463 if (encoding == NULL) { | 463 if (encoding == NULL) { |
464 printf("Encoding not found: %s\n", name); | 464 printf("Encoding not found: %s\n", name); |
465 } | 465 } |
466 #endif | 466 #endif |
467 return encoding; | 467 return encoding; |
468 } | 468 } |
OLD | NEW |