Data advance = kInvalidAdvance;
if (gId < lastIndex) {
// Get glyph id only when subset is NULL, or the id is in subset.
+ SkASSERT(!subsetGlyphIDs || (subsetIndex < subsetGlyphIDsLength &&
+ static_cast<uint32_t>(gId) <= subsetGlyphIDs[subsetIndex]));
if (!subsetGlyphIDs ||
(subsetIndex < subsetGlyphIDsLength &&
static_cast<uint32_t>(gId) == subsetGlyphIDs[subsetIndex])) {
if (fontInfo()->fType == SkAdvancedTypefaceMetrics::kTrueType_Font) {
// Generate glyph id array.
SkTDArray<uint32_t> glyphIDs;
- glyphIDs.push(0); // Always include glyph 0.
if (subset) {
+ // Always include glyph 0.
+ if (!subset->has(0)) {
+ glyphIDs.push(0);
+ }
subset->exportTo(&glyphIDs);
}
info = SkAdvancedTypefaceMetrics::kGlyphNames_PerGlyphInfo;
info = SkTBitOr<SkAdvancedTypefaceMetrics::PerGlyphInfo>(
info, SkAdvancedTypefaceMetrics::kHAdvance_PerGlyphInfo);
- uint32_t* glyphs = (glyphIDs.count() == 1) ? NULL : glyphIDs.begin();
+ uint32_t* glyphs = (glyphIDs.count() == 0) ? NULL : glyphIDs.begin();
uint32_t glyphsCount = glyphs ? glyphIDs.count() : 0;
SkAutoTUnref<SkAdvancedTypefaceMetrics> fontMetrics(
typeface()->getAdvancedTypefaceMetrics(info, glyphs, glyphsCount));