> These strings never get freed (and please use HeapAlloc instead of > malloc). Also the length arguments are wrong, you can't use strlen() > to determine the size of the Unicode string. There are similar > problems at other places in your patch too. Sory for that. I've fixed this bugs. Changelog: Changed Font Dialog to use wide chars in internal functions. Index: dlls/commdlg/fontdlg16.c =================================================================== RCS file: /home/wine/wine/dlls/commdlg/fontdlg16.c,v retrieving revision 1.11 diff -u -r1.11 fontdlg16.c --- dlls/commdlg/fontdlg16.c 12 Feb 2004 00:35:02 -0000 1.11 +++ dlls/commdlg/fontdlg16.c 19 Aug 2004 22:56:34 -0000 @@ -41,7 +41,7 @@ #include "cdlg.h" #include "cdlg16.h" -static void FONT_LogFont16To32A( const LPLOGFONT16 font16, LPLOGFONTA font32 ) +static void FONT_LogFont16To32W( const LPLOGFONT16 font16, LPLOGFONTW font32 ) { font32->lfHeight = font16->lfHeight; font32->lfWidth = font16->lfWidth; @@ -56,36 +56,51 @@ font32->lfClipPrecision = font16->lfClipPrecision; font32->lfQuality = font16->lfQuality; font32->lfPitchAndFamily = font16->lfPitchAndFamily; - lstrcpynA( font32->lfFaceName, font16->lfFaceName, LF_FACESIZE ); -}; + MultiByteToWideChar(CP_ACP, 0, font16->lfFaceName, + LF_FACESIZE, font32->lfFaceName, LF_FACESIZE); +} -static void FONT_Metrics16To32A( const TEXTMETRIC16 *pm16, - NEWTEXTMETRICEXA *pnm32a) +static void FONT_Metrics16To32W( const TEXTMETRIC16 *pm16, + NEWTEXTMETRICEXW *pnm32w) { - ZeroMemory( pnm32a, sizeof(NEWTEXTMETRICEXA)); + ZeroMemory( pnm32w, sizeof(NEWTEXTMETRICEXW)); /* NOTE: only the fields used by AddFontStyle() are filled in */ - pnm32a->ntmTm.tmHeight = pm16->tmHeight; - pnm32a->ntmTm.tmExternalLeading = pm16->tmExternalLeading; -}; + pnm32w->ntmTm.tmHeight = pm16->tmHeight; + pnm32w->ntmTm.tmExternalLeading = pm16->tmExternalLeading; +} -static void CFn_CHOOSEFONT16to32A(LPCHOOSEFONT16 chf16, LPCHOOSEFONTA chf32a) +static void CFn_CHOOSEFONT16to32W(LPCHOOSEFONT16 chf16, LPCHOOSEFONTW chf32w) { - chf32a->lStructSize=sizeof(CHOOSEFONTA); - chf32a->hwndOwner=HWND_32(chf16->hwndOwner); - chf32a->hDC=HDC_32(chf16->hDC); - chf32a->iPointSize=chf16->iPointSize; - chf32a->Flags=chf16->Flags; - chf32a->rgbColors=chf16->rgbColors; - chf32a->lCustData=chf16->lCustData; - chf32a->lpfnHook=NULL; - chf32a->lpTemplateName=MapSL(chf16->lpTemplateName); - chf32a->hInstance=HINSTANCE_32(chf16->hInstance); - chf32a->lpszStyle=MapSL(chf16->lpszStyle); - chf32a->nFontType=chf16->nFontType; - chf32a->nSizeMax=chf16->nSizeMax; - chf32a->nSizeMin=chf16->nSizeMin; - FONT_LogFont16To32A(MapSL(chf16->lpLogFont), chf32a->lpLogFont); -}; + int len; + if(chf16->lpTemplateName) + { + len = MultiByteToWideChar(CP_ACP, 0, (LPBYTE)chf16->lpTemplateName, -1, NULL, 0); + chf32w->lpTemplateName = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,len*sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, (LPSTR)MapSL(chf16->lpTemplateName), + -1, (LPWSTR)chf32w->lpTemplateName, len); + } + if(chf16->lpszStyle) + { + len = MultiByteToWideChar(CP_ACP, 0, (LPBYTE)chf16->lpszStyle, -1, NULL, 0); + chf32w->lpszStyle = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, (LPSTR)MapSL(chf16->lpTemplateName), + -1, chf32w->lpszStyle, len); + } + + chf32w->lStructSize=sizeof(CHOOSEFONTA); + chf32w->hwndOwner=HWND_32(chf16->hwndOwner); + chf32w->hDC=HDC_32(chf16->hDC); + chf32w->iPointSize=chf16->iPointSize; + chf32w->Flags=chf16->Flags; + chf32w->rgbColors=chf16->rgbColors; + chf32w->lCustData=chf16->lCustData; + chf32w->lpfnHook=NULL; + chf32w->hInstance=HINSTANCE_32(chf16->hInstance); + chf32w->nFontType=chf16->nFontType; + chf32w->nSizeMax=chf16->nSizeMax; + chf32w->nSizeMin=chf16->nSizeMin; + FONT_LogFont16To32W(MapSL(chf16->lpLogFont), chf32w->lpLogFont); +} /*********************************************************************** * CFn_HookCallChk [internal] @@ -107,15 +122,25 @@ { HWND hwnd=HWND_32(LOWORD(lParam)); HWND hDlg=GetParent(hwnd); - LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); + INT16 ret; + CHOOSEFONTW cf32w; + LOGFONTW lf32w; + cf32w.lpLogFont = &lf32w; + CFn_CHOOSEFONT16to32W((LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER),&cf32w); LOGFONT16 *lplf = MapSL( logfont ); TEXTMETRIC16 *lpmtrx16 = MapSL(metrics); - ENUMLOGFONTEXA elf32a; - NEWTEXTMETRICEXA nmtrx32a; - FONT_LogFont16To32A(lplf, &(elf32a.elfLogFont)); - FONT_Metrics16To32A(lpmtrx16, &nmtrx32a); - return AddFontFamily(&elf32a, &nmtrx32a, nFontType, - (LPCHOOSEFONTA)lpcf->lpTemplateName, hwnd,NULL); + ENUMLOGFONTEXW elf32w; + NEWTEXTMETRICEXW nmtrx32w; + FONT_LogFont16To32W(lplf, &(elf32w.elfLogFont)); + FONT_Metrics16To32W(lpmtrx16, &nmtrx32w); + + ret = AddFontFamily(&elf32w, &nmtrx32w, nFontType, &cf32w, hwnd,NULL); + + if(cf32w.lpTemplateName) + HeapFree(GetProcessHeap(), 0, (LPBYTE)cf32w.lpTemplateName); + if(cf32w.lpszStyle) + HeapFree(GetProcessHeap(), 0, cf32w.lpszStyle); + return ret; } /*********************************************************************** @@ -127,15 +152,25 @@ HWND hcmb2=HWND_32(LOWORD(lParam)); HWND hcmb3=HWND_32(HIWORD(lParam)); HWND hDlg=GetParent(hcmb3); - LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); + INT16 ret; + CHOOSEFONTW cf32w; + LOGFONTW lf32w; + cf32w.lpLogFont = &lf32w; + CFn_CHOOSEFONT16to32W((LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER),&cf32w); LOGFONT16 *lplf = MapSL(logfont); TEXTMETRIC16 *lpmtrx16 = MapSL(metrics); - ENUMLOGFONTEXA elf32a; - NEWTEXTMETRICEXA nmtrx32a; - FONT_LogFont16To32A(lplf, &(elf32a.elfLogFont)); - FONT_Metrics16To32A(lpmtrx16, &nmtrx32a); - return AddFontStyle(&elf32a, &nmtrx32a, nFontType, - (LPCHOOSEFONTA)lpcf->lpTemplateName, hcmb2, hcmb3, hDlg, TRUE); + ENUMLOGFONTEXW elf32w; + NEWTEXTMETRICEXW nmtrx32w; + FONT_LogFont16To32W(lplf, &(elf32w.elfLogFont)); + FONT_Metrics16To32W(lpmtrx16, &nmtrx32w); + + ret = AddFontStyle(&elf32w, &nmtrx32w, nFontType, &cf32w, hcmb2, hcmb3, hDlg, TRUE); + + if(cf32w.lpTemplateName) + HeapFree(GetProcessHeap(), 0, (LPBYTE)cf32w.lpTemplateName); + if(cf32w.lpszStyle) + HeapFree(GetProcessHeap(), 0, cf32w.lpszStyle); + return ret; } /*********************************************************************** @@ -149,13 +184,11 @@ BOOL16 bRet = FALSE; LPCVOID template; FARPROC16 ptr; - CHOOSEFONTA cf32a; - LOGFONTA lf32a; + CHOOSEFONTW cf32w; + LOGFONTW lf32w; LOGFONT16 *font16; SEGPTR lpTemplateName; - - cf32a.lpLogFont=&lf32a; - CFn_CHOOSEFONT16to32A(lpChFont, &cf32a); + int len; TRACE("ChooseFont\n"); if (!lpChFont) return FALSE; @@ -226,9 +259,12 @@ } + cf32w.lpLogFont=&lf32w; + CFn_CHOOSEFONT16to32W(lpChFont, &cf32w); + /* lpTemplateName is not used in the dialog */ lpTemplateName=lpChFont->lpTemplateName; - lpChFont->lpTemplateName=(SEGPTR)&cf32a; + lpChFont->lpTemplateName=(SEGPTR)&cf32w; ptr = GetProcAddress16(GetModuleHandle16("COMMDLG"), (LPCSTR) 16); hInst = GetWindowLongA(HWND_32(lpChFont->hwndOwner), GWL_HINSTANCE); @@ -242,27 +278,34 @@ } lpChFont->lpTemplateName=lpTemplateName; - lpChFont->iPointSize = cf32a.iPointSize; - lpChFont->Flags = cf32a.Flags; - lpChFont->rgbColors = cf32a.rgbColors; - lpChFont->lCustData = cf32a.lCustData; - lpChFont->nFontType = cf32a.nFontType; + lpChFont->iPointSize = cf32w.iPointSize; + lpChFont->Flags = cf32w.Flags; + lpChFont->rgbColors = cf32w.rgbColors; + lpChFont->lCustData = cf32w.lCustData; + lpChFont->nFontType = cf32w.nFontType; font16 = MapSL(lpChFont->lpLogFont); - font16->lfHeight = cf32a.lpLogFont->lfHeight; - font16->lfWidth = cf32a.lpLogFont->lfWidth; - font16->lfEscapement = cf32a.lpLogFont->lfEscapement; - font16->lfOrientation = cf32a.lpLogFont->lfOrientation; - font16->lfWeight = cf32a.lpLogFont->lfWeight; - font16->lfItalic = cf32a.lpLogFont->lfItalic; - font16->lfUnderline = cf32a.lpLogFont->lfUnderline; - font16->lfStrikeOut = cf32a.lpLogFont->lfStrikeOut; - font16->lfCharSet = cf32a.lpLogFont->lfCharSet; - font16->lfOutPrecision = cf32a.lpLogFont->lfOutPrecision; - font16->lfClipPrecision = cf32a.lpLogFont->lfClipPrecision; - font16->lfQuality = cf32a.lpLogFont->lfQuality; - font16->lfPitchAndFamily = cf32a.lpLogFont->lfPitchAndFamily; - lstrcpynA( font16->lfFaceName, cf32a.lpLogFont->lfFaceName, LF_FACESIZE ); + font16->lfHeight = cf32w.lpLogFont->lfHeight; + font16->lfWidth = cf32w.lpLogFont->lfWidth; + font16->lfEscapement = cf32w.lpLogFont->lfEscapement; + font16->lfOrientation = cf32w.lpLogFont->lfOrientation; + font16->lfWeight = cf32w.lpLogFont->lfWeight; + font16->lfItalic = cf32w.lpLogFont->lfItalic; + font16->lfUnderline = cf32w.lpLogFont->lfUnderline; + font16->lfStrikeOut = cf32w.lpLogFont->lfStrikeOut; + font16->lfCharSet = cf32w.lpLogFont->lfCharSet; + font16->lfOutPrecision = cf32w.lpLogFont->lfOutPrecision; + font16->lfClipPrecision = cf32w.lpLogFont->lfClipPrecision; + font16->lfQuality = cf32w.lpLogFont->lfQuality; + font16->lfPitchAndFamily = cf32w.lpLogFont->lfPitchAndFamily;; + len = lstrlenW(cf32w.lpLogFont->lfFaceName)+1; + WideCharToMultiByte(CP_ACP, 0, cf32w.lpLogFont->lfFaceName, + -1, font16->lfFaceName, len, 0, 0); + + if(cf32w.lpTemplateName) + HeapFree(GetProcessHeap(), 0, (LPBYTE)cf32w.lpTemplateName); + if(cf32w.lpszStyle) + HeapFree(GetProcessHeap(), 0, cf32w.lpszStyle); return bRet; } @@ -277,10 +320,15 @@ { HWND hDlg = HWND_32(hDlg16); LPCHOOSEFONT16 lpcf; + CHOOSEFONTW cf32w; + LOGFONTW lf32w; BOOL16 res=0; + + cf32w.lpLogFont = &lf32w; if (message!=WM_INITDIALOG) { lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); + CFn_CHOOSEFONT16to32W(lpcf, &cf32w); if (!lpcf && message != WM_MEASUREITEM) return FALSE; if (CFn_HookCallChk(lpcf)) @@ -291,7 +339,8 @@ else { lpcf=(LPCHOOSEFONT16)lParam; - if (!CFn_WMInitDialog(hDlg, wParam, lParam, (LPCHOOSEFONTA)lpcf->lpTemplateName)) + CFn_CHOOSEFONT16to32W(lpcf, &cf32w); + if (!CFn_WMInitDialog(hDlg, wParam, lParam, &cf32w)) { TRACE("CFn_WMInitDialog returned FALSE\n"); return FALSE; @@ -333,8 +382,7 @@ } break; case WM_COMMAND: - res=CFn_WMCommand(hDlg, MAKEWPARAM( wParam, HIWORD(lParam) ), LOWORD(lParam), - (LPCHOOSEFONTA)lpcf->lpTemplateName); + res=CFn_WMCommand(hDlg, MAKEWPARAM( wParam, HIWORD(lParam) ), LOWORD(lParam),&cf32w); break; case WM_DESTROY: res=CFn_WMDestroy(hDlg, wParam, lParam); @@ -344,8 +392,12 @@ FIXME("current logfont back to caller\n"); break; case WM_PAINT: - res= CFn_WMPaint(hDlg, wParam, lParam, (LPCHOOSEFONTA)lpcf->lpTemplateName); + res= CFn_WMPaint(hDlg, wParam, lParam, &cf32w); break; } + if(cf32w.lpTemplateName) + HeapFree(GetProcessHeap(), 0, (LPBYTE)cf32w.lpTemplateName); + if(cf32w.lpszStyle) + HeapFree(GetProcessHeap(), 0, cf32w.lpszStyle); return res; } Index: dlls/commdlg/fontdlg.c =================================================================== RCS file: /home/wine/wine/dlls/commdlg/fontdlg.c,v retrieving revision 1.70 diff -u -r1.70 fontdlg.c --- dlls/commdlg/fontdlg.c 14 Aug 2004 00:42:35 -0000 1.70 +++ dlls/commdlg/fontdlg.c 19 Aug 2004 22:56:35 -0000 @@ -48,9 +48,7 @@ #define TTBITMAP_XSIZE 20 /* x-size of the bitmaps */ -INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, - LPARAM lParam); -INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, +INT_PTR CALLBACK FormatCharDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); /* There is a table here of all charsets, and the sample text for each. @@ -212,7 +210,7 @@ FIXME(": unimplemented flag (ignored)\n"); return DialogBoxIndirectParamW(COMDLG32_hInstance, template, - lpChFont->hwndOwner, FormatCharDlgProcW, (LPARAM)lpChFont ); + lpChFont->hwndOwner, FormatCharDlgProc, (LPARAM)lpChFont ); } /*********************************************************************** @@ -220,49 +218,52 @@ */ BOOL WINAPI ChooseFontA(LPCHOOSEFONTA lpChFont) { - LPCVOID template; - HRSRC hResInfo; - HINSTANCE hDlginst; - HGLOBAL hDlgTmpl; - - if ( (lpChFont->Flags&CF_ENABLETEMPLATEHANDLE)!=0 ) - { - template=(LPCVOID)lpChFont->hInstance; - } else - { - if ( (lpChFont->Flags&CF_ENABLETEMPLATE)!=0 ) - { - hDlginst=lpChFont->hInstance; - if( !(hResInfo = FindResourceA(hDlginst, lpChFont->lpTemplateName, - (LPSTR)RT_DIALOG))) - { - COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); - return FALSE; - } - } else - { - hDlginst=COMDLG32_hInstance; - if (!(hResInfo = FindResourceA(hDlginst, "CHOOSE_FONT", (LPSTR)RT_DIALOG))) - { - COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); - return FALSE; - } - } - if (!(hDlgTmpl = LoadResource(hDlginst, hResInfo )) || - !(template = LockResource( hDlgTmpl ))) - { - COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); - return FALSE; - } + CHOOSEFONTW chFontw; + LOGFONTW logFontw; + LPLOGFONTA lpLogFonta; + int len; + BOOL ret; + + lpLogFonta = lpChFont->lpLogFont; + memcpy(&chFontw, lpChFont, sizeof(CHOOSEFONTW)); + memcpy(&logFontw, lpChFont->lpLogFont, sizeof(LOGFONTA)); + + MultiByteToWideChar(CP_ACP, 0, lpLogFonta->lfFaceName, + LF_FACESIZE, chFontw.lpLogFont->lfFaceName, LF_FACESIZE); + + if(lpChFont->lpszStyle) { + len = MultiByteToWideChar(CP_ACP, 0, lpChFont->lpszStyle, -1, NULL, 0); + chFontw.lpszStyle = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, lpChFont->lpszStyle, -1, chFontw.lpszStyle, len); + HeapFree(GetProcessHeap(), 0, lpChFont->lpszStyle); + } + + if(lpChFont->lpTemplateName) { + len = MultiByteToWideChar(CP_ACP, 0, lpChFont->lpTemplateName, -1, NULL, 0); + chFontw.lpTemplateName = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, lpChFont->lpTemplateName, + -1, (LPWSTR)chFontw.lpTemplateName, len); + } + + ret = ChooseFontW(&chFontw); + + memcpy(lpChFont, &chFontw, sizeof(CHOOSEFONTA)); + lpChFont->lpLogFont = lpLogFonta; + memcpy(lpChFont->lpLogFont, &logFontw, (int)(((LPLOGFONTW)0)->lfFaceName)); + WideCharToMultiByte(CP_ACP, 0, logFontw.lfFaceName, + LF_FACESIZE, lpLogFonta->lfFaceName, LF_FACESIZE, 0, 0); + + if(chFontw.lpszStyle) { + len = lstrlenW(chFontw.lpszStyle)+1; + lpChFont->lpszStyle = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); + WideCharToMultiByte(CP_ACP, 0, chFontw.lpszStyle, -1, lpChFont->lpszStyle, len, 0, 0); + HeapFree(GetProcessHeap(), 0, chFontw.lpszStyle); } - if (TRACE_ON(commdlg)) - _dump_cf_flags(lpChFont->Flags); - if (lpChFont->Flags & (CF_SELECTSCRIPT | CF_NOVERTFONTS )) - FIXME(": unimplemented flag (ignored)\n"); + if(chFontw.lpTemplateName) + HeapFree(GetProcessHeap(), 0, (LPBYTE)chFontw.lpTemplateName); - return DialogBoxIndirectParamA(COMDLG32_hInstance, template, - lpChFont->hwndOwner, FormatCharDlgProcA, (LPARAM)lpChFont ); + return ret; } @@ -280,7 +281,7 @@ /*********************************************************************** * CFn_HookCallChk32 [internal] */ -static BOOL CFn_HookCallChk32(LPCHOOSEFONTA lpcf) +static BOOL CFn_HookCallChk32(LPCHOOSEFONTW lpcf) { if (lpcf) if(lpcf->Flags & CF_ENABLEHOOK) @@ -292,14 +293,14 @@ /************************************************************************* * AddFontFamily [internal] */ -INT AddFontFamily(const ENUMLOGFONTEXA *lpElfex, const NEWTEXTMETRICEXA *lpNTM, - UINT nFontType, LPCHOOSEFONTA lpcf, HWND hwnd, LPCFn_ENUMSTRUCT e) +INT AddFontFamily(const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM, + UINT nFontType, LPCHOOSEFONTW lpcf, HWND hwnd, LPCFn_ENUMSTRUCTW e) { int i; WORD w; - const LOGFONTA *lplf = &(lpElfex->elfLogFont); + const LOGFONTW *lplf = &(lpElfex->elfLogFont); - TRACE("font=%s (nFontType=%d)\n", lplf->lfFaceName,nFontType); + TRACE("font=%s (nFontType=%d)\n", wine_dbgstr_w(lplf->lfFaceName),nFontType); if (lpcf->Flags & CF_FIXEDPITCHONLY) if (!(lplf->lfPitchAndFamily & FIXED_PITCH)) @@ -313,14 +314,14 @@ if (e) e->added++; - i=SendMessageA(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)lplf->lfFaceName); + i=SendMessageW(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)lplf->lfFaceName); if (i == CB_ERR) { - i = SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)lplf->lfFaceName); + i = SendMessageW(hwnd, CB_ADDSTRING, 0, (LPARAM)lplf->lfFaceName); if( i != CB_ERR) { /* store some important font information */ w = (lplf->lfPitchAndFamily) << 8 | (HIWORD(lpNTM->ntmTm.ntmFlags) & 0xff); - SendMessageA(hwnd, CB_SETITEMDATA, i, MAKELONG(nFontType,w)); + SendMessageW(hwnd, CB_SETITEMDATA, i, MAKELONG(nFontType,w)); } } return 1; @@ -329,13 +330,13 @@ /************************************************************************* * FontFamilyEnumProc32 [internal] */ -static INT WINAPI FontFamilyEnumProc(const ENUMLOGFONTEXA *lpElfex, - const TEXTMETRICA *metrics, DWORD dwFontType, LPARAM lParam) +static INT WINAPI FontFamilyEnumProc(const ENUMLOGFONTEXW *lpElfex, + const TEXTMETRICW *metrics, DWORD dwFontType, LPARAM lParam) { - LPCFn_ENUMSTRUCT e; - e=(LPCFn_ENUMSTRUCT)lParam; - return AddFontFamily( lpElfex, (NEWTEXTMETRICEXA *) metrics, - dwFontType, e->lpcf32a, e->hWnd1, e); + LPCFn_ENUMSTRUCTW e; + e=(LPCFn_ENUMSTRUCTW)lParam; + return AddFontFamily( lpElfex, (NEWTEXTMETRICEXW *) metrics, + dwFontType, e->lpcf32w, e->hWnd1, e); } /************************************************************************* @@ -343,42 +344,44 @@ * * Fill font style information into combobox (without using font.c directly) */ -static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTA *lplf) +static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTW *lplf) { #define FSTYLES 4 struct FONTSTYLE { int italic; int weight; - char stname[20]; + WCHAR stname[20]; }; static struct FONTSTYLE fontstyles[FSTYLES]={ - { 0,FW_NORMAL,"Regular"}, { 1,FW_NORMAL,"Italic"}, - { 0,FW_BOLD,"Bold"}, { 1,FW_BOLD,"Bold Italic"} + { 0,FW_NORMAL,{'R','e','g','u','l','a','r',0} }, + { 1,FW_NORMAL,{'I','t','a','l','i','c',0} }, + { 0,FW_BOLD, {'B','o','l','d',0}}, + { 1,FW_BOLD, {'B','o','l','d',' ','I','t','a','l','i','c',0} } }; HFONT hf; - TEXTMETRICA tm; + TEXTMETRICW tm; int i,j; - LOGFONTA lf; + LOGFONTW lf; - memcpy(&lf, lplf, sizeof(LOGFONTA)); + memcpy(&lf, lplf, sizeof(LOGFONTW)); for (i=0;iFlags & CF_LIMITSIZE)) || ((lpcf->Flags & CF_LIMITSIZE) && (h >= lpcf->nSizeMin) && (h <= lpcf->nSizeMax))) { - sprintf(buffer, "%2d", h); - j=SendMessageA(hwnd, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer); + wsprintfW(buffer, format, h); + j=SendMessageW(hwnd, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer); if (j==CB_ERR) { - j=SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)buffer); - if (j!=CB_ERR) j = SendMessageA(hwnd, CB_SETITEMDATA, j, h); + j=SendMessageW(hwnd, CB_ADDSTRING, 0, (LPARAM)buffer); + if (j!=CB_ERR) j = SendMessageW(hwnd, CB_SETITEMDATA, j, h); if (j==CB_ERR) return 1; } } @@ -412,7 +416,7 @@ /************************************************************************* * SetFontSizesToCombo3 [internal] */ -static int SetFontSizesToCombo3(HWND hwnd, LPCHOOSEFONTA lpcf) +static int SetFontSizesToCombo3(HWND hwnd, LPCHOOSEFONTW lpcf) { static const int sizes[]={8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72,0}; int i; @@ -425,7 +429,7 @@ /************************************************************************* * CFn_GetDC [internal] */ -inline HDC CFn_GetDC(LPCHOOSEFONTA lpcf) +inline HDC CFn_GetDC(LPCHOOSEFONTW lpcf) { HDC ret = ((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC) ? lpcf->hDC : @@ -437,7 +441,7 @@ /************************************************************************* * CFn_ReleaseDC [internal] */ -inline void CFn_ReleaseDC(LPCHOOSEFONTA lpcf, HDC hdc) +inline void CFn_ReleaseDC(LPCHOOSEFONTW lpcf, HDC hdc) { if(!((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC)) ReleaseDC(0, hdc); @@ -446,19 +450,19 @@ /*********************************************************************** * AddFontStyle [internal] */ -INT AddFontStyle( const ENUMLOGFONTEXA *lpElfex, const NEWTEXTMETRICEXA *lpNTM, - UINT nFontType, LPCHOOSEFONTA lpcf, HWND hcmb2, HWND hcmb3, +INT AddFontStyle( const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM, + UINT nFontType, LPCHOOSEFONTW lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg, BOOL iswin16) { int i; - const LOGFONTA *lplf = &(lpElfex->elfLogFont); + const LOGFONTW *lplf = &(lpElfex->elfLogFont); HWND hcmb5; HDC hdc; TRACE("(nFontType=%d)\n",nFontType); TRACE(" %s h=%ld w=%ld e=%ld o=%ld wg=%ld i=%d u=%d s=%d" " ch=%d op=%d cp=%d q=%d pf=%xh\n", - lplf->lfFaceName,lplf->lfHeight,lplf->lfWidth, + wine_dbgstr_w(lplf->lfFaceName),lplf->lfHeight,lplf->lfWidth, lplf->lfEscapement,lplf->lfOrientation, lplf->lfWeight,lplf->lfItalic,lplf->lfUnderline, lplf->lfStrikeOut,lplf->lfCharSet, lplf->lfOutPrecision, @@ -474,7 +478,7 @@ if( i) return 0; } else if (SetFontSizesToCombo3(hcmb3, lpcf)) return 0; - if (!SendMessageA(hcmb2, CB_GETCOUNT, 0, 0)) + if (!SendMessageW(hcmb2, CB_GETCOUNT, 0, 0)) { if(!(hdc = CFn_GetDC(lpcf))) return 0; i=SetFontStylesToCombo2(hcmb2,hdc,lplf); @@ -483,13 +487,13 @@ return 0; } if( iswin16 || !( hcmb5 = GetDlgItem(hDlg, cmb5))) return 1; - i = SendMessageA( hcmb5, CB_FINDSTRINGEXACT, 0, + i = SendMessageW( hcmb5, CB_FINDSTRINGEXACT, 0, (LPARAM)lpElfex->elfScript); if( i == CB_ERR) { - i = SendMessageA( hcmb5, CB_ADDSTRING, 0, + i = SendMessageW( hcmb5, CB_ADDSTRING, 0, (LPARAM)lpElfex->elfScript); if( i != CB_ERR) - SendMessageA( hcmb5, CB_SETITEMDATA, i, lplf->lfCharSet); + SendMessageW( hcmb5, CB_SETITEMDATA, i, lplf->lfCharSet); } return 1 ; } @@ -499,14 +503,13 @@ int i,n; int ret = 0; /* look for fitting font size in combobox3 */ - n=SendDlgItemMessageA(hDlg, cmb3, CB_GETCOUNT, 0, 0); + n=SendDlgItemMessageW(hDlg, cmb3, CB_GETCOUNT, 0, 0); for (i=0;ihWnd1; HWND hcmb3=s->hWnd2; HWND hDlg=GetParent(hcmb3); - return AddFontStyle( lpElfex, (const NEWTEXTMETRICEXA *) metrics, - dwFontType, s->lpcf32a, hcmb2, hcmb3, hDlg, FALSE); + return AddFontStyle( lpElfex, (const NEWTEXTMETRICEXW *) metrics, + dwFontType, s->lpcf32w, hcmb2, hcmb3, hDlg, FALSE); } /*********************************************************************** * CFn_WMInitDialog [internal] */ LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam, - LPCHOOSEFONTA lpcf) + LPCHOOSEFONTW lpcf) { HDC hdc; int i,j,init=0; long pstyle; - CFn_ENUMSTRUCT s; - LPLOGFONTA lpxx; + CFn_ENUMSTRUCTW s; + LPLOGFONTW lpxx; HCURSOR hcursor=SetCursor(LoadCursorA(0,(LPSTR)IDC_WAIT)); + WCHAR color_name[] = {'[','c','o','l','o','r',' ','n','a','m','e',']',0}; SetPropA(hDlg, WINE_FONTDATA, (HANDLE)lParam); lpxx=lpcf->lpLogFont; TRACE("WM_INITDIALOG lParam=%08lX\n", lParam); - if (lpcf->lStructSize != sizeof(CHOOSEFONTA)) + if (lpcf->lStructSize != sizeof(CHOOSEFONTW)) { ERR("structure size failure !!!\n"); EndDialog (hDlg, 0); @@ -609,18 +613,18 @@ { for (i=0;irgbColors) - SendDlgItemMessageA(hDlg,cmb4, CB_SETCURSEL,j,0); + SendDlgItemMessageW(hDlg,cmb4, CB_SETCURSEL,j,0); } } else @@ -637,14 +641,14 @@ return FALSE; } s.hWnd1=GetDlgItem(hDlg,cmb1); - s.lpcf32a=lpcf; + s.lpcf32w=lpcf; do { - LOGFONTA elf; + LOGFONTW elf; s.added = 0; elf.lfCharSet = DEFAULT_CHARSET; /* enum all charsets */ elf.lfPitchAndFamily = 0; elf.lfFaceName[0] = '\0'; /* enum all fonts */ - if (!EnumFontFamiliesExA(hdc, &elf, (FONTENUMPROCA)FontFamilyEnumProc, (LPARAM)&s, 0)) + if (!EnumFontFamiliesExW(hdc, &elf, (FONTENUMPROCW)FontFamilyEnumProc, (LPARAM)&s, 0)) { TRACE("EnumFontFamiliesEx returns 0\n"); break; @@ -667,7 +671,7 @@ if (lpcf->Flags & CF_INITTOLOGFONTSTRUCT) { /* look for fitting font name in combobox1 */ - j=SendDlgItemMessageA(hDlg,cmb1,CB_FINDSTRING,-1,(LONG)lpxx->lfFaceName); + j=SendDlgItemMessageW(hDlg,cmb1,CB_FINDSTRING,-1,(LONG)lpxx->lfFaceName); if (j!=CB_ERR) { INT height = lpxx->lfHeight < 0 ? -lpxx->lfHeight : @@ -677,8 +681,8 @@ points = MulDiv( height, 72, GetDeviceCaps(hdc, LOGPIXELSY)); pstyle = MAKELONG(lpxx->lfWeight > FW_MEDIUM ? FW_BOLD: FW_NORMAL,lpxx->lfItalic !=0); - SendDlgItemMessageA(hDlg, cmb1, CB_SETCURSEL, j, 0); - SendMessageA(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE), + SendDlgItemMessageW(hDlg, cmb1, CB_SETCURSEL, j, 0); + SendMessageW(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE), (LPARAM)GetDlgItem(hDlg,cmb1)); init=1; /* look for fitting font style in combobox2 */ @@ -690,17 +694,17 @@ } if (!init) { - SendDlgItemMessageA(hDlg,cmb1,CB_SETCURSEL,0,0); - SendMessageA(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE), + SendDlgItemMessageW(hDlg,cmb1,CB_SETCURSEL,0,0); + SendMessageW(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE), (LPARAM)GetDlgItem(hDlg,cmb1)); } if (lpcf->Flags & CF_USESTYLE && lpcf->lpszStyle) { - j=SendDlgItemMessageA(hDlg,cmb2,CB_FINDSTRING,-1,(LONG)lpcf->lpszStyle); + j=SendDlgItemMessageW(hDlg,cmb2,CB_FINDSTRING,-1,(LONG)lpcf->lpszStyle); if (j!=CB_ERR) { - j=SendDlgItemMessageA(hDlg,cmb2,CB_SETCURSEL,j,0); - SendMessageA(hDlg,WM_COMMAND,cmb2, + j=SendDlgItemMessageW(hDlg,cmb2,CB_SETCURSEL,j,0); + SendMessageW(hDlg,WM_COMMAND,cmb2, MAKELONG(HWND_16(GetDlgItem(hDlg,cmb2)),CBN_SELCHANGE)); } } @@ -742,7 +746,7 @@ LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam) { HBRUSH hBrush; - char buffer[40]; + WCHAR buffer[40]; COLORREF cr, oldText=0, oldBk=0; RECT rect; int nFontType; @@ -775,11 +779,11 @@ { case cmb1: /* TRACE(commdlg,"WM_Drawitem cmb1\n"); */ - SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, + SendMessageW(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, (LPARAM)buffer); - TextOutA(lpdi->hDC, lpdi->rcItem.left + TTBITMAP_XSIZE + 10, - lpdi->rcItem.top, buffer, strlen(buffer)); - nFontType = SendMessageA(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L); + TextOutW(lpdi->hDC, lpdi->rcItem.left + TTBITMAP_XSIZE + 10, + lpdi->rcItem.top, buffer, lstrlenW(buffer)); + nFontType = SendMessageW(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L); idx = -1; if (nFontType & TRUETYPE_FONTTYPE) { idx = 0; /* picture: TT */ @@ -799,19 +803,18 @@ case cmb3: /* TRACE(commdlg,"WM_DRAWITEN cmb2,cmb3\n"); */ case cmb5: - SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, - (LPARAM)buffer); - TextOutA(lpdi->hDC, lpdi->rcItem.left, - lpdi->rcItem.top, buffer, strlen(buffer)); + SendMessageW(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, (LPARAM)buffer); + TextOutW(lpdi->hDC, lpdi->rcItem.left, + lpdi->rcItem.top, buffer, lstrlenW(buffer)); break; case cmb4: /* TRACE(commdlg,"WM_DRAWITEM cmb4 (=COLOR)\n"); */ - SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, + SendMessageW(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, (LPARAM)buffer); - TextOutA(lpdi->hDC, lpdi->rcItem.left + 25+5, - lpdi->rcItem.top, buffer, strlen(buffer)); - cr = SendMessageA(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L); + TextOutW(lpdi->hDC, lpdi->rcItem.left + 25+5, + lpdi->rcItem.top, buffer, lstrlenW(buffer)); + cr = SendMessageW(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L); hBrush = CreateSolidBrush(cr); if (hBrush) { @@ -844,12 +847,12 @@ * CFn_WMCommand [internal] */ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam, - LPCHOOSEFONTA lpcf) + LPCHOOSEFONTW lpcf) { int i; long l; HDC hdc; - LPLOGFONTA lpxx=lpcf->lpLogFont; + LPLOGFONTW lpxx=lpcf->lpLogFont; TRACE("WM_COMMAND wParam=%08lX lParam=%08lX\n", (LONG)wParam, lParam); switch (LOWORD(wParam)) @@ -866,33 +869,32 @@ EndDialog (hDlg, 0); return TRUE; } - idx = SendDlgItemMessageA(hDlg, cmb3, CB_GETCURSEL, 0, 0); - pointsize = (int)SendDlgItemMessageA( hDlg, cmb3, CB_GETITEMDATA, - idx, 0); - idx = SendDlgItemMessageA(hDlg, cmb2, CB_GETCURSEL, 0, 0); - pstyle = SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, idx, 0); - idx = SendDlgItemMessageA(hDlg, cmb5, CB_GETCURSEL, 0, 0); - charset = SendDlgItemMessageA(hDlg, cmb5, CB_GETITEMDATA, idx, 0); + idx = SendDlgItemMessageW(hDlg, cmb3, CB_GETCURSEL, 0, 0); + pointsize = (int)SendDlgItemMessageW( hDlg, cmb3, CB_GETITEMDATA, idx, 0); + idx = SendDlgItemMessageW(hDlg, cmb2, CB_GETCURSEL, 0, 0); + pstyle = SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, idx, 0); + idx = SendDlgItemMessageW(hDlg, cmb5, CB_GETCURSEL, 0, 0); + charset = SendDlgItemMessageW(hDlg, cmb5, CB_GETITEMDATA, idx, 0); - SendDlgItemMessageA(hDlg, cmb2, CB_RESETCONTENT, 0, 0); - SendDlgItemMessageA(hDlg, cmb3, CB_RESETCONTENT, 0, 0); - SendDlgItemMessageA(hDlg, cmb5, CB_RESETCONTENT, 0, 0); - i=SendDlgItemMessageA(hDlg, cmb1, CB_GETCURSEL, 0, 0); + SendDlgItemMessageW(hDlg, cmb2, CB_RESETCONTENT, 0, 0); + SendDlgItemMessageW(hDlg, cmb3, CB_RESETCONTENT, 0, 0); + SendDlgItemMessageW(hDlg, cmb5, CB_RESETCONTENT, 0, 0); + i=SendDlgItemMessageW(hDlg, cmb1, CB_GETCURSEL, 0, 0); if (i!=CB_ERR) { HCURSOR hcursor=SetCursor(LoadCursorA(0,(LPSTR)IDC_WAIT)); - CFn_ENUMSTRUCT s; - LOGFONTA enumlf; - SendDlgItemMessageA(hDlg, cmb1, CB_GETLBTEXT, i, + CFn_ENUMSTRUCTW s; + LOGFONTW enumlf; + SendDlgItemMessageW(hDlg, cmb1, CB_GETLBTEXT, i, (LPARAM)enumlf.lfFaceName); - TRACE("WM_COMMAND/cmb1 =>%s\n",enumlf.lfFaceName); + TRACE("WM_COMMAND/cmb1 =>%s\n",wine_dbgstr_w(enumlf.lfFaceName)); s.hWnd1=GetDlgItem(hDlg, cmb2); s.hWnd2=GetDlgItem(hDlg, cmb3); - s.lpcf32a=lpcf; + s.lpcf32w=lpcf; enumlf.lfCharSet = DEFAULT_CHARSET; /* enum all charsets */ enumlf.lfPitchAndFamily = 0; - EnumFontFamiliesExA(hdc, &enumlf, - (FONTENUMPROCA)FontStyleEnumProc, (LPARAM)&s, 0); + EnumFontFamiliesExW(hdc, &enumlf, + (FONTENUMPROCW)FontStyleEnumProc, (LPARAM)&s, 0); CFn_FitFontStyle(hDlg, pstyle); if( pointsize != CB_ERR) CFn_FitFontSize(hDlg, pointsize); if( charset != CB_ERR) CFn_FitCharSet( hDlg, charset ); @@ -907,37 +909,37 @@ case cmb5: if (HIWORD(wParam)==CBN_SELCHANGE || HIWORD(wParam)== BN_CLICKED ) { - char str[256]; + WCHAR str[256]; WINDOWINFO wininfo; TRACE("WM_COMMAND/cmb2,3 =%08lX\n", lParam); - i=SendDlgItemMessageA(hDlg,cmb1,CB_GETCURSEL,0,0); + i=SendDlgItemMessageW(hDlg,cmb1,CB_GETCURSEL,0,0); if (i==CB_ERR) - i=GetDlgItemTextA( hDlg, cmb1, str, 256 ); + i=GetDlgItemTextW( hDlg, cmb1, str, 256 ); else { - SendDlgItemMessageA(hDlg,cmb1,CB_GETLBTEXT,i, + SendDlgItemMessageW(hDlg,cmb1,CB_GETLBTEXT,i, (LPARAM)str); - l=SendDlgItemMessageA(hDlg,cmb1,CB_GETITEMDATA,i,0); + l=SendDlgItemMessageW(hDlg,cmb1,CB_GETITEMDATA,i,0); lpcf->nFontType = LOWORD(l); /* FIXME: lpcf->nFontType |= .... SIMULATED_FONTTYPE and so */ /* same value reported to the EnumFonts call back with the extra FONTTYPE_... bits added */ lpxx->lfPitchAndFamily = HIWORD(l) >> 8; } - strcpy(lpxx->lfFaceName,str); - i=SendDlgItemMessageA(hDlg, cmb2, CB_GETCURSEL, 0, 0); + lstrcpyW(lpxx->lfFaceName,str); + i=SendDlgItemMessageW(hDlg, cmb2, CB_GETCURSEL, 0, 0); if (i!=CB_ERR) { - l=SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, i, 0); + l=SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, i, 0); if (0!=(lpxx->lfItalic=HIWORD(l))) lpcf->nFontType |= ITALIC_FONTTYPE; if ((lpxx->lfWeight=LOWORD(l)) > FW_MEDIUM) lpcf->nFontType |= BOLD_FONTTYPE; } - i=SendDlgItemMessageA(hDlg, cmb3, CB_GETCURSEL, 0, 0); + i=SendDlgItemMessageW(hDlg, cmb3, CB_GETCURSEL, 0, 0); if( i != CB_ERR) - lpcf->iPointSize = 10 * LOWORD(SendDlgItemMessageA(hDlg, cmb3, + lpcf->iPointSize = 10 * LOWORD(SendDlgItemMessageW(hDlg, cmb3, CB_GETITEMDATA , i, 0)); else lpcf->iPointSize = 100; @@ -949,9 +951,9 @@ CFn_ReleaseDC(lpcf, hdc); } else lpxx->lfHeight = -lpcf->iPointSize / 10; - i=SendDlgItemMessageA(hDlg, cmb5, CB_GETCURSEL, 0, 0); + i=SendDlgItemMessageW(hDlg, cmb5, CB_GETCURSEL, 0, 0); if (i!=CB_ERR) - lpxx->lfCharSet=SendDlgItemMessageA(hDlg, cmb5, CB_GETITEMDATA, i, 0); + lpxx->lfCharSet=SendDlgItemMessageW(hDlg, cmb5, CB_GETITEMDATA, i, 0); else lpxx->lfCharSet = DEFAULT_CHARSET; lpxx->lfStrikeOut=IsDlgButtonChecked(hDlg,chx1); @@ -972,7 +974,7 @@ break; case cmb4: - i=SendDlgItemMessageA(hDlg, cmb4, CB_GETCURSEL, 0, 0); + i=SendDlgItemMessageW(hDlg, cmb4, CB_GETCURSEL, 0, 0); if (i!=CB_ERR) { WINDOWINFO wininfo; @@ -989,9 +991,9 @@ break; case psh15: - i=RegisterWindowMessageA( HELPMSGSTRINGA ); + i=RegisterWindowMessageW( HELPMSGSTRINGW ); if (lpcf->hwndOwner) - SendMessageA(lpcf->hwndOwner, i, 0, (LPARAM)GetPropA(hDlg, WINE_FONTDATA)); + SendMessageW(lpcf->hwndOwner, i, 0, (LPARAM)GetPropA(hDlg, WINE_FONTDATA)); /* if (CFn_HookCallChk(lpcf)) CallWindowProc16(lpcf->lpfnHook,hDlg,WM_COMMAND,psh15,(LPARAM)lpcf);*/ break; @@ -1023,7 +1025,7 @@ } LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam, - LPCHOOSEFONTA lpcf ) + LPCHOOSEFONTW lpcf ) { WINDOWINFO info; @@ -1036,7 +1038,7 @@ HPEN hOrigPen; HFONT hOrigFont; COLORREF rgbPrev; - LOGFONTA lf = *(lpcf->lpLogFont); + LOGFONTW lf = *(lpcf->lpLogFont); MapWindowPoints( 0, hDlg, (LPPOINT) &info.rcWindow, 2); hdc=BeginPaint( hDlg, &ps ); @@ -1058,7 +1060,7 @@ info.rcWindow.bottom--; info.rcWindow.top++; info.rcWindow.left++; - hOrigFont = SelectObject( hdc, CreateFontIndirectA( &lf ) ); + hOrigFont = SelectObject( hdc, CreateFontIndirectW( &lf ) ); rgbPrev=SetTextColor( hdc, lpcf->rgbColors ); DrawTextW( hdc, @@ -1073,59 +1075,9 @@ } /*********************************************************************** - * FormatCharDlgProcA [internal] - */ -INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, - LPARAM lParam) -{ - LPCHOOSEFONTA lpcf; - INT_PTR res = FALSE; - if (uMsg!=WM_INITDIALOG) - { - lpcf=(LPCHOOSEFONTA)GetPropA(hDlg, WINE_FONTDATA); - if (!lpcf && uMsg != WM_MEASUREITEM) - return FALSE; - if (CFn_HookCallChk32(lpcf)) - res=CallWindowProcA((WNDPROC)lpcf->lpfnHook, hDlg, uMsg, wParam, lParam); - if (res) - return res; - } - else - { - lpcf=(LPCHOOSEFONTA)lParam; - if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf)) - { - TRACE("CFn_WMInitDialog returned FALSE\n"); - return FALSE; - } - if (CFn_HookCallChk32(lpcf)) - return CallWindowProcA((WNDPROC)lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); - } - switch (uMsg) - { - case WM_MEASUREITEM: - return CFn_WMMeasureItem(hDlg, wParam, lParam); - case WM_DRAWITEM: - return CFn_WMDrawItem(hDlg, wParam, lParam); - case WM_COMMAND: - return CFn_WMCommand(hDlg, wParam, lParam, lpcf); - case WM_DESTROY: - return CFn_WMDestroy(hDlg, wParam, lParam); - case WM_CHOOSEFONT_GETLOGFONT: - TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", - lParam); - FIXME("current logfont back to caller\n"); - break; - case WM_PAINT: - return CFn_WMPaint(hDlg, wParam, lParam, lpcf); - } - return res; -} - -/*********************************************************************** - * FormatCharDlgProcW [internal] + * FormatCharDlgProc [internal] */ -INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, +INT_PTR CALLBACK FormatCharDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { LPCHOOSEFONTW lpcf32w; @@ -1135,7 +1087,7 @@ lpcf32w=(LPCHOOSEFONTW)GetPropA(hDlg, WINE_FONTDATA); if (!lpcf32w) return FALSE; - if (CFn_HookCallChk32((LPCHOOSEFONTA)lpcf32w)) + if (CFn_HookCallChk32(lpcf32w)) res=CallWindowProcW((WNDPROC)lpcf32w->lpfnHook, hDlg, uMsg, wParam, lParam); if (res) return res; @@ -1143,12 +1095,12 @@ else { lpcf32w=(LPCHOOSEFONTW)lParam; - if (!CFn_WMInitDialog(hDlg, wParam, lParam, (LPCHOOSEFONTA)lpcf32w)) + if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf32w)) { TRACE("CFn_WMInitDialog returned FALSE\n"); return FALSE; } - if (CFn_HookCallChk32((LPCHOOSEFONTA)lpcf32w)) + if (CFn_HookCallChk32(lpcf32w)) return CallWindowProcW((WNDPROC)lpcf32w->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); } switch (uMsg) @@ -1158,7 +1110,7 @@ case WM_DRAWITEM: return CFn_WMDrawItem(hDlg, wParam, lParam); case WM_COMMAND: - return CFn_WMCommand(hDlg, wParam, lParam, (LPCHOOSEFONTW)lpcf32w); + return CFn_WMCommand(hDlg, wParam, lParam, lpcf32w); case WM_DESTROY: return CFn_WMDestroy(hDlg, wParam, lParam); case WM_CHOOSEFONT_GETLOGFONT: Index: dlls/commdlg/cdlg.h =================================================================== RCS file: /home/wine/wine/dlls/commdlg/cdlg.h,v retrieving revision 1.31 diff -u -r1.31 cdlg.h --- dlls/commdlg/cdlg.h 30 Dec 2003 22:08:17 -0000 1.31 +++ dlls/commdlg/cdlg.h 19 Aug 2004 22:56:35 -0000 @@ -201,24 +201,33 @@ HWND hWnd2; LPCHOOSEFONTA lpcf32a; int added; -} CFn_ENUMSTRUCT, *LPCFn_ENUMSTRUCT; +} CFn_ENUMSTRUCTA, *LPCFn_ENUMSTRUCTA; -INT AddFontFamily(const ENUMLOGFONTEXA *lpElfex, const NEWTEXTMETRICEXA *lpNTM, - UINT nFontType, LPCHOOSEFONTA lpcf, HWND hwnd, - LPCFn_ENUMSTRUCT e); -INT AddFontStyle(const ENUMLOGFONTEXA *lpElfex, const NEWTEXTMETRICEXA *metrics, - UINT nFontType, LPCHOOSEFONTA lpcf, HWND hcmb2, HWND hcmb3, +typedef struct +{ + HWND hWnd1; + HWND hWnd2; + LPCHOOSEFONTW lpcf32w; + int added; +} CFn_ENUMSTRUCTW, *LPCFn_ENUMSTRUCTW; + +INT AddFontFamily(const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM, + UINT nFontType, LPCHOOSEFONTW lpcf, HWND hwnd, + LPCFn_ENUMSTRUCTW e); +INT AddFontStyle(const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *metrics, + UINT nFontType, LPCHOOSEFONTW lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg, BOOL iswin16); + void _dump_cf_flags(DWORD cflags); LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam, - LPCHOOSEFONTA lpcf); + LPCHOOSEFONTW lpcf); LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam); LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam); LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam, - LPCHOOSEFONTA lpcf); + LPCHOOSEFONTW lpcf); LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam, - LPCHOOSEFONTA lpcf); + LPCHOOSEFONTW lpcf); LRESULT CFn_WMDestroy(HWND hwnd, WPARAM wParam, LPARAM lParam); #endif /* _WINE_DLL_CDLG_H */