[PATCH] [v2] gdi32: Use the default fallback list before trying Fontconfig.

Akihiro Sagawa sagawa.aki at gmail.com
Thu Dec 20 08:19:42 CST 2018


On Thu, 20 Dec 2018 10:33:27 +0000, Huw Davies wrote:
> On Wed, Dec 19, 2018 at 10:27:10PM +0900, Akihiro Sagawa wrote:
> > On Wed, 19 Dec 2018 08:32:45 +0000, Huw Davies wrote:
> > > On Wed, Dec 19, 2018 at 12:46:19AM +0900, Akihiro Sagawa wrote:
> > > > @@ -5642,25 +5643,41 @@ static HFONT freetype_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags )
> > > >         so mask with 0xF0 before testing */
> > > >  
> > > >      if((lf.lfPitchAndFamily & FIXED_PITCH) ||
> > > > -       (lf.lfPitchAndFamily & 0xF0) == FF_MODERN)
> > > > +       (lf.lfPitchAndFamily & 0xF0) == FF_MODERN) {
> > > >          strcpyW(lf.lfFaceName, defFixed);
> > > > -    else if((lf.lfPitchAndFamily & 0xF0) == FF_ROMAN)
> > > > +        fallback_list = default_fixed_list;
> > > > +    }
> > > > +    else if((lf.lfPitchAndFamily & 0xF0) == FF_ROMAN) {
> > > >          strcpyW(lf.lfFaceName, defSerif);
> > > > -    else if((lf.lfPitchAndFamily & 0xF0) == FF_SWISS)
> > > > +        fallback_list = default_serif_list;
> > > > +    }
> > > > +    else if((lf.lfPitchAndFamily & 0xF0) == FF_SWISS) {
> > > >          strcpyW(lf.lfFaceName, defSans);
> > > > -    else
> > > > +        fallback_list = default_sans_list;
> > > > +    }
> > > > +    else {
> > > >          strcpyW(lf.lfFaceName, defSans);
> > > > -    LIST_FOR_EACH_ENTRY( family, &font_list, Family, entry ) {
> > > > -        if(!strncmpiW(family->FamilyName, lf.lfFaceName, LF_FACESIZE - 1)) {
> > > > -            font_link = find_font_link(family->FamilyName);
> > > > -            face_list = get_face_list_from_family(family);
> > > > -            LIST_FOR_EACH_ENTRY( face, face_list, Face, entry ) {
> > > > -                if (!(face->scalable || can_use_bitmap))
> > > > -                    continue;
> > > > -                if (csi.fs.fsCsb[0] & face->fs.fsCsb[0])
> > > > -                    goto found;
> > > > -                if (font_link != NULL && csi.fs.fsCsb[0] & font_link->fs.fsCsb[0])
> > > > -                    goto found;
> > > > +        fallback_list = default_sans_list;
> > > > +    }
> > > > +
> > > > +    for (; *fallback_list; fallback_list++) {
> > > 
> > > Sorry, I wasn't clear, I meant why do you need to loop through the
> > > fallback_list?   Can you explain the problem you're trying to fix.
> > 
> > Yes, the aim of the loop is finding out an alternative font before
> > trying Fontconfig. If we have not Arial but Liberation Sans, we should
> > use the font despite Fontconfig.
> > 
> > After my Fontconfig patch 11ab9ff7b3c43bb41c0325fe9417b1d7f44ad516,
> > wine tries to use Fontconfig to get more properly font. However,
> > although depending on the configuration, Fontconfig's best font might
> > not be metrically compatible with the original one.
> > 
> > For instance, there are two Sans-serif fonts, Liberation Sans and DejaVu
> > Sans, i.e. Arial isn't installed. In this context, an application
> > requests Arial font family:
> > Before my patch, "Liberation Sans" is at the top of the font list, so
> > Liberation Sans is used instead of Arial.
> > After my patch, it asks Fontconfig and get DejaVu Sans as the best font
> > and uses it regardless of the font list.
> 
> Ok, I've sent something in that should achieve this is a rather
> different way.

Looks so nice.
Thanks, Huw.

Akihiro Sagawa




More information about the wine-devel mailing list