From b4fad178c792687c50683880bcfaf507d54b30ca Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Tue, 17 Jul 2012 15:36:33 -0700 Subject: Accurately calculate advances in general case. Fixes bug 6833339. The advance values computed by generateAdvance() were inconsistent with those computed by generateMetrics, because the fMatrix22 was being applied in the latter but not former case. Since fMatrix22.xx is 1.0 almost all the time (the exception is only when skew and scale are both applied), failures were rare. This patch is an alternative to ag/#/c/207887, in that they both fix the problem, but in different ways. That patch made fMatrix22.xx equal to 1.0 in almost all cases, while this one gives correct advance values for arbitrary fMatrix22 values. Change-Id: Iedfa36e884e3e3e2f078a5d4edfc82004a54e895 --- src/ports/SkFontHost_FreeType.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index 621c94a..da00d51 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -951,8 +951,8 @@ void SkScalerContext_FreeType::generateAdvance(SkGlyph* glyph) { if (0 == error) { glyph->fRsbDelta = 0; glyph->fLsbDelta = 0; - glyph->fAdvanceX = advance; // advance *2/3; //DEBUG - glyph->fAdvanceY = 0; + glyph->fAdvanceX = SkFixedMul(fMatrix22.xx, advance); // advance *2/3; //DEBUG + glyph->fAdvanceY = -SkFixedMul(fMatrix22.yx, advance); return; } } -- cgit v1.1