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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 // for TrueType fonts. | 822 // for TrueType fonts. |
823 SkAdvancedTypefaceMetrics::FontType fontType = | 823 SkAdvancedTypefaceMetrics::FontType fontType = |
824 fontMetrics.get() ? fontMetrics.get()->fType : | 824 fontMetrics.get() ? fontMetrics.get()->fType : |
825 SkAdvancedTypefaceMetrics::kOther_Font; | 825 SkAdvancedTypefaceMetrics::kOther_Font; |
826 | 826 |
827 if (fontType == SkAdvancedTypefaceMetrics::kType1CID_Font || | 827 if (fontType == SkAdvancedTypefaceMetrics::kType1CID_Font || |
828 fontType == SkAdvancedTypefaceMetrics::kTrueType_Font) { | 828 fontType == SkAdvancedTypefaceMetrics::kTrueType_Font) { |
829 return SkRef(relatedFont); | 829 return SkRef(relatedFont); |
830 } | 830 } |
831 } else { | 831 } else { |
832 SkAdvancedTypefaceMetrics::PerGlyphInfo info; | 832 SkTypeface::PerGlyphInfo info; |
833 info = SkAdvancedTypefaceMetrics::kGlyphNames_PerGlyphInfo; | 833 info = SkTypeface::kGlyphNames_PerGlyphInfo; |
834 info = SkTBitOr<SkAdvancedTypefaceMetrics::PerGlyphInfo>( | 834 info = SkTBitOr<SkTypeface::PerGlyphInfo>( |
835 info, SkAdvancedTypefaceMetrics::kToUnicode_PerGlyphInfo); | 835 info, SkTypeface::kToUnicode_PerGlyphInfo); |
836 #if !defined (SK_SFNTLY_SUBSETTER) | 836 #if !defined (SK_SFNTLY_SUBSETTER) |
837 info = SkTBitOr<SkAdvancedTypefaceMetrics::PerGlyphInfo>( | 837 info = SkTBitOr<SkTypeface::PerGlyphInfo>( |
838 info, SkAdvancedTypefaceMetrics::kHAdvance_PerGlyphInfo); | 838 info, SkTypeface::kHAdvance_PerGlyphInfo); |
839 #endif | 839 #endif |
840 fontMetrics.reset( | 840 fontMetrics.reset( |
841 typeface->getAdvancedTypefaceMetrics(info, NULL, 0)); | 841 typeface->getAdvancedTypefaceMetrics(info, NULL, 0)); |
842 #if defined (SK_SFNTLY_SUBSETTER) | 842 #if defined (SK_SFNTLY_SUBSETTER) |
843 if (fontMetrics.get() && | 843 if (fontMetrics.get() && |
844 fontMetrics->fType != SkAdvancedTypefaceMetrics::kTrueType_Font) { | 844 fontMetrics->fType != SkAdvancedTypefaceMetrics::kTrueType_Font) { |
845 // Font does not support subsetting, get new info with advance. | 845 // Font does not support subsetting, get new info with advance. |
846 info = SkTBitOr<SkAdvancedTypefaceMetrics::PerGlyphInfo>( | 846 info = SkTBitOr<SkAdvancedTypefaceMetrics::PerGlyphInfo>( |
847 info, SkAdvancedTypefaceMetrics::kHAdvance_PerGlyphInfo); | 847 info, SkAdvancedTypefaceMetrics::kHAdvance_PerGlyphInfo); |
848 fontMetrics.reset( | 848 fontMetrics.reset( |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 // Generate glyph id array. | 1120 // Generate glyph id array. |
1121 SkTDArray<uint32_t> glyphIDs; | 1121 SkTDArray<uint32_t> glyphIDs; |
1122 if (subset) { | 1122 if (subset) { |
1123 // Always include glyph 0. | 1123 // Always include glyph 0. |
1124 if (!subset->has(0)) { | 1124 if (!subset->has(0)) { |
1125 glyphIDs.push(0); | 1125 glyphIDs.push(0); |
1126 } | 1126 } |
1127 subset->exportTo(&glyphIDs); | 1127 subset->exportTo(&glyphIDs); |
1128 } | 1128 } |
1129 | 1129 |
1130 SkAdvancedTypefaceMetrics::PerGlyphInfo info; | 1130 SkTypeface::PerGlyphInfo info; |
1131 info = SkAdvancedTypefaceMetrics::kGlyphNames_PerGlyphInfo; | 1131 info = SkTypeface::kGlyphNames_PerGlyphInfo; |
1132 info = SkTBitOr<SkAdvancedTypefaceMetrics::PerGlyphInfo>( | 1132 info = SkTBitOr<SkTypeface::PerGlyphInfo>( |
1133 info, SkAdvancedTypefaceMetrics::kHAdvance_PerGlyphInfo); | 1133 info, SkTypeface::kHAdvance_PerGlyphInfo); |
1134 uint32_t* glyphs = (glyphIDs.count() == 0) ? NULL : glyphIDs.begin(); | 1134 uint32_t* glyphs = (glyphIDs.count() == 0) ? NULL : glyphIDs.begin(); |
1135 uint32_t glyphsCount = glyphs ? glyphIDs.count() : 0; | 1135 uint32_t glyphsCount = glyphs ? glyphIDs.count() : 0; |
1136 SkAutoTUnref<const SkAdvancedTypefaceMetrics> fontMetrics( | 1136 SkAutoTUnref<const SkAdvancedTypefaceMetrics> fontMetrics( |
1137 typeface()->getAdvancedTypefaceMetrics(info, glyphs, glyphsCount)); | 1137 typeface()->getAdvancedTypefaceMetrics(info, glyphs, glyphsCount)); |
1138 setFontInfo(fontMetrics.get()); | 1138 setFontInfo(fontMetrics.get()); |
1139 addFontDescriptor(0, &glyphIDs); | 1139 addFontDescriptor(0, &glyphIDs); |
1140 } else { | 1140 } else { |
1141 // Other CID fonts | 1141 // Other CID fonts |
1142 addFontDescriptor(0, NULL); | 1142 addFontDescriptor(0, NULL); |
1143 } | 1143 } |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 } | 1418 } |
1419 if (existingFont != NULL) { | 1419 if (existingFont != NULL) { |
1420 return (existingFont->fFirstGlyphID <= searchGlyphID && | 1420 return (existingFont->fFirstGlyphID <= searchGlyphID && |
1421 searchGlyphID <= existingFont->fLastGlyphID) | 1421 searchGlyphID <= existingFont->fLastGlyphID) |
1422 ? SkPDFFont::kExact_Match | 1422 ? SkPDFFont::kExact_Match |
1423 : SkPDFFont::kRelated_Match; | 1423 : SkPDFFont::kRelated_Match; |
1424 } | 1424 } |
1425 return (existingGlyphID == searchGlyphID) ? SkPDFFont::kExact_Match | 1425 return (existingGlyphID == searchGlyphID) ? SkPDFFont::kExact_Match |
1426 : SkPDFFont::kRelated_Match; | 1426 : SkPDFFont::kRelated_Match; |
1427 } | 1427 } |
OLD | NEW |