gdi32: Improve vertical writing metrics.

This commit is contained in:
Akihiro Sagawa 2014-01-10 20:30:01 +09:00 committed by Alexandre Julliard
parent a221654aae
commit f6475ace5f
2 changed files with 14 additions and 32 deletions

View File

@ -6443,6 +6443,7 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
} else { } else {
INT xc, yc; INT xc, yc;
FT_Vector vec; FT_Vector vec;
FT_Pos lsb;
left = right = 0; left = right = 0;
@ -6468,41 +6469,24 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
bottom = bottom & -64; bottom = bottom & -64;
top = (top + 63) & -64; top = (top + 63) & -64;
if (tategaki) if (tategaki && (font->potm || get_outline_text_metrics(font)))
{ {
for(xc = 0; xc < 2; xc++) if (vertical_metrics)
{ lsb = metrics.horiBearingY + metrics.vertBearingY;
for(yc = 0; yc < 2; yc++) else
{ lsb = metrics.vertAdvance + (font->potm->otmDescent << 6);
if (vertical_metrics) vec.x = lsb;
{ vec.y = font->potm->otmDescent << 6;
vec.x = metrics.vertBearingY + xc * metrics.height; TRACE ("Vec %ld,%ld\n", vec.x>>6, vec.y>>6);
vec.y = metrics.horiBearingX - yc * (metrics.vertBearingX * 2); pFT_Vector_Transform(&vec, &transMat);
} origin_x = (vec.x + left) & -64;
else origin_y = (vec.y + top + 63) & -64;
{
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;
} }
else else
{ {
origin_x = left; origin_x = left;
origin_y = top; origin_y = top;
lsb = metrics.horiBearingX;
} }
TRACE("transformed box: (%d,%d - %d,%d)\n", left, top, right, bottom); 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; adv = pFT_MulFix(vec.x, em_scale) * 2;
} }
vec.x = metrics.horiBearingX; vec.x = lsb;
vec.y = 0; vec.y = 0;
pFT_Vector_Transform(&vec, &transMatUnrotated); pFT_Vector_Transform(&vec, &transMatUnrotated);
abc->abcA = vec.x >> 6; abc->abcA = vec.x >> 6;

View File

@ -5294,13 +5294,11 @@ static void check_vertical_metrics(const char *face)
} }
else else
{ {
todo_wine
ok(vgm.gmptGlyphOrigin.x == rgm.gmptGlyphOrigin.x + vgm.gmCellIncX + otm.otmDescent, ok(vgm.gmptGlyphOrigin.x == rgm.gmptGlyphOrigin.x + vgm.gmCellIncX + otm.otmDescent,
"got %d, expected rgm.origin.x(%d) + vgm.cellIncX(%d) + descent(%d)\n", "got %d, expected rgm.origin.x(%d) + vgm.cellIncX(%d) + descent(%d)\n",
vgm.gmptGlyphOrigin.x, rgm.gmptGlyphOrigin.x, vgm.gmCellIncX, otm.otmDescent); vgm.gmptGlyphOrigin.x, rgm.gmptGlyphOrigin.x, vgm.gmCellIncX, otm.otmDescent);
} }
todo_wine
ok(vgm.gmptGlyphOrigin.y == abc.abcA + abc.abcB + otm.otmDescent, ok(vgm.gmptGlyphOrigin.y == abc.abcA + abc.abcB + otm.otmDescent,
"got %d, expected abcA(%d) + abcB(%u) + descent(%d)\n", "got %d, expected abcA(%d) + abcB(%u) + descent(%d)\n",
(INT)vgm.gmptGlyphOrigin.y, abc.abcA, abc.abcB, otm.otmDescent); (INT)vgm.gmptGlyphOrigin.y, abc.abcA, abc.abcB, otm.otmDescent);