Commit 645451c6 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Drop flags during font enumeration for font chooser if we get no

matches.
parent 86ee3dd6
...@@ -352,12 +352,19 @@ static BOOL CFn_HookCallChk32(LPCHOOSEFONTA lpcf) ...@@ -352,12 +352,19 @@ static BOOL CFn_HookCallChk32(LPCHOOSEFONTA lpcf)
return FALSE; return FALSE;
} }
typedef struct
{
HWND hWnd1;
HWND hWnd2;
LPCHOOSEFONTA lpcf32a;
int added;
} CFn_ENUMSTRUCT, *LPCFn_ENUMSTRUCT;
/************************************************************************* /*************************************************************************
* AddFontFamily [internal] * AddFontFamily [internal]
*/ */
static INT AddFontFamily(const LOGFONTA *lplf, UINT nFontType, static INT AddFontFamily(const LOGFONTA *lplf, UINT nFontType,
LPCHOOSEFONTA lpcf, HWND hwnd) LPCHOOSEFONTA lpcf, HWND hwnd, LPCFn_ENUMSTRUCT e)
{ {
int i; int i;
WORD w; WORD w;
...@@ -374,6 +381,8 @@ static INT AddFontFamily(const LOGFONTA *lplf, UINT nFontType, ...@@ -374,6 +381,8 @@ static INT AddFontFamily(const LOGFONTA *lplf, UINT nFontType,
if (!(nFontType & TRUETYPE_FONTTYPE)) if (!(nFontType & TRUETYPE_FONTTYPE))
return 1; return 1;
if (e) e->added++;
i=SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)lplf->lfFaceName); i=SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)lplf->lfFaceName);
if (i!=CB_ERR) if (i!=CB_ERR)
{ {
...@@ -385,13 +394,6 @@ static INT AddFontFamily(const LOGFONTA *lplf, UINT nFontType, ...@@ -385,13 +394,6 @@ static INT AddFontFamily(const LOGFONTA *lplf, UINT nFontType,
return 0; return 0;
} }
typedef struct
{
HWND hWnd1;
HWND hWnd2;
LPCHOOSEFONTA lpcf32a;
} CFn_ENUMSTRUCT, *LPCFn_ENUMSTRUCT;
/************************************************************************* /*************************************************************************
* FontFamilyEnumProc32 [internal] * FontFamilyEnumProc32 [internal]
*/ */
...@@ -400,7 +402,7 @@ static INT WINAPI FontFamilyEnumProc(const LOGFONTA *lpLogFont, ...@@ -400,7 +402,7 @@ static INT WINAPI FontFamilyEnumProc(const LOGFONTA *lpLogFont,
{ {
LPCFn_ENUMSTRUCT e; LPCFn_ENUMSTRUCT e;
e=(LPCFn_ENUMSTRUCT)lParam; e=(LPCFn_ENUMSTRUCT)lParam;
return AddFontFamily(lpLogFont, dwFontType, e->lpcf32a, e->hWnd1); return AddFontFamily(lpLogFont, dwFontType, e->lpcf32a, e->hWnd1, e);
} }
/*********************************************************************** /***********************************************************************
...@@ -416,7 +418,7 @@ INT16 WINAPI FontFamilyEnumProc16( SEGPTR logfont, SEGPTR metrics, ...@@ -416,7 +418,7 @@ INT16 WINAPI FontFamilyEnumProc16( SEGPTR logfont, SEGPTR metrics,
LOGFONTA lf32a; LOGFONTA lf32a;
FONT_LogFont16To32A(lplf, &lf32a); FONT_LogFont16To32A(lplf, &lf32a);
return AddFontFamily(&lf32a, nFontType, (LPCHOOSEFONTA)lpcf->lpTemplateName, return AddFontFamily(&lf32a, nFontType, (LPCHOOSEFONTA)lpcf->lpTemplateName,
hwnd); hwnd,NULL);
} }
/************************************************************************* /*************************************************************************
...@@ -626,8 +628,27 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam, ...@@ -626,8 +628,27 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
CFn_ENUMSTRUCT s; CFn_ENUMSTRUCT s;
s.hWnd1=GetDlgItem(hDlg,cmb1); s.hWnd1=GetDlgItem(hDlg,cmb1);
s.lpcf32a=lpcf; s.lpcf32a=lpcf;
if (!EnumFontFamiliesA(hdc, NULL, FontFamilyEnumProc, (LPARAM)&s)) do {
TRACE("EnumFontFamilies returns 0\n"); s.added = 0;
if (!EnumFontFamiliesA(hdc, NULL, FontFamilyEnumProc, (LPARAM)&s)) {
TRACE("EnumFontFamilies returns 0\n");
break;
}
if (s.added) break;
if (lpcf->Flags & CF_FIXEDPITCHONLY) {
FIXME("No founds found with fixed pitch only, dropping flag.\n");
lpcf->Flags &= ~CF_FIXEDPITCHONLY;
continue;
}
if (lpcf->Flags & CF_TTONLY) {
FIXME("No founds found with truetype only, dropping flag.\n");
lpcf->Flags &= ~CF_TTONLY;
continue;
}
break;
} while (1);
if (lpcf->Flags & CF_INITTOLOGFONTSTRUCT) if (lpcf->Flags & CF_INITTOLOGFONTSTRUCT)
{ {
/* look for fitting font name in combobox1 */ /* look for fitting font name in combobox1 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment