[PATCH 5/6] gdi32: Reuse the bbox value for the abc{A, B} if possible even when the vertical glyph.
Byeongsik Jeon
bsjeon at hanmail.net
Mon Feb 11 02:20:20 CST 2019
Signed-off-by: Byeongsik Jeon <bsjeon at hanmail.net>
---
Another case of [PATCH 4].
dlls/gdi32/freetype.c | 51 +++++++++++++++++++----------------------
dlls/gdi32/tests/font.c | 2 --
2 files changed, 24 insertions(+), 29 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 8abffe121d..375d4bc059 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -6916,9 +6916,30 @@ static void compute_metrics( GdiFont *incoming_font, GdiFont *font,
GLYPHMETRICS *gm, ABC *abc )
{
FT_Vector adv, vec, origin;
+ FT_Pos lsb;
- if (!(font->orientation % 3600) && is_identity_FMAT2( &font->font_desc.matrix ) &&
- !vertical)
+ if (vertical && (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, &matrices[matrix_hori] );
+ 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 (!(font->orientation % 3600) && is_identity_FMAT2( &font->font_desc.matrix ))
{
if (!needs_transform)
{
@@ -6933,36 +6954,12 @@ static void compute_metrics( GdiFont *incoming_font, GdiFont *font,
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 = (bbox.xMax - bbox.xMin) >> 6;
}
else
{
- FT_Pos lsb;
-
- if (vertical && (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, &matrices[matrix_hori] );
- 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, &matrices[matrix_hori],
vertical_metrics );
gm->gmCellIncX = adv.x >> 6;
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index f14e6f80c8..cad99235cc 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -6143,10 +6143,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