| Index: src/ports/SkFontHost_FreeType.cpp
|
| diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
|
| index 30e5fb340f4ddeb154b42a1e1e77da71ae7f3ddb..4dc401c59a6f456aaf360d3ef90de6b0174a733c 100644
|
| --- a/src/ports/SkFontHost_FreeType.cpp
|
| +++ b/src/ports/SkFontHost_FreeType.cpp
|
| @@ -432,16 +432,6 @@ static bool GetLetterCBox(FT_Face face, char letter, FT_BBox* bbox) {
|
| return true;
|
| }
|
|
|
| -static bool getWidthAdvance(FT_Face face, int gId, int16_t* data) {
|
| - FT_Fixed advance = 0;
|
| - if (FT_Get_Advances(face, gId, 1, FT_LOAD_NO_SCALE, &advance)) {
|
| - return false;
|
| - }
|
| - SkASSERT(data);
|
| - *data = advance;
|
| - return true;
|
| -}
|
| -
|
| static void populate_glyph_to_unicode(FT_Face& face, SkTDArray<SkUnichar>* glyphToUnicode) {
|
| FT_Long numGlyphs = face->num_glyphs;
|
| glyphToUnicode->setCount(SkToInt(numGlyphs));
|
| @@ -615,8 +605,19 @@ SkAdvancedTypefaceMetrics* SkTypeface_FreeType::onGetAdvancedTypefaceMetrics(
|
| SkAdvancedTypefaceMetrics::WidthRange::kRange);
|
| info->fGlyphWidths.emplace_back(std::move(range));
|
| } else {
|
| - info->setGlyphWidths(face, face->num_glyphs, glyphIDs,
|
| - glyphIDsCount, &getWidthAdvance);
|
| + info->setGlyphWidths(
|
| + face->num_glyphs, glyphIDs, glyphIDsCount,
|
| + SkAdvancedTypefaceMetrics::GetAdvance(
|
| + [face](int gId, int16_t* data) {
|
| + FT_Fixed advance = 0;
|
| + if (FT_Get_Advances(face, gId, 1,
|
| + FT_LOAD_NO_SCALE, &advance)) {
|
| + return false;
|
| + }
|
| + SkASSERT(data);
|
| + *data = advance;
|
| + return true;
|
| + }));
|
| }
|
| }
|
|
|
|
|