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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 | 596 |
597 #if defined (SK_SFNTLY_SUBSETTER) | 597 #if defined (SK_SFNTLY_SUBSETTER) |
598 // Read font into buffer. | 598 // Read font into buffer. |
599 SkPDFStream* subsetFontStream = NULL; | 599 SkPDFStream* subsetFontStream = NULL; |
600 SkTDArray<unsigned char> originalFont; | 600 SkTDArray<unsigned char> originalFont; |
601 originalFont.setCount(SkToInt(fontSize)); | 601 originalFont.setCount(SkToInt(fontSize)); |
602 if (fontData->read(originalFont.begin(), fontSize) == fontSize) { | 602 if (fontData->read(originalFont.begin(), fontSize) == fontSize) { |
603 unsigned char* subsetFont = NULL; | 603 unsigned char* subsetFont = NULL; |
604 // sfntly requires unsigned int* to be passed in, as far as we know, | 604 // sfntly requires unsigned int* to be passed in, as far as we know, |
605 // unsigned int is equivalent to uint32_t on all platforms. | 605 // unsigned int is equivalent to uint32_t on all platforms. |
606 SK_COMPILE_ASSERT(sizeof(unsigned int) == sizeof(uint32_t), | 606 static_assert(sizeof(unsigned int) == sizeof(uint32_t), "unsigned_int_no
t_32_bits"); |
607 unsigned_int_not_32_bits); | |
608 int subsetFontSize = SfntlyWrapper::SubsetFont(fontName, | 607 int subsetFontSize = SfntlyWrapper::SubsetFont(fontName, |
609 originalFont.begin(), | 608 originalFont.begin(), |
610 fontSize, | 609 fontSize, |
611 subset.begin(), | 610 subset.begin(), |
612 subset.count(), | 611 subset.count(), |
613 &subsetFont); | 612 &subsetFont); |
614 if (subsetFontSize > 0 && subsetFont != NULL) { | 613 if (subsetFontSize > 0 && subsetFont != NULL) { |
615 SkAutoDataUnref data(SkData::NewWithProc(subsetFont, | 614 SkAutoDataUnref data(SkData::NewWithProc(subsetFont, |
616 subsetFontSize, | 615 subsetFontSize, |
617 sk_delete_array, | 616 sk_delete_array, |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 } | 1411 } |
1413 if (existingFont != NULL) { | 1412 if (existingFont != NULL) { |
1414 return (existingFont->fFirstGlyphID <= searchGlyphID && | 1413 return (existingFont->fFirstGlyphID <= searchGlyphID && |
1415 searchGlyphID <= existingFont->fLastGlyphID) | 1414 searchGlyphID <= existingFont->fLastGlyphID) |
1416 ? SkPDFFont::kExact_Match | 1415 ? SkPDFFont::kExact_Match |
1417 : SkPDFFont::kRelated_Match; | 1416 : SkPDFFont::kRelated_Match; |
1418 } | 1417 } |
1419 return (existingGlyphID == searchGlyphID) ? SkPDFFont::kExact_Match | 1418 return (existingGlyphID == searchGlyphID) ? SkPDFFont::kExact_Match |
1420 : SkPDFFont::kRelated_Match; | 1419 : SkPDFFont::kRelated_Match; |
1421 } | 1420 } |
OLD | NEW |