gdi32: EnumFontFamilies should enumerate substituted fonts only when directly asked for.
This commit is contained in:
parent
5289c9fd92
commit
50b6b376cb
|
@ -5774,7 +5774,7 @@ static BOOL face_matches(const WCHAR *family_name, Face *face, const WCHAR *face
|
|||
}
|
||||
|
||||
static BOOL enum_face_charsets(const Family *family, Face *face, struct enum_charset_list *list,
|
||||
FONTENUMPROCW proc, LPARAM lparam)
|
||||
FONTENUMPROCW proc, LPARAM lparam, const WCHAR *subst)
|
||||
{
|
||||
ENUMLOGFONTEXW elf;
|
||||
NEWTEXTMETRICEXW ntm;
|
||||
|
@ -5808,6 +5808,8 @@ static BOOL enum_face_charsets(const Family *family, Face *face, struct enum_cha
|
|||
else
|
||||
strcpyW(elf.elfFullName, family->FamilyName);
|
||||
}
|
||||
if (subst)
|
||||
strcpyW(elf.elfLogFont.lfFaceName, subst);
|
||||
TRACE("enuming face %s full %s style %s charset = %d type %d script %s it %d weight %d ntmflags %08x\n",
|
||||
debugstr_w(elf.elfLogFont.lfFaceName),
|
||||
debugstr_w(elf.elfFullName), debugstr_w(elf.elfStyle),
|
||||
|
@ -5862,14 +5864,14 @@ static BOOL freetype_EnumFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW proc,
|
|||
face_list = get_face_list_from_family(family);
|
||||
LIST_FOR_EACH_ENTRY( face, face_list, Face, entry ) {
|
||||
if (!face_matches(family->FamilyName, face, face_name)) continue;
|
||||
if (!enum_face_charsets(family, face, &enum_charsets, proc, lparam)) return FALSE;
|
||||
if (!enum_face_charsets(family, face, &enum_charsets, proc, lparam, psub ? psub->from.name : NULL)) return FALSE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LIST_FOR_EACH_ENTRY( family, &font_list, Family, entry ) {
|
||||
face_list = get_face_list_from_family(family);
|
||||
face = LIST_ENTRY(list_head(face_list), Face, entry);
|
||||
if (!enum_face_charsets(family, face, &enum_charsets, proc, lparam)) return FALSE;
|
||||
if (!enum_face_charsets(family, face, &enum_charsets, proc, lparam, NULL)) return FALSE;
|
||||
}
|
||||
}
|
||||
LeaveCriticalSection( &freetype_cs );
|
||||
|
|
|
@ -5051,12 +5051,9 @@ static void test_EnumFonts_subst(void)
|
|||
memset(&efnd, 0, sizeof(efnd));
|
||||
strcpy(lf.lfFaceName, "MS Shell Dlg");
|
||||
ret = EnumFontFamiliesExA(hdc, &lf, enum_ms_shell_dlg_proc, (LPARAM)&efnd, 0);
|
||||
todo_wine
|
||||
ok(!ret, "MS Shell Dlg should be enumerated\n");
|
||||
todo_wine
|
||||
ok(efnd.total > 0, "MS Shell Dlg should be enumerated\n");
|
||||
ret = strcmp((const char *)efnd.elf[0].elfLogFont.lfFaceName, "MS Shell Dlg");
|
||||
todo_wine
|
||||
ok(!ret, "expected MS Shell Dlg, got %s\n", efnd.elf[0].elfLogFont.lfFaceName);
|
||||
ret = strcmp((const char *)efnd.elf[0].elfFullName, "MS Shell Dlg");
|
||||
ok(ret, "did not expect MS Shell Dlg\n");
|
||||
|
@ -5069,12 +5066,9 @@ todo_wine
|
|||
memset(&efnd, 0, sizeof(efnd));
|
||||
strcpy(lf.lfFaceName, "MS Shell Dlg 2");
|
||||
ret = EnumFontFamiliesExA(hdc, &lf, enum_ms_shell_dlg2_proc, (LPARAM)&efnd, 0);
|
||||
todo_wine
|
||||
ok(!ret, "MS Shell Dlg 2 should be enumerated\n");
|
||||
todo_wine
|
||||
ok(efnd.total > 0, "MS Shell Dlg 2 should be enumerated\n");
|
||||
ret = strcmp((const char *)efnd.elf[0].elfLogFont.lfFaceName, "MS Shell Dlg 2");
|
||||
todo_wine
|
||||
ok(!ret, "expected MS Shell Dlg 2, got %s\n", efnd.elf[0].elfLogFont.lfFaceName);
|
||||
ret = strcmp((const char *)efnd.elf[0].elfFullName, "MS Shell Dlg 2");
|
||||
ok(ret, "did not expect MS Shell Dlg 2\n");
|
||||
|
|
|
@ -630,11 +630,15 @@ GpStatus WINGDIPAPI GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi,
|
|||
static INT CALLBACK is_font_installed_proc(const LOGFONTW *elf,
|
||||
const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
|
||||
{
|
||||
const ENUMLOGFONTW *elfW = (const ENUMLOGFONTW *)elf;
|
||||
LOGFONTW *lf = (LOGFONTW *)lParam;
|
||||
|
||||
if (type & RASTER_FONTTYPE)
|
||||
return 1;
|
||||
|
||||
*(LOGFONTW *)lParam = *elf;
|
||||
|
||||
*lf = *elf;
|
||||
/* replace substituted font name by a real one */
|
||||
lstrcpynW(lf->lfFaceName, elfW->elfFullName, LF_FACESIZE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -656,8 +660,6 @@ static BOOL get_font_metrics(HDC hdc, struct font_metrics *fm)
|
|||
otm.otmSize = sizeof(otm);
|
||||
if (!GetOutlineTextMetricsW(hdc, otm.otmSize, &otm)) return FALSE;
|
||||
|
||||
GetTextFaceW(hdc, LF_FACESIZE, fm->facename);
|
||||
|
||||
fm->em_height = otm.otmEMSquare;
|
||||
fm->dpi = GetDeviceCaps(hdc, LOGPIXELSY);
|
||||
|
||||
|
@ -706,6 +708,8 @@ static GpStatus find_installed_font(const WCHAR *name, struct font_metrics *fm)
|
|||
{
|
||||
HFONT hfont, old_font;
|
||||
|
||||
strcpyW(fm->facename, lf.lfFaceName);
|
||||
|
||||
hfont = CreateFontIndirectW(&lf);
|
||||
old_font = SelectObject(hdc, hfont);
|
||||
ret = get_font_metrics(hdc, fm) ? Ok : NotTrueTypeFont;
|
||||
|
|
Loading…
Reference in New Issue