Don't use fonts with many glyphs in fontmgr_bounds.

BUG=skia:6878

Change-Id: I015dff1bafc9433ce155eb1173c42d0eed6ae005
Reviewed-on: https://skia-review.googlesource.com/26202
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
Ben Wagner 2017-07-24 11:04:21 -04:00 committed by Skia Commit-Bot
parent fd51b2ba45
commit 2112df028c

View File

@ -313,7 +313,9 @@ protected:
sk_sp<SkFontStyleSet> set(fm->createStyleSet(i)); sk_sp<SkFontStyleSet> set(fm->createStyleSet(i));
for (int j = 0; j < set->count() && j < 3; ++j) { for (int j = 0; j < set->count() && j < 3; ++j) {
paint.setTypeface(sk_sp<SkTypeface>(set->createTypeface(j))); paint.setTypeface(sk_sp<SkTypeface>(set->createTypeface(j)));
if (paint.getTypeface()) { // Fonts with lots of glyphs are interesting, but can take a long time to find
// the glyphs which make up the maximum extent.
if (paint.getTypeface() && paint.getTypeface()->countGlyphs() < 1000) {
SkRect fontBounds = paint.getFontBounds(); SkRect fontBounds = paint.getFontBounds();
x -= fontBounds.fLeft; x -= fontBounds.fLeft;
show_bounds(canvas, paint, x, y, boundsColors[index & 1]); show_bounds(canvas, paint, x, y, boundsColors[index & 1]);