SkFontHost/FreeType/ToUnicode: add an assert
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1900193002 Review URL: https://codereview.chromium.org/1900193002
This commit is contained in:
parent
9d08172828
commit
f8c74a1ef9
@ -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) {
|
static void populate_glyph_to_unicode(FT_Face& face, SkTDArray<SkUnichar>* glyphToUnicode) {
|
||||||
glyphToUnicode->setCount(face->num_glyphs);
|
FT_Long numGlyphs = face->num_glyphs;
|
||||||
sk_bzero(glyphToUnicode->begin(), sizeof((*glyphToUnicode)[0]) * face->num_glyphs);
|
glyphToUnicode->setCount(SkToInt(numGlyphs));
|
||||||
|
sk_bzero(glyphToUnicode->begin(), sizeof((*glyphToUnicode)[0]) * numGlyphs);
|
||||||
|
|
||||||
FT_UInt glyphIndex;
|
FT_UInt glyphIndex;
|
||||||
SkUnichar charCode = FT_Get_First_Char(face, &glyphIndex);
|
SkUnichar charCode = FT_Get_First_Char(face, &glyphIndex);
|
||||||
while (glyphIndex) {
|
while (glyphIndex) {
|
||||||
|
SkASSERT(glyphIndex < SkToUInt(numGlyphs));
|
||||||
(*glyphToUnicode)[glyphIndex] = charCode;
|
(*glyphToUnicode)[glyphIndex] = charCode;
|
||||||
charCode = FT_Get_Next_Char(face, charCode, &glyphIndex);
|
charCode = FT_Get_Next_Char(face, charCode, &glyphIndex);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user