[PATCH 3/3] gdi32: Fix text metrics in synthetic bold bitmap fonts. (rebased)

Huw Davies huw at codeweavers.com
Tue Feb 13 10:25:22 CST 2018


On Tue, Feb 13, 2018 at 10:40:14PM +0900, Akihiro Sagawa wrote:
> On Mon, 12 Feb 2018 09:27:06 +0000, Huw Davies wrote:
> > On Sun, Feb 11, 2018 at 10:27:56PM +0900, Akihiro Sagawa wrote:
> > > @@ -7552,10 +7555,12 @@ static void scale_font_metrics(const GdiFont *font, LPTEXTMETRICW ptm)
> > >      SCALE_Y(ptm->tmDescent);
> > >      SCALE_Y(ptm->tmInternalLeading);
> > >      SCALE_Y(ptm->tmExternalLeading);
> > > -    SCALE_Y(ptm->tmOverhang);
> > >  
> > > -    if(FT_IS_SCALABLE(font->ft_face) && font->fake_bold)
> > > +    SCALE_X(ptm->tmOverhang);
> > > +    if(font->fake_bold)
> > >      {
> > > +        if(!FT_IS_SCALABLE(font->ft_face))
> > > +            ptm->tmOverhang += fabs(font->font_desc.matrix.eM11);
> > >          ptm->tmAveCharWidth++;
> > >          ptm->tmMaxCharWidth++;
> > >      }
> > 
> > It looks odd to me that tmOverHang gets incremented by essentially the
> > scaling factor, yet the widths only get incremented by one.  Shouldn't
> > these all be consistent?
> 
> Indeed, this looks odd. However, following my test shows tmOverhang is
> incremented only 1 (in MM_TEXT mode) neverthless scaling factor.
> | +        ok(data[i+1].tm.tmOverhang == 1,
> | +           "expected 1, got %d\n", data[i+1].tm.tmOverhang);
> If tmOverhang would be affected by scalling factor, this test wouldn't
> pass when data[3].tm.tmOverhang is evaluated.
> 
> Moreover, my manual test shows if height == 200, the tmOverhang value is
> still only 1 with Courier font.

If I change:
    ptm->tmOverhang += fabs(font->font_desc.matrix.eM11);
to:
    ptm->tmOverhang++;

the tests still pass.

Huw.



More information about the wine-devel mailing list