[4/6] gdi32: Fix the advance width in synthetic bold glyphs with scaling.
Huw Davies
huw at codeweavers.com
Mon Jan 4 04:09:21 CST 2016
On Thu, Dec 31, 2015 at 01:33:16PM +0900, Akihiro Sagawa wrote:
> @@ -6955,14 +6972,18 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
> vec.x = metrics.horiAdvance;
> vec.y = 0;
> pFT_Vector_Transform(&vec, &transMat);
> - gm.gmCellIncY = -((vec.y+63) >> 6);
> + if (font->fake_bold)
> + fake_bold_adv = normalize_vector(&vec);
> + else
> + fake_bold_adv.x = fake_bold_adv.y = 0;
> + gm.gmCellIncY = -((vec.y+fake_bold_adv.y+63) >> 6);
> if (!avgAdvance || vec.y)
> - gm.gmCellIncX = (vec.x+63) >> 6;
> + gm.gmCellIncX = (vec.x+fake_bold_adv.x+63) >> 6;
> else {
> vec.x = incoming_font->ntmAvgWidth;
> vec.y = 0;
> pFT_Vector_Transform(&vec, &transMat);
> - gm.gmCellIncX = pFT_MulFix(vec.x, em_scale) * 2;
> + gm.gmCellIncX = pFT_MulFix(vec.x, em_scale) * 2 + (fake_bold_adv.x >> 6);
> }
>
> if (vertical_metrics)
> @@ -6971,13 +6992,15 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
> vec.x = metrics.horiAdvance;
> vec.y = 0;
> pFT_Vector_Transform(&vec, &transMatUnrotated);
> + if (font->fake_bold)
> + fake_bold_adv = normalize_vector(&vec);
> if (!avgAdvance || vec.y)
> - adv = (vec.x+63) >> 6;
> + adv = (vec.x+fake_bold_adv.x+63) >> 6;
> else {
> vec.x = incoming_font->ntmAvgWidth;
> vec.y = 0;
> pFT_Vector_Transform(&vec, &transMatUnrotated);
> - adv = pFT_MulFix(vec.x, em_scale) * 2;
> + adv = pFT_MulFix(vec.x, em_scale) * 2 + (fake_bold_adv.x >> 6);
> }
>
Is it possible to merge these two blocks of very similar code into a
helper or something? I realise that you didn't start this
duplication, but it's become increasingly more complicated.
Huw.
More information about the wine-devel
mailing list