Module: wine Branch: master Commit: f6475ace5fc812749beefc8fc17add8c4281bc5f URL: http://source.winehq.org/git/wine.git/?a=commit;h=f6475ace5fc812749beefc8fc1...
Author: Akihiro Sagawa sagawa.aki@gmail.com Date: Fri Jan 10 20:30:01 2014 +0900
gdi32: Improve vertical writing metrics.
---
dlls/gdi32/freetype.c | 44 ++++++++++++++------------------------------ dlls/gdi32/tests/font.c | 2 -- 2 files changed, 14 insertions(+), 32 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 3cc8dd8..722a211 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -6443,6 +6443,7 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, } else { INT xc, yc; FT_Vector vec; + FT_Pos lsb;
left = right = 0;
@@ -6468,41 +6469,24 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, bottom = bottom & -64; top = (top + 63) & -64;
- if (tategaki) + if (tategaki && (font->potm || get_outline_text_metrics(font))) { - for(xc = 0; xc < 2; xc++) - { - for(yc = 0; yc < 2; yc++) - { - if (vertical_metrics) - { - vec.x = metrics.vertBearingY + xc * metrics.height; - vec.y = metrics.horiBearingX - yc * (metrics.vertBearingX * 2); - } - else - { - vec.x = metrics.horiBearingY - xc * metrics.height; - vec.y = metrics.horiBearingX + yc * metrics.width; - } - - TRACE ("Vec %ld,%ld\n", vec.x>>6, vec.y>>6); - pFT_Vector_Transform(&vec, &transMat); - if(xc == 0 && yc == 0) { - origin_x = vec.x; - origin_y = vec.y; - } else { - if(vec.x < origin_x) origin_x = vec.x; - if(vec.y > origin_y) origin_y = vec.y; - } - } - } - origin_x = origin_x & -64; - origin_y = (origin_y + 63) & -64; + 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 + left) & -64; + origin_y = (vec.y + top + 63) & -64; } else { origin_x = left; origin_y = top; + lsb = metrics.horiBearingX; }
TRACE("transformed box: (%d,%d - %d,%d)\n", left, top, right, bottom); @@ -6537,7 +6521,7 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, adv = pFT_MulFix(vec.x, em_scale) * 2; }
- vec.x = metrics.horiBearingX; + vec.x = lsb; vec.y = 0; pFT_Vector_Transform(&vec, &transMatUnrotated); abc->abcA = vec.x >> 6; diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index bea7f28..7e93f9d 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -5294,13 +5294,11 @@ static void check_vertical_metrics(const char *face) } else { - todo_wine ok(vgm.gmptGlyphOrigin.x == rgm.gmptGlyphOrigin.x + vgm.gmCellIncX + otm.otmDescent, "got %d, expected rgm.origin.x(%d) + vgm.cellIncX(%d) + descent(%d)\n", vgm.gmptGlyphOrigin.x, rgm.gmptGlyphOrigin.x, vgm.gmCellIncX, otm.otmDescent); }
- todo_wine ok(vgm.gmptGlyphOrigin.y == abc.abcA + abc.abcB + otm.otmDescent, "got %d, expected abcA(%d) + abcB(%u) + descent(%d)\n", (INT)vgm.gmptGlyphOrigin.y, abc.abcA, abc.abcB, otm.otmDescent);