[PATCH 10/12] gdi32: Do not compute the abc{A, B} at the tategaki glyph when the orientation is zero.

Byeongsik Jeon bsjeon at hanmail.net
Tue Jan 29 03:12:34 CST 2019


Signed-off-by: Byeongsik Jeon <bsjeon at hanmail.net>
---
The problem with the tategaki glyph is also an issue like [PATCH 9].


 dlls/gdi32/freetype.c   | 49 +++++++++++++++++++----------------------
 dlls/gdi32/tests/font.c |  2 --
 2 files changed, 23 insertions(+), 28 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 96e414c5d6..8c5eb11e66 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -6893,8 +6893,30 @@ static void compute_gm_abc_metrics( GdiFont *incoming_font, GdiFont *font,
                                     GLYPHMETRICS *gm, ABC *abc )
 {
     FT_Vector adv, vec, origin;
+    FT_Pos lsb;
 
-    if (!memcmp( transMat, transMatUnrotated, sizeof(FT_Matrix) ) && !tategaki )
+    if (tategaki && (font->potm || get_outline_text_metrics( font )))
+    {
+        if (vertical_metrics)
+            lsb = metrics->horiBearingY + metrics->vertBearingY;
+        else
+            lsb = metrics->vertAdvance + (font->potm->otmDescent << 6);
+        vec.x = lsb;
+        vec.y = font->potm->otmDescent << 6;
+        TRACE( "Vec %ld,%ld\n", vec.x >> 6, vec.y >> 6 );
+        pFT_Vector_Transform( &vec, transMat );
+        origin.x = (vec.x + bbox.xMin) & -64;
+        origin.y = (vec.y + bbox.yMax + 63) & -64;
+        lsb -= metrics->horiBearingY;
+    }
+    else
+    {
+        origin.x = bbox.xMin;
+        origin.y = bbox.yMax;
+        lsb = metrics->horiBearingX;
+    }
+
+    if (!memcmp( transMat, transMatUnrotated, sizeof(FT_Matrix) ))
     {
         if (!needsTransform)
         {
@@ -6909,36 +6931,11 @@ static void compute_gm_abc_metrics( GdiFont *incoming_font, GdiFont *font,
             gm->gmCellIncY = adv.y >> 6;
         }
 
-        origin.x = bbox.xMin;
-        origin.y = bbox.yMax;
         abc->abcA = origin.x >> 6;
         abc->abcB = (bbox.xMax - bbox.xMin) >> 6;
     }
     else
     {
-        FT_Pos lsb;
-
-        if (tategaki && (font->potm || get_outline_text_metrics( font )))
-        {
-            if (vertical_metrics)
-                lsb = metrics->horiBearingY + metrics->vertBearingY;
-            else
-                lsb = metrics->vertAdvance + (font->potm->otmDescent << 6);
-            vec.x = lsb;
-            vec.y = font->potm->otmDescent << 6;
-            TRACE( "Vec %ld,%ld\n", vec.x>>6, vec.y>>6 );
-            pFT_Vector_Transform( &vec, transMat );
-            origin.x = (vec.x + bbox.xMin) & -64;
-            origin.y = (vec.y + bbox.yMax + 63) & -64;
-            lsb -= metrics->horiBearingY;
-        }
-        else
-        {
-            origin.x = bbox.xMin;
-            origin.y = bbox.yMax;
-            lsb = metrics->horiBearingX;
-        }
-
         adv = get_advance_metric( incoming_font, font, metrics, transMat, vertical_metrics );
         gm->gmCellIncX = adv.x >> 6;
         gm->gmCellIncY = adv.y >> 6;
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 88b19c0482..72957688de 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -6137,10 +6137,8 @@ static void check_vertical_metrics(const char *face)
     ok(ret != GDI_ERROR, "GetGlyphOutlineW failed\n");
     ret = GetCharABCWidthsW(hdc, code, code, &vabc);
     ok(ret, "GetCharABCWidthsW failed\n");
-    todo_wine
     ok(vabc.abcA == vgm.gmptGlyphOrigin.x, "expected %d, got %d\n",
        vabc.abcA, vgm.gmptGlyphOrigin.x);
-    todo_wine
     ok(vabc.abcB == vgm.gmBlackBoxX, "expected %d, got %d\n",
        vabc.abcB, vgm.gmBlackBoxX);
     ok(vabc.abcA + vabc.abcB + vabc.abcC == vgm.gmCellIncX,
-- 
2.20.1




More information about the wine-devel mailing list