Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 <ctype.h> | 8 #include <ctype.h> |
| 9 | 9 |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 541 // Use C-style cast to cast away const and cast type simultaneously. | 541 // Use C-style cast to cast away const and cast type simultaneously. |
| 542 delete[] (unsigned char*)ptr; | 542 delete[] (unsigned char*)ptr; |
| 543 } | 543 } |
| 544 #endif | 544 #endif |
| 545 | 545 |
| 546 static int get_subset_font_stream(const char* fontName, | 546 static int get_subset_font_stream(const char* fontName, |
| 547 const SkTypeface* typeface, | 547 const SkTypeface* typeface, |
| 548 const SkTDArray<uint32_t>& subset, | 548 const SkTDArray<uint32_t>& subset, |
| 549 SkPDFStream** fontStream) { | 549 SkPDFStream** fontStream) { |
| 550 int ttcIndex; | 550 int ttcIndex; |
| 551 SkAutoTUnref<SkStream> fontData(typeface->openStream(&ttcIndex)); | 551 SkAutoTUnref<SkStream> fontData(typeface->openStream(&ttcIndex)); |
|
vandebo (ex-Chrome)
2013/03/21 00:55:11
Shouldn't typeface->openStream() return a stream a
bungeman-skia
2013/03/21 03:25:12
I have to agree, this is an issue with reed's chan
edisonn
2013/03/21 13:33:08
done; added issue 1176 for the thread safety. righ
| |
| 552 fontData->rewind(); | |
|
edisonn
2013/03/21 13:33:08
Steve's comments:
1) openStream should give alread
| |
| 552 | 553 |
| 553 int fontSize = fontData->getLength(); | 554 int fontSize = fontData->getLength(); |
| 554 | 555 |
| 555 #if defined (SK_SFNTLY_SUBSETTER) | 556 #if defined (SK_SFNTLY_SUBSETTER) |
| 556 // Read font into buffer. | 557 // Read font into buffer. |
| 557 SkPDFStream* subsetFontStream = NULL; | 558 SkPDFStream* subsetFontStream = NULL; |
| 558 SkTDArray<unsigned char> originalFont; | 559 SkTDArray<unsigned char> originalFont; |
| 559 originalFont.setCount(fontSize); | 560 originalFont.setCount(fontSize); |
| 560 if (fontData->read(originalFont.begin(), fontSize) == (size_t)fontSize) { | 561 if (fontData->read(originalFont.begin(), fontSize) == (size_t)fontSize) { |
| 561 unsigned char* subsetFont = NULL; | 562 unsigned char* subsetFont = NULL; |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1407 | 1408 |
| 1408 insert("FontBBox", makeFontBBox(bbox, 1000))->unref(); | 1409 insert("FontBBox", makeFontBBox(bbox, 1000))->unref(); |
| 1409 insertInt("FirstChar", firstGlyphID()); | 1410 insertInt("FirstChar", firstGlyphID()); |
| 1410 insertInt("LastChar", lastGlyphID()); | 1411 insertInt("LastChar", lastGlyphID()); |
| 1411 insert("Widths", widthArray.get()); | 1412 insert("Widths", widthArray.get()); |
| 1412 insertName("CIDToGIDMap", "Identity"); | 1413 insertName("CIDToGIDMap", "Identity"); |
| 1413 | 1414 |
| 1414 populateToUnicodeTable(NULL); | 1415 populateToUnicodeTable(NULL); |
| 1415 return true; | 1416 return true; |
| 1416 } | 1417 } |
| OLD | NEW |