2 * COMMDLG - Font Dialog
4 * Copyright 1994 Martin Ayotte
5 * Copyright 1996 Albrecht Kleine
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #include "wine/winbase16.h"
33 #include "wine/winuser16.h"
37 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(commdlg
);
45 static HBITMAP hBitmapTT
= 0;
48 INT_PTR CALLBACK
FormatCharDlgProcA(HWND hDlg
, UINT uMsg
, WPARAM wParam
,
50 INT_PTR CALLBACK
FormatCharDlgProcW(HWND hDlg
, UINT uMsg
, WPARAM wParam
,
52 BOOL16 CALLBACK
FormatCharDlgProc16(HWND16 hDlg
, UINT16 message
, WPARAM16 wParam
,
55 /* There is a table here of all charsets, and the sample text for each.
56 * There is a second table that translates a charset into an index into
60 #define CI(cs) ((IDS_CHARSET_##cs)-IDS_CHARSET_ANSI)
63 static const WCHAR stWestern
[]={'A','a','B','b','Y','y','Z','z',0}; /* Western and default */
64 static const WCHAR stSymbol
[]={'S','y','m','b','o','l',0}; /* Symbol */
65 static const WCHAR stShiftJis
[]={'A','a',0x3042,0x3041,0x30a2,0x30a1,0x4e9c,0x5b87,0}; /* Shift JIS */
66 static const WCHAR stHangul
[]={0xac00,0xb098,0xb2e4,'A','a','B','Y','y','Z','z',0}; /* Hangul */
67 static const WCHAR stGB2312
[]={0x5fae,0x8f6f,0x4e2d,0x6587,0x8f6f,0x4ef6,0}; /* GB2312 */
68 static const WCHAR stBIG5
[]={0x4e2d,0x6587,0x5b57,0x578b,0x7bc4,0x4f8b,0}; /* BIG5 */
69 static const WCHAR stGreek
[]={'A','a','B','b',0x0391,0x03b1,0x0392,0x03b2,0}; /* Greek */
70 static const WCHAR stTurkish
[]={'A','a','B','b',0x011e,0x011f,0x015e,0x015f,0}; /* Turkish */
71 static const WCHAR stHebrew
[]={'A','a','B','b',0x05e0,0x05e1,0x05e9,0x05ea,0}; /* Hebrew */
72 static const WCHAR stArabic
[]={'A','a','B','b',0x0627,0x0628,0x062c,0x062f,0x0647,0x0648,0x0632,0};/* Arabic */
73 static const WCHAR stBaltic
[]={'A','a','B','b','Y','y','Z','z',0}; /* Baltic */
74 static const WCHAR stVietname
[]={'A','a','B','b',0x01a0,0x01a1,0x01af,0x01b0,0}; /* Vietnamese */
75 static const WCHAR stCyrillic
[]={'A','a','B','b',0x0411,0x0431,0x0424,0x0444,0}; /* Cyrillic */
76 static const WCHAR stEastEur
[]={'A','a','B','b',0xc1,0xe1,0xd4,0xf4,0}; /* East European */
77 static const WCHAR stThai
[]={'A','a','B','b',0x0e2d,0x0e31,0x0e01,0x0e29,0x0e23,0x0e44,0x0e17,0x0e22,0}; /* Thai */
78 static const WCHAR stJohab
[]={0xac00,0xb098,0xb2e4,'A','a','B','Y','y','Z','z',0}; /* Johab */
79 static const WCHAR stMac
[]={'A','a','B','b','Y','y','Z','z',0}; /* Mac */
80 static const WCHAR stOEM
[]={'A','a','B','b',0xf8,0xf1,0xfd,0}; /* OEM */
81 /* the following character sets actually behave different (Win2K observation):
82 * the sample string is 'sticky': it uses the sample string of the previous
83 * selected character set. That behaviour looks like some default, which is
84 * not (yet) implemented. */
85 static const WCHAR stVISCII
[]={'A','a','B','b',0}; /* VISCII */
86 static const WCHAR stTCVN
[]={'A','a','B','b',0}; /* TCVN */
87 static const WCHAR stKOI8
[]={'A','a','B','b',0}; /* KOI-8 */
88 static const WCHAR stIso88593
[]={'A','a','B','b',0}; /* ISO-8859-3 */
89 static const WCHAR stIso88594
[]={'A','a','B','b',0}; /* ISO-8859-4 */
90 static const WCHAR stIso885910
[]={'A','a','B','b',0}; /* ISO-8859-10 */
91 static const WCHAR stCeltic
[]={'A','a','B','b',0};/* Celtic */
93 static const WCHAR
*sample_lang_text
[]={
94 stWestern
,stSymbol
,stShiftJis
,stHangul
,stGB2312
,
95 stBIG5
,stGreek
,stTurkish
,stHebrew
,stArabic
,
96 stBaltic
,stVietname
,stCyrillic
,stEastEur
,stThai
,
97 stJohab
,stMac
,stOEM
,stVISCII
,stTCVN
,
98 stKOI8
,stIso88593
,stIso88594
,stIso885910
,stCeltic
};
101 static const int CHARSET_ORDER
[256]={
102 CI(ANSI
), 0, CI(SYMBOL
), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
103 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
104 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
105 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(MAC
), 0, 0,
107 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
108 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
109 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
110 CI(JIS
), CI(HANGUL
), CI(JOHAB
), 0, 0, 0, CI(GB2312
), 0, CI(BIG5
), 0, 0, 0, 0, 0, 0, 0,
111 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
112 0, CI(GREEK
), CI(TURKISH
), CI(VIETNAMESE
), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
113 0, CI(HEBREW
), CI(ARABIC
), 0, 0, 0, 0, 0, 0, 0, CI(BALTIC
), 0, 0, 0, 0, 0,
114 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(RUSSIAN
), 0, 0, 0,
115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(THAI
), 0,
116 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(EE
), 0,
117 CI(VISCII
), CI(TCVN
), CI(KOI8
), CI(ISO3
), CI(ISO4
), CI(ISO10
), CI(CELTIC
), 0, 0, 0, 0, 0, 0, 0, 0, CI(OEM
),
124 #define XX(x) { x, #x },
129 XX(CF_ENABLETEMPLATE
)
130 XX(CF_ENABLETEMPLATEHANDLE
)
131 XX(CF_INITTOLOGFONTSTRUCT
)
139 XX(CF_FIXEDPITCHONLY
)
141 XX(CF_FORCEFONTEXIST
)
154 void _dump_cf_flags(DWORD cflags
)
158 for (i
=0;cfflags
[i
].name
;i
++)
159 if (cfflags
[i
].mask
& cflags
)
160 MESSAGE("%s|",cfflags
[i
].name
);
164 /***********************************************************************
165 * ChooseFontA (COMDLG32.@)
167 BOOL WINAPI
ChooseFontA(LPCHOOSEFONTA lpChFont
)
174 if ( (lpChFont
->Flags
&CF_ENABLETEMPLATEHANDLE
)!=0 )
176 template=(LPCVOID
)lpChFont
->hInstance
;
179 if ( (lpChFont
->Flags
&CF_ENABLETEMPLATE
)!=0 )
181 hDlginst
=lpChFont
->hInstance
;
182 if( !(hResInfo
= FindResourceA(hDlginst
, lpChFont
->lpTemplateName
,
185 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE
);
190 hDlginst
=COMDLG32_hInstance
;
191 if (!(hResInfo
= FindResourceA(hDlginst
, "CHOOSE_FONT", (LPSTR
)RT_DIALOG
)))
193 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE
);
197 if (!(hDlgTmpl
= LoadResource(hDlginst
, hResInfo
)) ||
198 !(template = LockResource( hDlgTmpl
)))
200 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE
);
204 if (TRACE_ON(commdlg
))
205 _dump_cf_flags(lpChFont
->Flags
);
207 if (lpChFont
->Flags
& (CF_SELECTSCRIPT
| CF_NOVERTFONTS
))
208 FIXME(": unimplemented flag (ignored)\n");
210 return DialogBoxIndirectParamA(COMDLG32_hInstance
, template,
211 lpChFont
->hwndOwner
, FormatCharDlgProcA
, (LPARAM
)lpChFont
);
214 /***********************************************************************
215 * ChooseFontW (COMDLG32.@)
219 * The LOGFONT conversion functions will break if the structure ever
220 * grows beyond the lfFaceName element.
222 * The CHOOSEFONT conversion functions assume that both versions of
223 * lpLogFont and lpszStyle (if used) point to pre-allocated objects.
225 * The ASCII version of lpTemplateName is created by ChooseFontAtoW
226 * and freed by ChooseFontWtoA.
228 inline static VOID
LogFontWtoA(const LOGFONTW
*lfw
, LOGFONTA
*lfa
)
230 memcpy(lfa
, lfw
, sizeof(LOGFONTA
));
231 WideCharToMultiByte(CP_ACP
, 0, lfw
->lfFaceName
, -1, lfa
->lfFaceName
,
232 LF_FACESIZE
, NULL
, NULL
);
233 lfa
->lfFaceName
[LF_FACESIZE
- 1] = '\0';
236 inline static VOID
LogFontAtoW(const LOGFONTA
*lfa
, LOGFONTW
*lfw
)
238 memcpy(lfw
, lfa
, sizeof(LOGFONTA
));
239 MultiByteToWideChar(CP_ACP
, 0, lfa
->lfFaceName
, -1, lfw
->lfFaceName
,
241 lfw
->lfFaceName
[LF_FACESIZE
- 1] = 0;
244 static BOOL
ChooseFontWtoA(const CHOOSEFONTW
*cfw
, CHOOSEFONTA
*cfa
)
246 LOGFONTA
*lpLogFont
= cfa
->lpLogFont
;
247 LPSTR lpszStyle
= cfa
->lpszStyle
;
249 memcpy(cfa
, cfw
, sizeof(CHOOSEFONTA
));
250 cfa
->lpLogFont
= lpLogFont
;
251 cfa
->lpszStyle
= lpszStyle
;
253 LogFontWtoA(cfw
->lpLogFont
, lpLogFont
);
255 if ((cfw
->Flags
&CF_ENABLETEMPLATE
)!=0 && HIWORD(cfw
->lpTemplateName
)!=0)
257 cfa
->lpTemplateName
= HEAP_strdupWtoA(GetProcessHeap(), 0,
258 cfw
->lpTemplateName
);
259 if (cfa
->lpTemplateName
== NULL
)
263 if ((cfw
->Flags
& CF_USESTYLE
) != 0 && cfw
->lpszStyle
!= NULL
)
265 WideCharToMultiByte(CP_ACP
, 0, cfw
->lpszStyle
, -1, cfa
->lpszStyle
,
266 LF_FACESIZE
, NULL
, NULL
);
267 cfa
->lpszStyle
[LF_FACESIZE
- 1] = '\0';
273 static VOID
ChooseFontAtoW(const CHOOSEFONTA
*cfa
, CHOOSEFONTW
*cfw
)
275 LOGFONTW
*lpLogFont
= cfw
->lpLogFont
;
276 LPWSTR lpszStyle
= cfw
->lpszStyle
;
277 LPCWSTR lpTemplateName
= cfw
->lpTemplateName
;
279 memcpy(cfw
, cfa
, sizeof(CHOOSEFONTA
));
280 cfw
->lpLogFont
= lpLogFont
;
281 cfw
->lpszStyle
= lpszStyle
;
282 cfw
->lpTemplateName
= lpTemplateName
;
284 LogFontAtoW(cfa
->lpLogFont
, lpLogFont
);
286 if ((cfa
->Flags
&CF_ENABLETEMPLATE
)!=0 && HIWORD(cfa
->lpTemplateName
) != 0)
287 HeapFree(GetProcessHeap(), 0, (LPSTR
)(cfa
->lpTemplateName
));
289 if ((cfa
->Flags
& CF_USESTYLE
) != 0 && cfa
->lpszStyle
!= NULL
)
291 MultiByteToWideChar(CP_ACP
, 0, cfa
->lpszStyle
, -1, cfw
->lpszStyle
,
293 cfw
->lpszStyle
[LF_FACESIZE
- 1] = 0;
297 BOOL WINAPI
ChooseFontW(LPCHOOSEFONTW lpChFont
)
301 CHAR style_a
[LF_FACESIZE
];
303 cf_a
.lpLogFont
= &lf_a
;
304 cf_a
.lpszStyle
= style_a
;
306 if (ChooseFontWtoA(lpChFont
, &cf_a
) == FALSE
)
308 COMDLG32_SetCommDlgExtendedError(CDERR_MEMALLOCFAILURE
);
312 if (ChooseFontA(&cf_a
) == FALSE
)
314 if (cf_a
.lpTemplateName
!= NULL
)
315 HeapFree(GetProcessHeap(), 0, (LPSTR
)(cf_a
.lpTemplateName
));
319 ChooseFontAtoW(&cf_a
, lpChFont
);
325 /***********************************************************************
326 * ChooseFontW (COMDLG32.@)
328 BOOL WINAPI
ChooseFontW(LPCHOOSEFONTW lpChFont
)
334 HANDLE hResInfo
, hDlgTmpl
;
336 if (TRACE_ON(commdlg
))
337 _dump_cf_flags(lpChFont
->Flags
);
339 if (!(hResInfo
= FindResourceA(COMDLG32_hInstance
, "CHOOSE_FONT", (LPSTR
)RT_DIALOG
)))
341 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE
);
344 if (!(hDlgTmpl
= LoadResource(COMDLG32_hInstance
, hResInfo
)) ||
345 !(template = LockResource( hDlgTmpl
)))
347 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE
);
351 if (lpChFont
->Flags
& (CF_SELECTSCRIPT
| CF_NOVERTFONTS
| CF_ENABLETEMPLATE
|
352 CF_ENABLETEMPLATEHANDLE
)) FIXME(": unimplemented flag (ignored)\n");
353 memcpy(&cf32a
, lpChFont
, sizeof(cf32a
));
354 memcpy(&lf32a
, lpChFont
->lpLogFont
, sizeof(LOGFONTA
));
356 WideCharToMultiByte( CP_ACP
, 0, lpChFont
->lpLogFont
->lfFaceName
, -1,
357 lf32a
.lfFaceName
, LF_FACESIZE
, NULL
, NULL
);
358 lf32a
.lfFaceName
[LF_FACESIZE
-1] = 0;
359 cf32a
.lpLogFont
=&lf32a
;
360 cf32a
.lpszStyle
=HEAP_strdupWtoA(GetProcessHeap(), 0, lpChFont
->lpszStyle
);
361 lpChFont
->lpTemplateName
=(LPWSTR
)&cf32a
;
362 bRet
= DialogBoxIndirectParamW(COMDLG32_hInstance
, template,
363 lpChFont
->hwndOwner
, FormatCharDlgProcW
, (LPARAM
)lpChFont
);
364 HeapFree(GetProcessHeap(), 0, cf32a
.lpszStyle
);
365 lpChFont
->lpTemplateName
=(LPWSTR
)cf32a
.lpTemplateName
;
366 memcpy(lpChFont
->lpLogFont
, &lf32a
, sizeof(CHOOSEFONTA
));
367 MultiByteToWideChar( CP_ACP
, 0, lf32a
.lfFaceName
, -1,
368 lpChFont
->lpLogFont
->lfFaceName
, LF_FACESIZE
);
369 lpChFont
->lpLogFont
->lfFaceName
[LF_FACESIZE
-1] = 0;
374 #define TEXT_EXTRAS 4
375 #define TEXT_COLORS 16
377 static const COLORREF textcolors
[TEXT_COLORS
]=
379 0x00000000L
,0x00000080L
,0x00008000L
,0x00008080L
,
380 0x00800000L
,0x00800080L
,0x00808000L
,0x00808080L
,
381 0x00c0c0c0L
,0x000000ffL
,0x0000ff00L
,0x0000ffffL
,
382 0x00ff0000L
,0x00ff00ffL
,0x00ffff00L
,0x00FFFFFFL
385 /***********************************************************************
386 * CFn_HookCallChk32 [internal]
388 static BOOL
CFn_HookCallChk32(LPCHOOSEFONTA lpcf
)
391 if(lpcf
->Flags
& CF_ENABLEHOOK
)
397 /*************************************************************************
398 * AddFontFamily [internal]
400 INT
AddFontFamily(const LOGFONTA
*lplf
, UINT nFontType
,
401 LPCHOOSEFONTA lpcf
, HWND hwnd
, LPCFn_ENUMSTRUCT e
)
406 TRACE("font=%s (nFontType=%d)\n", lplf
->lfFaceName
,nFontType
);
408 if (lpcf
->Flags
& CF_FIXEDPITCHONLY
)
409 if (!(lplf
->lfPitchAndFamily
& FIXED_PITCH
))
411 if (lpcf
->Flags
& CF_ANSIONLY
)
412 if (lplf
->lfCharSet
!= ANSI_CHARSET
)
414 if (lpcf
->Flags
& CF_TTONLY
)
415 if (!(nFontType
& TRUETYPE_FONTTYPE
))
420 i
=SendMessageA(hwnd
, CB_FINDSTRINGEXACT
, 0, (LPARAM
)lplf
->lfFaceName
);
422 i
= SendMessageA(hwnd
, CB_ADDSTRING
, 0, (LPARAM
)lplf
->lfFaceName
);
424 w
=(lplf
->lfCharSet
<< 8) | lplf
->lfPitchAndFamily
;
425 /* store some important font information */
426 SendMessageA(hwnd
, CB_SETITEMDATA
, i
, MAKELONG(nFontType
,w
));
432 /*************************************************************************
433 * FontFamilyEnumProc32 [internal]
435 static INT WINAPI
FontFamilyEnumProc(const LOGFONTA
*lpLogFont
,
436 const TEXTMETRICA
*metrics
, DWORD dwFontType
, LPARAM lParam
)
439 e
=(LPCFn_ENUMSTRUCT
)lParam
;
440 return AddFontFamily(lpLogFont
, dwFontType
, e
->lpcf32a
, e
->hWnd1
, e
);
443 /*************************************************************************
444 * SetFontStylesToCombo2 [internal]
446 * Fill font style information into combobox (without using font.c directly)
448 static int SetFontStylesToCombo2(HWND hwnd
, HDC hdc
, const LOGFONTA
*lplf
)
457 static struct FONTSTYLE fontstyles
[FSTYLES
]={
458 { 0,FW_NORMAL
,"Regular"}, { 1,FW_NORMAL
,"Italic"},
459 { 0,FW_BOLD
,"Bold"}, { 1,FW_BOLD
,"Bold Italic"}
466 memcpy(&lf
, lplf
, sizeof(LOGFONTA
));
468 for (i
=0;i
<FSTYLES
;i
++)
470 lf
.lfItalic
=fontstyles
[i
].italic
;
471 lf
.lfWeight
=fontstyles
[i
].weight
;
472 hf
=CreateFontIndirectA(&lf
);
473 hf
=SelectObject(hdc
,hf
);
474 GetTextMetricsA(hdc
,&tm
);
475 hf
=SelectObject(hdc
,hf
);
477 /* font successful created ? */
478 if (tm
.tmWeight
==fontstyles
[i
].weight
&&
479 ((tm
.tmItalic
!= 0)==fontstyles
[i
].italic
))
481 j
=SendMessageA(hwnd
,CB_ADDSTRING
,0,(LPARAM
)fontstyles
[i
].stname
);
482 if (j
==CB_ERR
) return 1;
483 j
=SendMessageA(hwnd
, CB_SETITEMDATA
, j
,
484 MAKELONG(fontstyles
[i
].weight
,fontstyles
[i
].italic
));
485 if (j
==CB_ERR
) return 1;
491 /*************************************************************************
492 * AddFontSizeToCombo3 [internal]
494 static int AddFontSizeToCombo3(HWND hwnd
, UINT h
, LPCHOOSEFONTA lpcf
)
499 if ( (!(lpcf
->Flags
& CF_LIMITSIZE
)) ||
500 ((lpcf
->Flags
& CF_LIMITSIZE
) && (h
>= lpcf
->nSizeMin
) && (h
<= lpcf
->nSizeMax
)))
502 sprintf(buffer
, "%2d", h
);
503 j
=SendMessageA(hwnd
, CB_FINDSTRINGEXACT
, -1, (LPARAM
)buffer
);
506 j
=SendMessageA(hwnd
, CB_ADDSTRING
, 0, (LPARAM
)buffer
);
507 if (j
!=CB_ERR
) j
= SendMessageA(hwnd
, CB_SETITEMDATA
, j
, h
);
508 if (j
==CB_ERR
) return 1;
514 /*************************************************************************
515 * SetFontSizesToCombo3 [internal]
517 static int SetFontSizesToCombo3(HWND hwnd
, LPCHOOSEFONTA lpcf
)
519 static const int sizes
[]={8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72,0};
522 for (i
=0; sizes
[i
]; i
++)
523 if (AddFontSizeToCombo3(hwnd
, sizes
[i
], lpcf
)) return 1;
527 /***********************************************************************
528 * AddFontStyle [internal]
530 INT
AddFontStyle( const ENUMLOGFONTEXA
*lpElfex
, UINT nFontType
,
531 LPCHOOSEFONTA lpcf
, HWND hcmb2
, HWND hcmb3
, HWND hDlg
,
535 const LOGFONTA
*lplf
= &(lpElfex
->elfLogFont
);
538 TRACE("(nFontType=%d)\n",nFontType
);
539 TRACE(" %s h=%ld w=%ld e=%ld o=%ld wg=%ld i=%d u=%d s=%d"
540 " ch=%d op=%d cp=%d q=%d pf=%xh\n",
541 lplf
->lfFaceName
,lplf
->lfHeight
,lplf
->lfWidth
,
542 lplf
->lfEscapement
,lplf
->lfOrientation
,
543 lplf
->lfWeight
,lplf
->lfItalic
,lplf
->lfUnderline
,
544 lplf
->lfStrikeOut
,lplf
->lfCharSet
, lplf
->lfOutPrecision
,
545 lplf
->lfClipPrecision
,lplf
->lfQuality
, lplf
->lfPitchAndFamily
);
546 if (nFontType
& RASTER_FONTTYPE
)
548 if (AddFontSizeToCombo3(hcmb3
, lplf
->lfHeight
, lpcf
)) return 0;
549 } else if (SetFontSizesToCombo3(hcmb3
, lpcf
)) return 0;
551 if (!SendMessageA(hcmb2
, CB_GETCOUNT
, 0, 0))
553 HDC hdc
= ((lpcf
->Flags
& CF_PRINTERFONTS
) && lpcf
->hDC
) ? lpcf
->hDC
: GetDC(hDlg
);
554 i
=SetFontStylesToCombo2(hcmb2
,hdc
,lplf
);
555 if (!((lpcf
->Flags
& CF_PRINTERFONTS
) && lpcf
->hDC
))
560 if( iswin16
|| !( hcmb5
= GetDlgItem(hDlg
, cmb5
))) return 1;
561 i
= SendMessageA( hcmb5
, CB_FINDSTRINGEXACT
, 0,
562 (LPARAM
)lpElfex
->elfScript
);
564 i
= SendMessageA( hcmb5
, CB_ADDSTRING
, 0,
565 (LPARAM
)lpElfex
->elfScript
);
567 SendMessageA( hcmb5
, CB_SETITEMDATA
, i
, lplf
->lfCharSet
);
572 static INT
CFn_FitFontSize( HWND hDlg
, int points
)
576 /* look for fitting font size in combobox3 */
577 n
=SendDlgItemMessageA(hDlg
, cmb3
, CB_GETCOUNT
, 0, 0);
580 if (points
== (int)SendDlgItemMessageA
581 (hDlg
,cmb3
, CB_GETITEMDATA
,i
,0))
583 SendDlgItemMessageA(hDlg
,cmb3
,CB_SETCURSEL
,i
,0);
584 SendMessageA(hDlg
, WM_COMMAND
,
585 MAKEWPARAM(cmb3
, CBN_SELCHANGE
),
586 (LPARAM
)GetDlgItem(hDlg
,cmb3
));
594 static INT
CFn_FitFontStyle( HWND hDlg
, LONG packedstyle
)
598 /* look for fitting font style in combobox2 */
599 for (i
=0;i
<TEXT_EXTRAS
;i
++)
601 id
=SendDlgItemMessageA(hDlg
, cmb2
, CB_GETITEMDATA
, i
, 0);
602 if (packedstyle
== id
)
604 SendDlgItemMessageA(hDlg
, cmb2
, CB_SETCURSEL
, i
, 0);
605 SendMessageA(hDlg
, WM_COMMAND
, MAKEWPARAM(cmb2
, CBN_SELCHANGE
),
606 (LPARAM
)GetDlgItem(hDlg
,cmb2
));
615 static INT
CFn_FitCharSet( HWND hDlg
, int charset
)
618 /* look for fitting char set in combobox5 */
619 n
=SendDlgItemMessageA(hDlg
, cmb5
, CB_GETCOUNT
, 0, 0);
622 cs
=SendDlgItemMessageA(hDlg
, cmb5
, CB_GETITEMDATA
, i
, 0);
625 SendDlgItemMessageA(hDlg
, cmb5
, CB_SETCURSEL
, i
, 0);
626 SendMessageA(hDlg
, WM_COMMAND
, MAKEWPARAM(cmb5
, CBN_SELCHANGE
),
627 (LPARAM
)GetDlgItem(hDlg
,cmb2
));
631 /* no charset fits: select the first one in the list */
632 SendDlgItemMessageA(hDlg
, cmb5
, CB_SETCURSEL
, 0, 0);
633 SendMessageA(hDlg
, WM_COMMAND
, MAKEWPARAM(cmb5
, CBN_SELCHANGE
),
634 (LPARAM
)GetDlgItem(hDlg
,cmb2
));
638 /***********************************************************************
639 * FontStyleEnumProc32 [internal]
641 static INT WINAPI
FontStyleEnumProc( const ENUMLOGFONTEXA
*lpElfex
,
642 const TEXTMETRICA
*metrics
, DWORD dwFontType
, LPARAM lParam
)
644 LPCFn_ENUMSTRUCT s
=(LPCFn_ENUMSTRUCT
)lParam
;
647 HWND hDlg
=GetParent(hcmb3
);
648 return AddFontStyle( lpElfex
, dwFontType
, s
->lpcf32a
,
649 hcmb2
, hcmb3
, hDlg
, FALSE
);
652 /***********************************************************************
653 * CFn_WMInitDialog [internal]
655 LRESULT
CFn_WMInitDialog(HWND hDlg
, WPARAM wParam
, LPARAM lParam
,
662 HCURSOR hcursor
=SetCursor(LoadCursorA(0,(LPSTR
)IDC_WAIT
));
664 SetWindowLongA(hDlg
, DWL_USER
, lParam
);
665 lpxx
=lpcf
->lpLogFont
;
666 TRACE("WM_INITDIALOG lParam=%08lX\n", lParam
);
668 if (lpcf
->lStructSize
!= sizeof(CHOOSEFONTA
))
670 ERR("structure size failure !!!\n");
675 hBitmapTT
= LoadBitmapA(0, MAKEINTRESOURCEA(OBM_TRTYPE
));
677 if (!(lpcf
->Flags
& CF_SHOWHELP
) || !IsWindow(lpcf
->hwndOwner
))
678 ShowWindow(GetDlgItem(hDlg
,pshHelp
),SW_HIDE
);
679 if (!(lpcf
->Flags
& CF_APPLY
))
680 ShowWindow(GetDlgItem(hDlg
,psh3
),SW_HIDE
);
681 if (lpcf
->Flags
& CF_EFFECTS
)
683 for (i
=0;i
<TEXT_COLORS
;i
++)
687 if( LoadStringA(COMDLG32_hInstance
, IDS_COLOR_BLACK
+i
, name
,
688 sizeof(name
)/sizeof(*name
) )==0 )
690 strcpy( name
, "[color name]" );
692 j
=SendDlgItemMessageA(hDlg
, cmb4
, CB_ADDSTRING
, 0, (LPARAM
)name
);
693 SendDlgItemMessageA(hDlg
, cmb4
, CB_SETITEMDATA16
, j
, textcolors
[j
]);
694 /* look for a fitting value in color combobox */
695 if (textcolors
[j
]==lpcf
->rgbColors
)
696 SendDlgItemMessageA(hDlg
,cmb4
, CB_SETCURSEL
,j
,0);
701 ShowWindow(GetDlgItem(hDlg
,cmb4
),SW_HIDE
);
702 ShowWindow(GetDlgItem(hDlg
,chx1
),SW_HIDE
);
703 ShowWindow(GetDlgItem(hDlg
,chx2
),SW_HIDE
);
704 ShowWindow(GetDlgItem(hDlg
,grp1
),SW_HIDE
);
705 ShowWindow(GetDlgItem(hDlg
,stc4
),SW_HIDE
);
707 hdc
= ((lpcf
->Flags
& CF_PRINTERFONTS
) && lpcf
->hDC
) ? lpcf
->hDC
: GetDC(hDlg
);
711 s
.hWnd1
=GetDlgItem(hDlg
,cmb1
);
715 if (!EnumFontFamiliesA(hdc
, NULL
, FontFamilyEnumProc
, (LPARAM
)&s
)) {
716 TRACE("EnumFontFamilies returns 0\n");
720 if (lpcf
->Flags
& CF_FIXEDPITCHONLY
) {
721 FIXME("No font found with fixed pitch only, dropping flag.\n");
722 lpcf
->Flags
&= ~CF_FIXEDPITCHONLY
;
725 if (lpcf
->Flags
& CF_TTONLY
) {
726 FIXME("No font found with truetype only, dropping flag.\n");
727 lpcf
->Flags
&= ~CF_TTONLY
;
734 if (lpcf
->Flags
& CF_INITTOLOGFONTSTRUCT
)
736 /* look for fitting font name in combobox1 */
737 j
=SendDlgItemMessageA(hDlg
,cmb1
,CB_FINDSTRING
,-1,(LONG
)lpxx
->lfFaceName
);
740 INT height
= lpxx
->lfHeight
< 0 ? -lpxx
->lfHeight
:
742 int charset
= lpxx
->lfCharSet
;
743 pstyle
= MAKELONG(lpxx
->lfWeight
> FW_MEDIUM
? FW_BOLD
:
744 FW_NORMAL
,lpxx
->lfItalic
!=0);
745 SendDlgItemMessageA(hDlg
, cmb1
, CB_SETCURSEL
, j
, 0);
746 SendMessageA(hDlg
, WM_COMMAND
, MAKEWPARAM(cmb1
, CBN_SELCHANGE
),
747 (LPARAM
)GetDlgItem(hDlg
,cmb1
));
749 /* look for fitting font style in combobox2 */
750 CFn_FitFontStyle(hDlg
, pstyle
);
751 /* look for fitting font size in combobox3 */
752 CFn_FitFontSize(hDlg
, height
);
753 CFn_FitCharSet( hDlg
, charset
);
758 SendDlgItemMessageA(hDlg
,cmb1
,CB_SETCURSEL
,0,0);
759 SendMessageA(hDlg
, WM_COMMAND
, MAKEWPARAM(cmb1
, CBN_SELCHANGE
),
760 (LPARAM
)GetDlgItem(hDlg
,cmb1
));
762 if (lpcf
->Flags
& CF_USESTYLE
&& lpcf
->lpszStyle
)
764 j
=SendDlgItemMessageA(hDlg
,cmb2
,CB_FINDSTRING
,-1,(LONG
)lpcf
->lpszStyle
);
767 j
=SendDlgItemMessageA(hDlg
,cmb2
,CB_SETCURSEL
,j
,0);
768 SendMessageA(hDlg
,WM_COMMAND
,cmb2
,
769 MAKELONG(HWND_16(GetDlgItem(hDlg
,cmb2
)),CBN_SELCHANGE
));
775 WARN("HDC failure !!!\n");
780 if (!((lpcf
->Flags
& CF_PRINTERFONTS
) && lpcf
->hDC
))
787 /***********************************************************************
788 * CFn_WMMeasureItem [internal]
790 LRESULT
CFn_WMMeasureItem(HWND hDlg
, WPARAM wParam
, LPARAM lParam
)
793 LPMEASUREITEMSTRUCT lpmi
=(LPMEASUREITEMSTRUCT
)lParam
;
795 hBitmapTT
= LoadBitmapA(0, MAKEINTRESOURCEA(OBM_TRTYPE
));
796 GetObjectA( hBitmapTT
, sizeof(bm
), &bm
);
797 lpmi
->itemHeight
=bm
.bmHeight
;
798 /* FIXME: use MAX of bm.bmHeight and tm.tmHeight .*/
803 /***********************************************************************
804 * CFn_WMDrawItem [internal]
806 LRESULT
CFn_WMDrawItem(HWND hDlg
, WPARAM wParam
, LPARAM lParam
)
811 COLORREF cr
, oldText
=0, oldBk
=0;
816 HBITMAP hBitmap
; /* for later TT usage */
818 LPDRAWITEMSTRUCT lpdi
= (LPDRAWITEMSTRUCT
)lParam
;
820 if (lpdi
->itemID
== (UINT
)-1) /* got no items */
821 DrawFocusRect(lpdi
->hDC
, &lpdi
->rcItem
);
824 if (lpdi
->CtlType
== ODT_COMBOBOX
)
826 if (lpdi
->itemState
& ODS_SELECTED
)
828 hBrush
=GetSysColorBrush(COLOR_HIGHLIGHT
);
829 oldText
=SetTextColor(lpdi
->hDC
, GetSysColor(COLOR_HIGHLIGHTTEXT
));
830 oldBk
=SetBkColor(lpdi
->hDC
, GetSysColor(COLOR_HIGHLIGHT
));
833 hBrush
= SelectObject(lpdi
->hDC
, GetStockObject(LTGRAY_BRUSH
));
834 SelectObject(lpdi
->hDC
, hBrush
);
836 FillRect(lpdi
->hDC
, &lpdi
->rcItem
, hBrush
);
839 return TRUE
; /* this should never happen */
845 /* TRACE(commdlg,"WM_Drawitem cmb1\n"); */
846 SendMessageA(lpdi
->hwndItem
, CB_GETLBTEXT
, lpdi
->itemID
,
848 GetObjectA( hBitmapTT
, sizeof(bm
), &bm
);
849 TextOutA(lpdi
->hDC
, lpdi
->rcItem
.left
+ bm
.bmWidth
+ 10,
850 lpdi
->rcItem
.top
, buffer
, strlen(buffer
));
852 nFontType
= SendMessageA(lpdi
->hwndItem
, CB_GETITEMDATA
, lpdi
->itemID
,0L);
853 /* FIXME: draw bitmap if truetype usage */
854 if (nFontType
&TRUETYPE_FONTTYPE
)
856 hMemDC
= CreateCompatibleDC(lpdi
->hDC
);
857 hBitmap
= SelectObject(hMemDC
, hBitmapTT
);
858 BitBlt(lpdi
->hDC
, lpdi
->rcItem
.left
, lpdi
->rcItem
.top
,
859 bm
.bmWidth
, bm
.bmHeight
, hMemDC
, 0, 0, SRCCOPY
);
860 SelectObject(hMemDC
, hBitmap
);
867 /* TRACE(commdlg,"WM_DRAWITEN cmb2,cmb3\n"); */
869 SendMessageA(lpdi
->hwndItem
, CB_GETLBTEXT
, lpdi
->itemID
,
871 TextOutA(lpdi
->hDC
, lpdi
->rcItem
.left
,
872 lpdi
->rcItem
.top
, buffer
, strlen(buffer
));
876 /* TRACE(commdlg,"WM_DRAWITEM cmb4 (=COLOR)\n"); */
877 SendMessageA(lpdi
->hwndItem
, CB_GETLBTEXT
, lpdi
->itemID
,
879 TextOutA(lpdi
->hDC
, lpdi
->rcItem
.left
+ 25+5,
880 lpdi
->rcItem
.top
, buffer
, strlen(buffer
));
881 cr
= SendMessageA(lpdi
->hwndItem
, CB_GETITEMDATA
, lpdi
->itemID
,0L);
882 hBrush
= CreateSolidBrush(cr
);
885 hBrush
= SelectObject (lpdi
->hDC
, hBrush
) ;
886 rect
.right
=rect
.left
+25;
890 Rectangle( lpdi
->hDC
, rect
.left
, rect
.top
,
891 rect
.right
, rect
.bottom
);
892 DeleteObject( SelectObject (lpdi
->hDC
, hBrush
)) ;
899 return TRUE
; /* this should never happen */
901 if (lpdi
->itemState
& ODS_SELECTED
)
903 SetTextColor(lpdi
->hDC
, oldText
);
904 SetBkColor(lpdi
->hDC
, oldBk
);
910 /***********************************************************************
911 * CFn_WMCommand [internal]
913 LRESULT
CFn_WMCommand(HWND hDlg
, WPARAM wParam
, LPARAM lParam
,
919 LPLOGFONTA lpxx
=lpcf
->lpLogFont
;
921 TRACE("WM_COMMAND wParam=%08lX lParam=%08lX\n", (LONG
)wParam
, lParam
);
922 switch (LOWORD(wParam
))
925 if (HIWORD(wParam
)==CBN_SELCHANGE
)
927 hdc
=((lpcf
->Flags
& CF_PRINTERFONTS
) && lpcf
->hDC
) ? lpcf
->hDC
: GetDC(hDlg
);
930 INT pointsize
; /* save current pointsize */
931 LONG pstyle
; /* save current style */
934 idx
= SendDlgItemMessageA(hDlg
, cmb3
, CB_GETCURSEL
, 0, 0);
935 pointsize
= (int)SendDlgItemMessageA( hDlg
, cmb3
, CB_GETITEMDATA
,
937 idx
= SendDlgItemMessageA(hDlg
, cmb2
, CB_GETCURSEL
, 0, 0);
938 pstyle
= SendDlgItemMessageA(hDlg
, cmb2
, CB_GETITEMDATA
, idx
, 0);
939 idx
= SendDlgItemMessageA(hDlg
, cmb5
, CB_GETCURSEL
, 0, 0);
940 charset
= SendDlgItemMessageA(hDlg
, cmb5
, CB_GETITEMDATA
, idx
, 0);
942 SendDlgItemMessageA(hDlg
, cmb2
, CB_RESETCONTENT
, 0, 0);
943 SendDlgItemMessageA(hDlg
, cmb3
, CB_RESETCONTENT
, 0, 0);
944 SendDlgItemMessageA(hDlg
, cmb5
, CB_RESETCONTENT
, 0, 0);
945 i
=SendDlgItemMessageA(hDlg
, cmb1
, CB_GETCURSEL
, 0, 0);
948 HCURSOR hcursor
=SetCursor(LoadCursorA(0,(LPSTR
)IDC_WAIT
));
951 SendDlgItemMessageA(hDlg
, cmb1
, CB_GETLBTEXT
, i
,
952 (LPARAM
)enumlf
.lfFaceName
);
953 TRACE("WM_COMMAND/cmb1 =>%s\n",enumlf
.lfFaceName
);
954 s
.hWnd1
=GetDlgItem(hDlg
, cmb2
);
955 s
.hWnd2
=GetDlgItem(hDlg
, cmb3
);
957 enumlf
.lfCharSet
= DEFAULT_CHARSET
; /* enum all charsets */
958 enumlf
.lfPitchAndFamily
= 0;
959 EnumFontFamiliesExA(hdc
, &enumlf
,
960 (FONTENUMPROCA
)FontStyleEnumProc
, (LPARAM
)&s
, 0);
961 CFn_FitFontStyle(hDlg
, pstyle
);
962 if( pointsize
!= CB_ERR
) CFn_FitFontSize(hDlg
, pointsize
);
963 if( charset
!= CB_ERR
) CFn_FitCharSet( hDlg
, charset
);
966 if (!((lpcf
->Flags
& CF_PRINTERFONTS
) && lpcf
->hDC
))
971 WARN("HDC failure !!!\n");
981 if (HIWORD(wParam
)==CBN_SELCHANGE
|| HIWORD(wParam
)== BN_CLICKED
)
986 TRACE("WM_COMMAND/cmb2,3 =%08lX\n", lParam
);
987 i
=SendDlgItemMessageA(hDlg
,cmb1
,CB_GETCURSEL
,0,0);
989 i
=GetDlgItemTextA( hDlg
, cmb1
, str
, 256 );
992 SendDlgItemMessageA(hDlg
,cmb1
,CB_GETLBTEXT
,i
,
994 l
=SendDlgItemMessageA(hDlg
,cmb1
,CB_GETITEMDATA
,i
,0);
996 lpcf
->nFontType
= LOWORD(l
);
997 /* FIXME: lpcf->nFontType |= .... SIMULATED_FONTTYPE and so */
998 /* same value reported to the EnumFonts
999 call back with the extra FONTTYPE_... bits added */
1000 lpxx
->lfPitchAndFamily
=j
&0xff;
1001 lpxx
->lfCharSet
=j
>>8;
1003 strcpy(lpxx
->lfFaceName
,str
);
1004 i
=SendDlgItemMessageA(hDlg
, cmb2
, CB_GETCURSEL
, 0, 0);
1007 l
=SendDlgItemMessageA(hDlg
, cmb2
, CB_GETITEMDATA
, i
, 0);
1008 if (0!=(lpxx
->lfItalic
=HIWORD(l
)))
1009 lpcf
->nFontType
|= ITALIC_FONTTYPE
;
1010 if ((lpxx
->lfWeight
=LOWORD(l
)) > FW_MEDIUM
)
1011 lpcf
->nFontType
|= BOLD_FONTTYPE
;
1013 i
=SendDlgItemMessageA(hDlg
, cmb3
, CB_GETCURSEL
, 0, 0);
1015 lpxx
->lfHeight
=-LOWORD(SendDlgItemMessageA(hDlg
, cmb3
, CB_GETITEMDATA
, i
, 0));
1018 i
=SendDlgItemMessageA(hDlg
, cmb5
, CB_GETCURSEL
, 0, 0);
1020 lpxx
->lfCharSet
=SendDlgItemMessageA(hDlg
, cmb5
, CB_GETITEMDATA
, i
, 0);
1021 lpxx
->lfStrikeOut
=IsDlgButtonChecked(hDlg
,chx1
);
1022 lpxx
->lfUnderline
=IsDlgButtonChecked(hDlg
,chx2
);
1023 lpxx
->lfWidth
=lpxx
->lfOrientation
=lpxx
->lfEscapement
=0;
1024 lpxx
->lfOutPrecision
=OUT_DEFAULT_PRECIS
;
1025 lpxx
->lfClipPrecision
=CLIP_DEFAULT_PRECIS
;
1026 lpxx
->lfQuality
=DEFAULT_QUALITY
;
1027 lpcf
->iPointSize
= -10*lpxx
->lfHeight
;
1029 wininfo
.cbSize
=sizeof(wininfo
);
1031 if( GetWindowInfo( GetDlgItem( hDlg
, stc5
), &wininfo
) )
1033 MapWindowPoints( 0, hDlg
, (LPPOINT
) &wininfo
.rcWindow
, 2);
1034 InvalidateRect( hDlg
, &wininfo
.rcWindow
, TRUE
);
1040 i
=SendDlgItemMessageA(hDlg
, cmb4
, CB_GETCURSEL
, 0, 0);
1045 lpcf
->rgbColors
=textcolors
[i
];
1046 wininfo
.cbSize
=sizeof(wininfo
);
1048 if( GetWindowInfo( GetDlgItem( hDlg
, stc5
), &wininfo
) )
1050 MapWindowPoints( 0, hDlg
, (LPPOINT
) &wininfo
.rcWindow
, 2);
1051 InvalidateRect( hDlg
, &wininfo
.rcWindow
, TRUE
);
1057 i
=RegisterWindowMessageA( HELPMSGSTRINGA
);
1058 if (lpcf
->hwndOwner
)
1059 SendMessageA(lpcf
->hwndOwner
, i
, 0, (LPARAM
)GetWindowLongA(hDlg
, DWL_USER
));
1060 /* if (CFn_HookCallChk(lpcf))
1061 CallWindowProc16(lpcf->lpfnHook,hDlg,WM_COMMAND,psh15,(LPARAM)lpcf);*/
1065 if ( (!(lpcf
->Flags
& CF_LIMITSIZE
)) ||
1066 ( (lpcf
->Flags
& CF_LIMITSIZE
) &&
1067 (-lpxx
->lfHeight
>= lpcf
->nSizeMin
) &&
1068 (-lpxx
->lfHeight
<= lpcf
->nSizeMax
)))
1069 EndDialog(hDlg
, TRUE
);
1073 sprintf(buffer
,"Select a font size between %d and %d points.",
1074 lpcf
->nSizeMin
,lpcf
->nSizeMax
);
1075 MessageBoxA(hDlg
, buffer
, NULL
, MB_OK
);
1079 EndDialog(hDlg
, FALSE
);
1085 LRESULT
CFn_WMDestroy(HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1090 LRESULT
CFn_WMPaint(HWND hDlg
, WPARAM wParam
, LPARAM lParam
,
1091 LPCHOOSEFONTA lpcf
)
1095 info
.cbSize
=sizeof(info
);
1097 if( GetWindowInfo( GetDlgItem( hDlg
, stc5
), &info
) )
1104 LOGFONTA lf
= *(lpcf
->lpLogFont
);
1106 MapWindowPoints( 0, hDlg
, (LPPOINT
) &info
.rcWindow
, 2);
1107 hdc
=BeginPaint( hDlg
, &ps
);
1110 MoveToEx( hdc
, info
.rcWindow
.left
, info
.rcWindow
.bottom
, NULL
);
1111 hOrigPen
=SelectObject( hdc
, CreatePen( PS_SOLID
, 2,
1112 GetSysColor( COLOR_3DSHADOW
) ));
1113 LineTo( hdc
, info
.rcWindow
.left
, info
.rcWindow
.top
);
1114 LineTo( hdc
, info
.rcWindow
.right
, info
.rcWindow
.top
);
1115 DeleteObject(SelectObject( hdc
, CreatePen( PS_SOLID
, 2,
1116 GetSysColor( COLOR_3DLIGHT
) )));
1117 LineTo( hdc
, info
.rcWindow
.right
, info
.rcWindow
.bottom
);
1118 LineTo( hdc
, info
.rcWindow
.left
, info
.rcWindow
.bottom
);
1119 DeleteObject(SelectObject( hdc
, hOrigPen
));
1121 /* Draw the sample text itself */
1122 info
.rcWindow
.right
--;
1123 info
.rcWindow
.bottom
--;
1124 info
.rcWindow
.top
++;
1125 info
.rcWindow
.left
++;
1126 lf
.lfHeight
= MulDiv(lf
.lfHeight
, GetDeviceCaps(hdc
, LOGPIXELSY
), 72);
1127 hOrigFont
= SelectObject( hdc
, CreateFontIndirectA( &lf
) );
1128 rgbPrev
=SetTextColor( hdc
, lpcf
->rgbColors
);
1131 sample_lang_text
[CHARSET_ORDER
[lpcf
->lpLogFont
->lfCharSet
]],
1132 -1, &info
.rcWindow
, DT_CENTER
|DT_VCENTER
|DT_SINGLELINE
);
1134 EndPaint( hDlg
, &ps
);
1140 /***********************************************************************
1141 * FormatCharDlgProcA [internal]
1143 INT_PTR CALLBACK
FormatCharDlgProcA(HWND hDlg
, UINT uMsg
, WPARAM wParam
,
1147 INT_PTR res
= FALSE
;
1148 if (uMsg
!=WM_INITDIALOG
)
1150 lpcf
=(LPCHOOSEFONTA
)GetWindowLongA(hDlg
, DWL_USER
);
1151 if (!lpcf
&& uMsg
!= WM_MEASUREITEM
)
1153 if (CFn_HookCallChk32(lpcf
))
1154 res
=CallWindowProcA((WNDPROC
)lpcf
->lpfnHook
, hDlg
, uMsg
, wParam
, lParam
);
1160 lpcf
=(LPCHOOSEFONTA
)lParam
;
1161 if (!CFn_WMInitDialog(hDlg
, wParam
, lParam
, lpcf
))
1163 TRACE("CFn_WMInitDialog returned FALSE\n");
1166 if (CFn_HookCallChk32(lpcf
))
1167 return CallWindowProcA((WNDPROC
)lpcf
->lpfnHook
,hDlg
,WM_INITDIALOG
,wParam
,lParam
);
1171 case WM_MEASUREITEM
:
1172 return CFn_WMMeasureItem(hDlg
, wParam
, lParam
);
1174 return CFn_WMDrawItem(hDlg
, wParam
, lParam
);
1176 return CFn_WMCommand(hDlg
, wParam
, lParam
, lpcf
);
1178 return CFn_WMDestroy(hDlg
, wParam
, lParam
);
1179 case WM_CHOOSEFONT_GETLOGFONT
:
1180 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n",
1182 FIXME("current logfont back to caller\n");
1185 return CFn_WMPaint(hDlg
, wParam
, lParam
, lpcf
);
1190 /***********************************************************************
1191 * FormatCharDlgProcW [internal]
1193 INT_PTR CALLBACK
FormatCharDlgProcW(HWND hDlg
, UINT uMsg
, WPARAM wParam
,
1196 LPCHOOSEFONTW lpcf32w
;
1197 LPCHOOSEFONTA lpcf32a
;
1198 INT_PTR res
= FALSE
;
1199 if (uMsg
!=WM_INITDIALOG
)
1201 lpcf32w
=(LPCHOOSEFONTW
)GetWindowLongA(hDlg
, DWL_USER
);
1204 if (CFn_HookCallChk32((LPCHOOSEFONTA
)lpcf32w
))
1205 res
=CallWindowProcW((WNDPROC
)lpcf32w
->lpfnHook
, hDlg
, uMsg
, wParam
, lParam
);
1211 lpcf32w
=(LPCHOOSEFONTW
)lParam
;
1212 lpcf32a
=(LPCHOOSEFONTA
)lpcf32w
->lpTemplateName
;
1213 if (!CFn_WMInitDialog(hDlg
, wParam
, lParam
, lpcf32a
))
1215 TRACE("CFn_WMInitDialog returned FALSE\n");
1218 if (CFn_HookCallChk32((LPCHOOSEFONTA
)lpcf32w
))
1219 return CallWindowProcW((WNDPROC
)lpcf32w
->lpfnHook
,hDlg
,WM_INITDIALOG
,wParam
,lParam
);
1221 lpcf32a
=(LPCHOOSEFONTA
)lpcf32w
->lpTemplateName
;
1224 case WM_MEASUREITEM
:
1225 return CFn_WMMeasureItem(hDlg
, wParam
, lParam
);
1227 return CFn_WMDrawItem(hDlg
, wParam
, lParam
);
1229 return CFn_WMCommand(hDlg
, wParam
, lParam
, lpcf32a
);
1231 return CFn_WMDestroy(hDlg
, wParam
, lParam
);
1232 case WM_CHOOSEFONT_GETLOGFONT
:
1233 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n",
1235 FIXME("current logfont back to caller\n");