| Index: src/ports/SkFontHost_FreeType.cpp
|
| diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
|
| index 55eb87fe6d4bfadb8eadfaf01ec78128e5981855..3b1a5b207dca4c59c2c845f6f37310043398c410 100644
|
| --- a/src/ports/SkFontHost_FreeType.cpp
|
| +++ b/src/ports/SkFontHost_FreeType.cpp
|
| @@ -445,12 +445,14 @@ static bool getWidthAdvance(FT_Face face, int gId, int16_t* data) {
|
| }
|
|
|
| static void populate_glyph_to_unicode(FT_Face& face, SkTDArray<SkUnichar>* glyphToUnicode) {
|
| - glyphToUnicode->setCount(face->num_glyphs);
|
| - sk_bzero(glyphToUnicode->begin(), sizeof((*glyphToUnicode)[0]) * face->num_glyphs);
|
| + FT_Long numGlyphs = face->num_glyphs;
|
| + glyphToUnicode->setCount(SkToInt(numGlyphs));
|
| + sk_bzero(glyphToUnicode->begin(), sizeof((*glyphToUnicode)[0]) * numGlyphs);
|
|
|
| FT_UInt glyphIndex;
|
| SkUnichar charCode = FT_Get_First_Char(face, &glyphIndex);
|
| while (glyphIndex) {
|
| + SkASSERT(glyphIndex < SkToUInt(numGlyphs));
|
| (*glyphToUnicode)[glyphIndex] = charCode;
|
| charCode = FT_Get_Next_Char(face, charCode, &glyphIndex);
|
| }
|
|
|