[Impeller] use smaller SkFont size for determining glyph bounds. (flutter/engine#52868)

Applies the fix that @jason-simmons  previously suggested in https://github.com/flutter/flutter/issues/128624#issuecomment-1846473830 

I'm not sure if these results are better or not ... but I think we try and make this change to see if things are improved anyway? Leaving up golden diffs for others to look at.
This commit is contained in:
Jonah Williams
2024-05-16 15:55:19 -07:00
committed by GitHub
parent e1b5e2c1d2
commit 20ea92ce6f

View File

@@ -36,7 +36,7 @@ static Rect ToRect(const SkRect& rect) {
return Rect::MakeLTRB(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
}
static constexpr Scalar kScaleSize = 100000.0f;
static constexpr Scalar kScaleSize = 64.0f;
std::shared_ptr<TextFrame> MakeTextFrameFromTextBlobSkia(
const sk_sp<SkTextBlob>& blob) {
@@ -59,7 +59,8 @@ std::shared_ptr<TextFrame> MakeTextFrameFromTextBlobSkia(
// For some platforms (including Android), `SkFont::getBounds()` snaps
// the computed bounds to integers. And so we scale up the font size
// prior to fetching the bounds to ensure that the returned bounds are
// always precise enough.
// always precise enough. Scaling too large will cause Skia to use
// path rendering and potentially inaccurate glyph sizes.
font.setSize(kScaleSize);
font.getBounds(glyphs, glyph_count, glyph_bounds.data(), nullptr);