If the glyph does not rotate, you do not have to recalculate abcA, abcB. In particular, the added subpixel metrics becomes a problem.
Signed-off-by: Byeongsik Jeon bsjeon@hanmail.net --- dlls/gdi32/freetype.c | 25 ++++++++++++++++--------- dlls/gdi32/tests/font.c | 2 -- 2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 02f7455619..96e414c5d6 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -6894,15 +6894,25 @@ static void compute_gm_abc_metrics( GdiFont *incoming_font, GdiFont *font, { FT_Vector adv, vec, origin;
- if (!needsTransform) + if (!memcmp( transMat, transMatUnrotated, sizeof(FT_Matrix) ) && !tategaki ) { - adv = get_advance_metric( incoming_font, font, metrics, NULL, vertical_metrics ); - gm->gmCellIncX = adv.x >> 6; - gm->gmCellIncY = 0; + if (!needsTransform) + { + adv = get_advance_metric( incoming_font, font, metrics, NULL, vertical_metrics ); + gm->gmCellIncX = adv.x >> 6; + gm->gmCellIncY = 0; + } + else + { + adv = get_advance_metric( incoming_font, font, metrics, transMat, vertical_metrics ); + gm->gmCellIncX = adv.x >> 6; + gm->gmCellIncY = adv.y >> 6; + } + origin.x = bbox.xMin; origin.y = bbox.yMax; abc->abcA = origin.x >> 6; - abc->abcB = (metrics->width + 63) >> 6; + abc->abcB = (bbox.xMax - bbox.xMin) >> 6; } else { @@ -6934,8 +6944,6 @@ static void compute_gm_abc_metrics( GdiFont *incoming_font, GdiFont *font, gm->gmCellIncY = adv.y >> 6;
adv = get_advance_metric( incoming_font, font, metrics, transMatUnrotated, vertical_metrics ); - adv.x = pFT_Vector_Length( &adv ); - adv.y = 0;
vec.x = lsb; vec.y = 0; @@ -6949,9 +6957,8 @@ static void compute_gm_abc_metrics( GdiFont *incoming_font, GdiFont *font, pFT_Vector_Transform( &vec, transMatUnrotated ); abc->abcB = ((pFT_Vector_Length( &vec ) + 63) >> 6) - abc->abcA; } - if (!abc->abcB) abc->abcB = 1; - abc->abcC = (adv.x >> 6) - abc->abcA - abc->abcB; + abc->abcC = (pFT_Vector_Length( &adv ) >> 6) - abc->abcA - abc->abcB;
gm->gmptGlyphOrigin.x = origin.x >> 6; gm->gmptGlyphOrigin.y = origin.y >> 6; diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index f8762eca56..88b19c0482 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -1385,11 +1385,9 @@ static void test_GetCharABCWidths(void) ret = GetCharABCWidthsA(hdc, code, code, abc); ok(ret, "GetCharABCWidthsA should have succeeded at width %d\n", i);
- todo_wine ok(abc[0].abcA == gm.gmptGlyphOrigin.x, "abcA(%d) and gmptGlyphOrigin.x(%d) values are different at width %d\n", abc[0].abcA, gm.gmptGlyphOrigin.x, i); - todo_wine ok(abc[0].abcB == gm.gmBlackBoxX, "abcB(%d) and gmBlackBoxX(%d) values are different at width %d\n", abc[0].abcB, gm.gmBlackBoxX, i);