Only scale fallback font if it is too big
If the drawing is rotate, then it won't be handled by the device fallback case. So, the source glyphs can fit in the atlas with out scaling, so don't scale. Previously, the system would put the largest possible glyph in the cache, and scale it down. Change-Id: If4261854100d4736702d192e4f0847014c55f1c5 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250796 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
parent
24a409611f
commit
a7f3157ac0
@ -57,10 +57,12 @@ SkStrikeSpec SkStrikeSpec::MakeSourceFallback(
|
||||
SkScalar maxAtlasDimension = SkStrikeCommon::kSkSideTooBigForAtlas - 2;
|
||||
|
||||
SkScalar runFontTextSize = font.getSize();
|
||||
|
||||
// Scale the text size down so the long side of all the glyphs will fit in the atlas.
|
||||
SkScalar fallbackTextSize = SkScalarFloorToScalar(
|
||||
(maxAtlasDimension / maxSourceGlyphDimension) * runFontTextSize);
|
||||
SkScalar fallbackTextSize = runFontTextSize;
|
||||
if (maxSourceGlyphDimension > maxAtlasDimension) {
|
||||
// Scale the text size down so the long side of all the glyphs will fit in the atlas.
|
||||
fallbackTextSize = SkScalarFloorToScalar(
|
||||
(maxAtlasDimension / maxSourceGlyphDimension) * runFontTextSize);
|
||||
}
|
||||
|
||||
SkFont fallbackFont{font};
|
||||
fallbackFont.setSize(fallbackTextSize);
|
||||
|
Loading…
Reference in New Issue
Block a user