gdi32: Try to update the default families with fonts that exist.
Based on a patch by Akihiro Sagawa. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46285 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46244 Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3b8fde3f08
commit
f59755755e
|
@ -482,10 +482,6 @@ static inline struct freetype_physdev *get_freetype_dev( PHYSDEV dev )
|
||||||
|
|
||||||
static const struct gdi_dc_funcs freetype_funcs;
|
static const struct gdi_dc_funcs freetype_funcs;
|
||||||
|
|
||||||
static const WCHAR defSerif[] = {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n','\0'};
|
|
||||||
static const WCHAR defSans[] = {'A','r','i','a','l','\0'};
|
|
||||||
static const WCHAR defFixed[] = {'C','o','u','r','i','e','r',' ','N','e','w','\0'};
|
|
||||||
|
|
||||||
static const WCHAR fontsW[] = {'\\','f','o','n','t','s','\0'};
|
static const WCHAR fontsW[] = {'\\','f','o','n','t','s','\0'};
|
||||||
static const WCHAR win9x_font_reg_key[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
|
static const WCHAR win9x_font_reg_key[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
|
||||||
'W','i','n','d','o','w','s','\\',
|
'W','i','n','d','o','w','s','\\',
|
||||||
|
@ -557,6 +553,10 @@ static const WCHAR *default_sans_list[] =
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const WCHAR *default_serif = times_new_roman;
|
||||||
|
static const WCHAR *default_fixed = courier_new;
|
||||||
|
static const WCHAR *default_sans = arial;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WCHAR *name;
|
WCHAR *name;
|
||||||
INT charset;
|
INT charset;
|
||||||
|
@ -4341,22 +4341,24 @@ static BOOL move_to_front(const WCHAR *name)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL set_default(const WCHAR **name_list)
|
static const WCHAR *set_default(const WCHAR **name_list)
|
||||||
{
|
{
|
||||||
while (*name_list)
|
const WCHAR **entry = name_list;
|
||||||
|
|
||||||
|
while (*entry)
|
||||||
{
|
{
|
||||||
if (move_to_front(*name_list)) return TRUE;
|
if (move_to_front(*entry)) return *entry;
|
||||||
name_list++;
|
entry++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return *name_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reorder_font_list(void)
|
static void reorder_font_list(void)
|
||||||
{
|
{
|
||||||
set_default( default_serif_list );
|
default_serif = set_default( default_serif_list );
|
||||||
set_default( default_fixed_list );
|
default_fixed = set_default( default_fixed_list );
|
||||||
set_default( default_sans_list );
|
default_sans = set_default( default_sans_list );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
|
@ -5649,13 +5651,13 @@ static HFONT freetype_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags )
|
||||||
|
|
||||||
if((lf.lfPitchAndFamily & FIXED_PITCH) ||
|
if((lf.lfPitchAndFamily & FIXED_PITCH) ||
|
||||||
(lf.lfPitchAndFamily & 0xF0) == FF_MODERN)
|
(lf.lfPitchAndFamily & 0xF0) == FF_MODERN)
|
||||||
strcpyW(lf.lfFaceName, defFixed);
|
strcpyW(lf.lfFaceName, default_fixed);
|
||||||
else if((lf.lfPitchAndFamily & 0xF0) == FF_ROMAN)
|
else if((lf.lfPitchAndFamily & 0xF0) == FF_ROMAN)
|
||||||
strcpyW(lf.lfFaceName, defSerif);
|
strcpyW(lf.lfFaceName, default_serif);
|
||||||
else if((lf.lfPitchAndFamily & 0xF0) == FF_SWISS)
|
else if((lf.lfPitchAndFamily & 0xF0) == FF_SWISS)
|
||||||
strcpyW(lf.lfFaceName, defSans);
|
strcpyW(lf.lfFaceName, default_sans);
|
||||||
else
|
else
|
||||||
strcpyW(lf.lfFaceName, defSans);
|
strcpyW(lf.lfFaceName, default_sans);
|
||||||
LIST_FOR_EACH_ENTRY( family, &font_list, Family, entry ) {
|
LIST_FOR_EACH_ENTRY( family, &font_list, Family, entry ) {
|
||||||
if(!strncmpiW(family->FamilyName, lf.lfFaceName, LF_FACESIZE - 1)) {
|
if(!strncmpiW(family->FamilyName, lf.lfFaceName, LF_FACESIZE - 1)) {
|
||||||
font_link = find_font_link(family->FamilyName);
|
font_link = find_font_link(family->FamilyName);
|
||||||
|
|
Loading…
Reference in New Issue