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
30 #include "wine/winbase16.h"
31 #include "wine/winuser16.h"
35 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
42 static HBITMAP16 hBitmapTT = 0;
45 INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
47 INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam,
49 BOOL16 CALLBACK FormatCharDlgProc16(HWND16 hDlg, UINT16 message, WPARAM16 wParam,
52 static void FONT_LogFont16To32A( const LPLOGFONT16 font16, LPLOGFONTA font32 )
54 font32->lfHeight = font16->lfHeight;
55 font32->lfWidth = font16->lfWidth;
56 font32->lfEscapement = font16->lfEscapement;
57 font32->lfOrientation = font16->lfOrientation;
58 font32->lfWeight = font16->lfWeight;
59 font32->lfItalic = font16->lfItalic;
60 font32->lfUnderline = font16->lfUnderline;
61 font32->lfStrikeOut = font16->lfStrikeOut;
62 font32->lfCharSet = font16->lfCharSet;
63 font32->lfOutPrecision = font16->lfOutPrecision;
64 font32->lfClipPrecision = font16->lfClipPrecision;
65 font32->lfQuality = font16->lfQuality;
66 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
67 lstrcpynA( font32->lfFaceName, font16->lfFaceName, LF_FACESIZE );
70 static void CFn_CHOOSEFONT16to32A(LPCHOOSEFONT16 chf16, LPCHOOSEFONTA chf32a)
72 chf32a->lStructSize=sizeof(CHOOSEFONTA);
73 chf32a->hwndOwner=HWND_32(chf16->hwndOwner);
74 chf32a->hDC=chf16->hDC;
75 chf32a->iPointSize=chf16->iPointSize;
76 chf32a->Flags=chf16->Flags;
77 chf32a->rgbColors=chf16->rgbColors;
78 chf32a->lCustData=chf16->lCustData;
79 chf32a->lpfnHook=NULL;
80 chf32a->lpTemplateName=MapSL(chf16->lpTemplateName);
81 chf32a->hInstance=chf16->hInstance;
82 chf32a->lpszStyle=MapSL(chf16->lpszStyle);
83 chf32a->nFontType=chf16->nFontType;
84 chf32a->nSizeMax=chf16->nSizeMax;
85 chf32a->nSizeMin=chf16->nSizeMin;
86 FONT_LogFont16To32A(MapSL(chf16->lpLogFont), chf32a->lpLogFont);
93 #define XX(x) { x, #x },
99 XX(CF_ENABLETEMPLATEHANDLE)
100 XX(CF_INITTOLOGFONTSTRUCT)
108 XX(CF_FIXEDPITCHONLY)
110 XX(CF_FORCEFONTEXIST)
124 _dump_cf_flags(DWORD cflags) {
127 for (i=0;cfflags[i].name;i++)
128 if (cfflags[i].mask & cflags)
129 MESSAGE("%s|",cfflags[i].name);
134 /***********************************************************************
135 * ChooseFont (COMMDLG.15)
137 BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont)
140 HANDLE16 hDlgTmpl16 = 0, hResource16 = 0;
141 HGLOBAL16 hGlobal16 = 0;
148 SEGPTR lpTemplateName;
150 cf32a.lpLogFont=&lf32a;
151 CFn_CHOOSEFONT16to32A(lpChFont, &cf32a);
153 TRACE("ChooseFont\n");
154 if (!lpChFont) return FALSE;
156 if (TRACE_ON(commdlg))
157 _dump_cf_flags(lpChFont->Flags);
159 if (lpChFont->Flags & CF_ENABLETEMPLATEHANDLE)
161 if (!(template = LockResource16( lpChFont->hInstance )))
163 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
167 else if (lpChFont->Flags & CF_ENABLETEMPLATE)
170 if (!(hResInfo = FindResource16( lpChFont->hInstance,
171 MapSL(lpChFont->lpTemplateName),
174 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
177 if (!(hDlgTmpl16 = LoadResource16( lpChFont->hInstance, hResInfo )) ||
178 !(template = LockResource16( hDlgTmpl16 )))
180 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
190 if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, "CHOOSE_FONT", RT_DIALOGA)))
192 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
195 if (!(hDlgTmpl32 = LoadResource(COMMDLG_hInstance32, hResInfo)) ||
196 !(template32 = LockResource(hDlgTmpl32)))
198 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
201 size = SizeofResource(GetModuleHandleA("COMDLG32"), hResInfo);
202 hGlobal16 = GlobalAlloc16(0, size);
205 COMDLG32_SetCommDlgExtendedError(CDERR_MEMALLOCFAILURE);
206 ERR("alloc failure for %ld bytes\n", size);
209 template = GlobalLock16(hGlobal16);
212 COMDLG32_SetCommDlgExtendedError(CDERR_MEMLOCKFAILURE);
213 ERR("global lock failure for %x handle\n", hGlobal16);
214 GlobalFree16(hGlobal16);
217 ConvertDialog32To16((LPVOID)template32, size, (LPVOID)template);
218 hDlgTmpl16 = hGlobal16;
222 /* lpTemplateName is not used in the dialog */
223 lpTemplateName=lpChFont->lpTemplateName;
224 lpChFont->lpTemplateName=(SEGPTR)&cf32a;
226 ptr = GetProcAddress16(GetModuleHandle16("COMMDLG"), (LPCSTR) 16);
227 hInst = GetWindowLongA(HWND_32(lpChFont->hwndOwner), GWL_HINSTANCE);
228 bRet = DialogBoxIndirectParam16(hInst, hDlgTmpl16, lpChFont->hwndOwner,
229 (DLGPROC16) ptr, (DWORD)lpChFont);
230 if (hResource16) FreeResource16(hDlgTmpl16);
233 GlobalUnlock16(hGlobal16);
234 GlobalFree16(hGlobal16);
236 lpChFont->lpTemplateName=lpTemplateName;
239 font16 = MapSL(lpChFont->lpLogFont);
240 font16->lfHeight = cf32a.lpLogFont->lfHeight;
241 font16->lfWidth = cf32a.lpLogFont->lfWidth;
242 font16->lfEscapement = cf32a.lpLogFont->lfEscapement;
243 font16->lfOrientation = cf32a.lpLogFont->lfOrientation;
244 font16->lfWeight = cf32a.lpLogFont->lfWeight;
245 font16->lfItalic = cf32a.lpLogFont->lfItalic;
246 font16->lfUnderline = cf32a.lpLogFont->lfUnderline;
247 font16->lfStrikeOut = cf32a.lpLogFont->lfStrikeOut;
248 font16->lfCharSet = cf32a.lpLogFont->lfCharSet;
249 font16->lfOutPrecision = cf32a.lpLogFont->lfOutPrecision;
250 font16->lfClipPrecision = cf32a.lpLogFont->lfClipPrecision;
251 font16->lfQuality = cf32a.lpLogFont->lfQuality;
252 font16->lfPitchAndFamily = cf32a.lpLogFont->lfPitchAndFamily;
253 lstrcpynA( font16->lfFaceName, cf32a.lpLogFont->lfFaceName, LF_FACESIZE );
258 /***********************************************************************
259 * ChooseFontA (COMDLG32.@)
261 BOOL WINAPI ChooseFontA(LPCHOOSEFONTA lpChFont)
267 if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, "CHOOSE_FONT", RT_DIALOGA)))
269 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
272 if (!(hDlgTmpl = LoadResource(COMMDLG_hInstance32, hResInfo )) ||
273 !(template = LockResource( hDlgTmpl )))
275 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
278 if (TRACE_ON(commdlg))
279 _dump_cf_flags(lpChFont->Flags);
281 if (lpChFont->Flags & (CF_SELECTSCRIPT | CF_NOVERTFONTS | CF_ENABLETEMPLATE |
282 CF_ENABLETEMPLATEHANDLE)) FIXME(": unimplemented flag (ignored)\n");
283 return DialogBoxIndirectParamA(COMMDLG_hInstance32, template,
284 lpChFont->hwndOwner, FormatCharDlgProcA, (LPARAM)lpChFont );
287 /***********************************************************************
288 * ChooseFontW (COMDLG32.@)
292 * The LOGFONT conversion functions will break if the structure ever
293 * grows beyond the lfFaceName element.
295 * The CHOOSEFONT conversion functions assume that both versions of
296 * lpLogFont and lpszStyle (if used) point to pre-allocated objects.
298 * The ASCII version of lpTemplateName is created by ChooseFontAtoW
299 * and freed by ChooseFontWtoA.
301 inline static VOID LogFontWtoA(const LOGFONTW *lfw, LOGFONTA *lfa)
303 memcpy(lfa, lfw, sizeof(LOGFONTA));
304 WideCharToMultiByte(CP_ACP, 0, lfw->lfFaceName, -1, lfa->lfFaceName,
305 LF_FACESIZE, NULL, NULL);
306 lfa->lfFaceName[LF_FACESIZE - 1] = '\0';
309 inline static VOID LogFontAtoW(const LOGFONTA *lfa, LOGFONTW *lfw)
311 memcpy(lfw, lfa, sizeof(LOGFONTA));
312 MultiByteToWideChar(CP_ACP, 0, lfa->lfFaceName, -1, lfw->lfFaceName,
314 lfw->lfFaceName[LF_FACESIZE - 1] = 0;
317 static BOOL ChooseFontWtoA(const CHOOSEFONTW *cfw, CHOOSEFONTA *cfa)
319 LOGFONTA *lpLogFont = cfa->lpLogFont;
320 LPSTR lpszStyle = cfa->lpszStyle;
322 memcpy(cfa, cfw, sizeof(CHOOSEFONTA));
323 cfa->lpLogFont = lpLogFont;
324 cfa->lpszStyle = lpszStyle;
326 LogFontWtoA(cfw->lpLogFont, lpLogFont);
328 if ((cfw->Flags&CF_ENABLETEMPLATE)!=0 && HIWORD(cfw->lpTemplateName)!=0)
330 cfa->lpTemplateName = HEAP_strdupWtoA(GetProcessHeap(), 0,
331 cfw->lpTemplateName);
332 if (cfa->lpTemplateName == NULL)
336 if ((cfw->Flags & CF_USESTYLE) != 0 && cfw->lpszStyle != NULL)
338 WideCharToMultiByte(CP_ACP, 0, cfw->lpszStyle, -1, cfa->lpszStyle,
339 LF_FACESIZE, NULL, NULL);
340 cfa->lpszStyle[LF_FACESIZE - 1] = '\0';
346 static VOID ChooseFontAtoW(const CHOOSEFONTA *cfa, CHOOSEFONTW *cfw)
348 LOGFONTW *lpLogFont = cfw->lpLogFont;
349 LPWSTR lpszStyle = cfw->lpszStyle;
350 LPCWSTR lpTemplateName = cfw->lpTemplateName;
352 memcpy(cfw, cfa, sizeof(CHOOSEFONTA));
353 cfw->lpLogFont = lpLogFont;
354 cfw->lpszStyle = lpszStyle;
355 cfw->lpTemplateName = lpTemplateName;
357 LogFontAtoW(cfa->lpLogFont, lpLogFont);
359 if ((cfa->Flags&CF_ENABLETEMPLATE)!=0 && HIWORD(cfa->lpTemplateName) != 0)
360 HeapFree(GetProcessHeap(), 0, (LPSTR)(cfa->lpTemplateName));
362 if ((cfa->Flags & CF_USESTYLE) != 0 && cfa->lpszStyle != NULL)
364 MultiByteToWideChar(CP_ACP, 0, cfa->lpszStyle, -1, cfw->lpszStyle,
366 cfw->lpszStyle[LF_FACESIZE - 1] = 0;
370 BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont)
374 CHAR style_a[LF_FACESIZE];
376 cf_a.lpLogFont = &lf_a;
377 cf_a.lpszStyle = style_a;
379 if (ChooseFontWtoA(lpChFont, &cf_a) == FALSE)
381 COMDLG32_SetCommDlgExtendedError(CDERR_MEMALLOCFAILURE);
385 if (ChooseFontA(&cf_a) == FALSE)
387 if (cf_a.lpTemplateName != NULL)
388 HeapFree(GetProcessHeap(), 0, (LPSTR)(cf_a.lpTemplateName));
392 ChooseFontAtoW(&cf_a, lpChFont);
398 /***********************************************************************
399 * ChooseFontW (COMDLG32.@)
401 BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont)
407 HANDLE hResInfo, hDlgTmpl;
409 if (TRACE_ON(commdlg))
410 _dump_cf_flags(lpChFont->Flags);
412 if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, "CHOOSE_FONT", RT_DIALOGA)))
414 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
417 if (!(hDlgTmpl = LoadResource(COMMDLG_hInstance32, hResInfo )) ||
418 !(template = LockResource( hDlgTmpl )))
420 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
424 if (lpChFont->Flags & (CF_SELECTSCRIPT | CF_NOVERTFONTS | CF_ENABLETEMPLATE |
425 CF_ENABLETEMPLATEHANDLE)) FIXME(": unimplemented flag (ignored)\n");
426 memcpy(&cf32a, lpChFont, sizeof(cf32a));
427 memcpy(&lf32a, lpChFont->lpLogFont, sizeof(LOGFONTA));
429 WideCharToMultiByte( CP_ACP, 0, lpChFont->lpLogFont->lfFaceName, -1,
430 lf32a.lfFaceName, LF_FACESIZE, NULL, NULL );
431 lf32a.lfFaceName[LF_FACESIZE-1] = 0;
432 cf32a.lpLogFont=&lf32a;
433 cf32a.lpszStyle=HEAP_strdupWtoA(GetProcessHeap(), 0, lpChFont->lpszStyle);
434 lpChFont->lpTemplateName=(LPWSTR)&cf32a;
435 bRet = DialogBoxIndirectParamW(COMMDLG_hInstance32, template,
436 lpChFont->hwndOwner, FormatCharDlgProcW, (LPARAM)lpChFont );
437 HeapFree(GetProcessHeap(), 0, cf32a.lpszStyle);
438 lpChFont->lpTemplateName=(LPWSTR)cf32a.lpTemplateName;
439 memcpy(lpChFont->lpLogFont, &lf32a, sizeof(CHOOSEFONTA));
440 MultiByteToWideChar( CP_ACP, 0, lf32a.lfFaceName, -1,
441 lpChFont->lpLogFont->lfFaceName, LF_FACESIZE );
442 lpChFont->lpLogFont->lfFaceName[LF_FACESIZE-1] = 0;
447 #define TEXT_EXTRAS 4
448 #define TEXT_COLORS 16
450 static const COLORREF textcolors[TEXT_COLORS]=
452 0x00000000L,0x00000080L,0x00008000L,0x00008080L,
453 0x00800000L,0x00800080L,0x00808000L,0x00808080L,
454 0x00c0c0c0L,0x000000ffL,0x0000ff00L,0x0000ffffL,
455 0x00ff0000L,0x00ff00ffL,0x00ffff00L,0x00FFFFFFL
458 /***********************************************************************
459 * CFn_HookCallChk [internal]
461 static BOOL CFn_HookCallChk(LPCHOOSEFONT16 lpcf)
464 if(lpcf->Flags & CF_ENABLEHOOK)
470 /***********************************************************************
471 * CFn_HookCallChk32 [internal]
473 static BOOL CFn_HookCallChk32(LPCHOOSEFONTA lpcf)
476 if(lpcf->Flags & CF_ENABLEHOOK)
486 LPCHOOSEFONTA lpcf32a;
488 } CFn_ENUMSTRUCT, *LPCFn_ENUMSTRUCT;
490 /*************************************************************************
491 * AddFontFamily [internal]
493 static INT AddFontFamily(const LOGFONTA *lplf, UINT nFontType,
494 LPCHOOSEFONTA lpcf, HWND hwnd, LPCFn_ENUMSTRUCT e)
499 TRACE("font=%s (nFontType=%d)\n", lplf->lfFaceName,nFontType);
501 if (lpcf->Flags & CF_FIXEDPITCHONLY)
502 if (!(lplf->lfPitchAndFamily & FIXED_PITCH))
504 if (lpcf->Flags & CF_ANSIONLY)
505 if (lplf->lfCharSet != ANSI_CHARSET)
507 if (lpcf->Flags & CF_TTONLY)
508 if (!(nFontType & TRUETYPE_FONTTYPE))
513 i=SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)lplf->lfFaceName);
516 w=(lplf->lfCharSet << 8) | lplf->lfPitchAndFamily;
517 SendMessageA(hwnd, CB_SETITEMDATA, i, MAKELONG(nFontType,w));
518 return 1 ; /* store some important font information */
524 /*************************************************************************
525 * FontFamilyEnumProc32 [internal]
527 static INT WINAPI FontFamilyEnumProc(const LOGFONTA *lpLogFont,
528 const TEXTMETRICA *metrics, DWORD dwFontType, LPARAM lParam)
531 e=(LPCFn_ENUMSTRUCT)lParam;
532 return AddFontFamily(lpLogFont, dwFontType, e->lpcf32a, e->hWnd1, e);
535 /***********************************************************************
536 * FontFamilyEnumProc (COMMDLG.19)
538 INT16 WINAPI FontFamilyEnumProc16( SEGPTR logfont, SEGPTR metrics,
539 UINT16 nFontType, LPARAM lParam )
541 HWND hwnd=HWND_32(LOWORD(lParam));
542 HWND hDlg=GetParent(hwnd);
543 LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER);
544 LOGFONT16 *lplf = MapSL( logfont );
546 FONT_LogFont16To32A(lplf, &lf32a);
547 return AddFontFamily(&lf32a, nFontType, (LPCHOOSEFONTA)lpcf->lpTemplateName,
551 /*************************************************************************
552 * SetFontStylesToCombo2 [internal]
554 * Fill font style information into combobox (without using font.c directly)
556 static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTA *lplf)
563 static struct FONTSTYLE fontstyles[FSTYLES]={
564 { 0,FW_NORMAL,"Regular"},{0,FW_BOLD,"Bold"},
565 { 1,FW_NORMAL,"Italic"}, {1,FW_BOLD,"Bold Italic"}};
571 memcpy(&lf, lplf, sizeof(LOGFONTA));
573 for (i=0;i<FSTYLES;i++)
575 lf.lfItalic=fontstyles[i].italic;
576 lf.lfWeight=fontstyles[i].weight;
577 hf=CreateFontIndirectA(&lf);
578 hf=SelectObject(hdc,hf);
579 GetTextMetricsA(hdc,&tm);
580 hf=SelectObject(hdc,hf);
583 if (tm.tmWeight==fontstyles[i].weight &&
584 tm.tmItalic==fontstyles[i].italic) /* font successful created ? */
586 j=SendMessageA(hwnd,CB_ADDSTRING,0,(LPARAM)fontstyles[i].stname );
587 if (j==CB_ERR) return 1;
588 j=SendMessageA(hwnd, CB_SETITEMDATA, j,
589 MAKELONG(fontstyles[i].weight,fontstyles[i].italic));
590 if (j==CB_ERR) return 1;
596 /*************************************************************************
597 * AddFontSizeToCombo3 [internal]
599 static int AddFontSizeToCombo3(HWND hwnd, UINT h, LPCHOOSEFONTA lpcf)
604 if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||
605 ((lpcf->Flags & CF_LIMITSIZE) && (h >= lpcf->nSizeMin) && (h <= lpcf->nSizeMax)))
607 sprintf(buffer, "%2d", h);
608 j=SendMessageA(hwnd, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer);
611 j=SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)buffer);
612 if (j!=CB_ERR) j = SendMessageA(hwnd, CB_SETITEMDATA, j, h);
613 if (j==CB_ERR) return 1;
619 /*************************************************************************
620 * SetFontSizesToCombo3 [internal]
622 static int SetFontSizesToCombo3(HWND hwnd, LPCHOOSEFONTA lpcf)
624 static const int sizes[]={8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72,0};
627 for (i=0; sizes[i]; i++)
628 if (AddFontSizeToCombo3(hwnd, sizes[i], lpcf)) return 1;
632 /***********************************************************************
633 * AddFontStyle [internal]
635 static INT AddFontStyle(const LOGFONTA *lplf, UINT nFontType,
636 LPCHOOSEFONTA lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg)
640 TRACE("(nFontType=%d)\n",nFontType);
641 TRACE(" %s h=%ld w=%ld e=%ld o=%ld wg=%ld i=%d u=%d s=%d"
642 " ch=%d op=%d cp=%d q=%d pf=%xh\n",
643 lplf->lfFaceName,lplf->lfHeight,lplf->lfWidth,
644 lplf->lfEscapement,lplf->lfOrientation,
645 lplf->lfWeight,lplf->lfItalic,lplf->lfUnderline,
646 lplf->lfStrikeOut,lplf->lfCharSet, lplf->lfOutPrecision,
647 lplf->lfClipPrecision,lplf->lfQuality, lplf->lfPitchAndFamily);
648 if (nFontType & RASTER_FONTTYPE)
650 if (AddFontSizeToCombo3(hcmb3, lplf->lfHeight, lpcf)) return 0;
651 } else if (SetFontSizesToCombo3(hcmb3, lpcf)) return 0;
653 if (!SendMessageA(hcmb2, CB_GETCOUNT, 0, 0))
655 HDC hdc= ((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC) ? lpcf->hDC : GetDC(hDlg);
656 i=SetFontStylesToCombo2(hcmb2,hdc,lplf);
657 if (!((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC))
666 /***********************************************************************
667 * FontStyleEnumProc (COMMDLG.18)
669 INT16 WINAPI FontStyleEnumProc16( SEGPTR logfont, SEGPTR metrics,
670 UINT16 nFontType, LPARAM lParam )
672 HWND hcmb2=HWND_32(LOWORD(lParam));
673 HWND hcmb3=HWND_32(HIWORD(lParam));
674 HWND hDlg=GetParent(hcmb3);
675 LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER);
676 LOGFONT16 *lplf = MapSL(logfont);
678 FONT_LogFont16To32A(lplf, &lf32a);
679 return AddFontStyle(&lf32a, nFontType, (LPCHOOSEFONTA)lpcf->lpTemplateName,
683 /***********************************************************************
684 * FontStyleEnumProc32 [internal]
686 static INT WINAPI FontStyleEnumProc( const LOGFONTA *lpFont,
687 const TEXTMETRICA *metrics, DWORD dwFontType, LPARAM lParam )
689 LPCFn_ENUMSTRUCT s=(LPCFn_ENUMSTRUCT)lParam;
692 HWND hDlg=GetParent(hcmb3);
693 return AddFontStyle(lpFont, dwFontType, s->lpcf32a, hcmb2,
697 /***********************************************************************
698 * CFn_WMInitDialog [internal]
700 static LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
707 HCURSOR hcursor=SetCursor(LoadCursorA(0,IDC_WAITA));
709 SetWindowLongA(hDlg, DWL_USER, lParam);
710 lpxx=lpcf->lpLogFont;
711 TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
713 if (lpcf->lStructSize != sizeof(CHOOSEFONTA))
715 ERR("structure size failure !!!\n");
720 hBitmapTT = LoadBitmapA(0, MAKEINTRESOURCEA(OBM_TRTYPE));
722 /* This font will be deleted by WM_COMMAND */
723 SendDlgItemMessageA(hDlg,stc6,WM_SETFONT,
724 CreateFontA(0, 0, 1, 1, 400, 0, 0, 0, 0, 0, 0, 0, 0, NULL),FALSE);
726 if (!(lpcf->Flags & CF_SHOWHELP) || !IsWindow(lpcf->hwndOwner))
727 ShowWindow(GetDlgItem(hDlg,pshHelp),SW_HIDE);
728 if (!(lpcf->Flags & CF_APPLY))
729 ShowWindow(GetDlgItem(hDlg,psh3),SW_HIDE);
730 if (lpcf->Flags & CF_EFFECTS)
732 for (res=1,i=0;res && i<TEXT_COLORS;i++)
734 /* FIXME: load color name from resource: res=LoadString(...,i+....,buffer,.....); */
736 strcpy( name, "[color name]" );
737 j=SendDlgItemMessageA(hDlg, cmb4, CB_ADDSTRING, 0, (LPARAM)name);
738 SendDlgItemMessageA(hDlg, cmb4, CB_SETITEMDATA16, j, textcolors[j]);
739 /* look for a fitting value in color combobox */
740 if (textcolors[j]==lpcf->rgbColors)
741 SendDlgItemMessageA(hDlg,cmb4, CB_SETCURSEL,j,0);
746 ShowWindow(GetDlgItem(hDlg,cmb4),SW_HIDE);
747 ShowWindow(GetDlgItem(hDlg,chx1),SW_HIDE);
748 ShowWindow(GetDlgItem(hDlg,chx2),SW_HIDE);
749 ShowWindow(GetDlgItem(hDlg,grp1),SW_HIDE);
750 ShowWindow(GetDlgItem(hDlg,stc4),SW_HIDE);
752 hdc= ((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC) ? lpcf->hDC : GetDC(hDlg);
756 s.hWnd1=GetDlgItem(hDlg,cmb1);
760 if (!EnumFontFamiliesA(hdc, NULL, FontFamilyEnumProc, (LPARAM)&s)) {
761 TRACE("EnumFontFamilies returns 0\n");
765 if (lpcf->Flags & CF_FIXEDPITCHONLY) {
766 FIXME("No founds found with fixed pitch only, dropping flag.\n");
767 lpcf->Flags &= ~CF_FIXEDPITCHONLY;
770 if (lpcf->Flags & CF_TTONLY) {
771 FIXME("No founds found with truetype only, dropping flag.\n");
772 lpcf->Flags &= ~CF_TTONLY;
779 if (lpcf->Flags & CF_INITTOLOGFONTSTRUCT)
781 /* look for fitting font name in combobox1 */
782 j=SendDlgItemMessageA(hDlg,cmb1,CB_FINDSTRING,-1,(LONG)lpxx->lfFaceName);
785 SendDlgItemMessageA(hDlg, cmb1, CB_SETCURSEL, j, 0);
786 SendMessageA(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE),
787 (LPARAM)GetDlgItem(hDlg,cmb1));
789 /* look for fitting font style in combobox2 */
790 l=MAKELONG(lpxx->lfWeight > FW_MEDIUM ? FW_BOLD:FW_NORMAL,lpxx->lfItalic !=0);
791 for (i=0;i<TEXT_EXTRAS;i++)
793 if (l==SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, i, 0))
794 SendDlgItemMessageA(hDlg, cmb2, CB_SETCURSEL, i, 0);
797 /* look for fitting font size in combobox3 */
798 j=SendDlgItemMessageA(hDlg, cmb3, CB_GETCOUNT, 0, 0);
801 if (lpxx->lfHeight==(int)SendDlgItemMessageA(hDlg,cmb3, CB_GETITEMDATA,i,0))
802 SendDlgItemMessageA(hDlg,cmb3,CB_SETCURSEL,i,0);
808 SendDlgItemMessageA(hDlg,cmb1,CB_SETCURSEL,0,0);
809 SendMessageA(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE),
810 (LPARAM)GetDlgItem(hDlg,cmb1));
812 if (lpcf->Flags & CF_USESTYLE && lpcf->lpszStyle)
814 j=SendDlgItemMessageA(hDlg,cmb2,CB_FINDSTRING,-1,(LONG)lpcf->lpszStyle);
817 j=SendDlgItemMessageA(hDlg,cmb2,CB_SETCURSEL,j,0);
818 SendMessageA(hDlg,WM_COMMAND,cmb2,
819 MAKELONG(HWND_16(GetDlgItem(hDlg,cmb2)),CBN_SELCHANGE));
825 WARN("HDC failure !!!\n");
830 if (!((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC))
837 /***********************************************************************
838 * CFn_WMMeasureItem [internal]
840 static LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
843 LPMEASUREITEMSTRUCT lpmi=(LPMEASUREITEMSTRUCT)lParam;
845 hBitmapTT = LoadBitmapA(0, MAKEINTRESOURCEA(OBM_TRTYPE));
846 GetObjectA( hBitmapTT, sizeof(bm), &bm );
847 lpmi->itemHeight=bm.bmHeight;
848 /* FIXME: use MAX of bm.bmHeight and tm.tmHeight .*/
853 /***********************************************************************
854 * CFn_WMDrawItem [internal]
856 static LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
861 COLORREF cr, oldText=0, oldBk=0;
866 HBITMAP hBitmap; /* for later TT usage */
868 LPDRAWITEMSTRUCT lpdi = (LPDRAWITEMSTRUCT)lParam;
870 if (lpdi->itemID == (UINT)-1) /* got no items */
871 DrawFocusRect(lpdi->hDC, &lpdi->rcItem);
874 if (lpdi->CtlType == ODT_COMBOBOX)
876 if (lpdi->itemState ==ODS_SELECTED)
878 hBrush=GetSysColorBrush(COLOR_HIGHLIGHT);
879 oldText=SetTextColor(lpdi->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
880 oldBk=SetBkColor(lpdi->hDC, GetSysColor(COLOR_HIGHLIGHT));
883 hBrush = SelectObject(lpdi->hDC, GetStockObject(LTGRAY_BRUSH));
884 SelectObject(lpdi->hDC, hBrush);
886 FillRect(lpdi->hDC, &lpdi->rcItem, hBrush);
889 return TRUE; /* this should never happen */
894 case cmb1: /* TRACE(commdlg,"WM_Drawitem cmb1\n"); */
895 SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,
897 GetObjectA( hBitmapTT, sizeof(bm), &bm );
898 TextOutA(lpdi->hDC, lpdi->rcItem.left + bm.bmWidth + 10,
899 lpdi->rcItem.top, buffer, strlen(buffer));
901 nFontType = SendMessageA(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L);
902 /* FIXME: draw bitmap if truetype usage */
903 if (nFontType&TRUETYPE_FONTTYPE)
905 hMemDC = CreateCompatibleDC(lpdi->hDC);
906 hBitmap = SelectObject(hMemDC, hBitmapTT);
907 BitBlt(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top,
908 bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
909 SelectObject(hMemDC, hBitmap);
915 case cmb3: /* TRACE(commdlg,"WM_DRAWITEN cmb2,cmb3\n"); */
916 SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,
918 TextOutA(lpdi->hDC, lpdi->rcItem.left,
919 lpdi->rcItem.top, buffer, strlen(buffer));
922 case cmb4: /* TRACE(commdlg,"WM_DRAWITEM cmb4 (=COLOR)\n"); */
923 SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,
925 TextOutA(lpdi->hDC, lpdi->rcItem.left + 25+5,
926 lpdi->rcItem.top, buffer, strlen(buffer));
927 cr = SendMessageA(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L);
928 hBrush = CreateSolidBrush(cr);
931 hBrush = SelectObject (lpdi->hDC, hBrush) ;
932 rect.right=rect.left+25;
936 Rectangle( lpdi->hDC, rect.left, rect.top,
937 rect.right, rect.bottom );
938 DeleteObject( SelectObject (lpdi->hDC, hBrush)) ;
944 default: return TRUE; /* this should never happen */
946 if (lpdi->itemState == ODS_SELECTED)
948 SetTextColor(lpdi->hDC, oldText);
949 SetBkColor(lpdi->hDC, oldBk);
955 /***********************************************************************
956 * CFn_WMCtlColor [internal]
958 static LRESULT CFn_WMCtlColorStatic(HWND hDlg, WPARAM wParam, LPARAM lParam,
961 if (lpcf->Flags & CF_EFFECTS)
962 if (GetDlgCtrlID(HWND_32(LOWORD(lParam)))==stc6)
964 SetTextColor((HDC)wParam, lpcf->rgbColors);
965 return GetStockObject(WHITE_BRUSH);
970 /***********************************************************************
971 * CFn_WMCommand [internal]
973 static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
980 LPLOGFONTA lpxx=lpcf->lpLogFont;
982 TRACE("WM_COMMAND wParam=%08lX lParam=%08lX\n", (LONG)wParam, lParam);
983 switch (LOWORD(wParam))
985 case cmb1:if (HIWORD(wParam)==CBN_SELCHANGE)
987 hdc=((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC) ? lpcf->hDC : GetDC(hDlg);
990 SendDlgItemMessageA(hDlg, cmb2, CB_RESETCONTENT16, 0, 0);
991 SendDlgItemMessageA(hDlg, cmb3, CB_RESETCONTENT16, 0, 0);
992 i=SendDlgItemMessageA(hDlg, cmb1, CB_GETCURSEL16, 0, 0);
995 HCURSOR hcursor=SetCursor(LoadCursorA(0,IDC_WAITA));
998 SendDlgItemMessageA(hDlg, cmb1, CB_GETLBTEXT, i,
1000 TRACE("WM_COMMAND/cmb1 =>%s\n",str);
1001 s.hWnd1=GetDlgItem(hDlg, cmb2);
1002 s.hWnd2=GetDlgItem(hDlg, cmb3);
1004 EnumFontFamiliesA(hdc, str, FontStyleEnumProc, (LPARAM)&s);
1005 SendDlgItemMessageA(hDlg,cmb2, CB_SETCURSEL, 0, 0);
1006 SendDlgItemMessageA(hDlg,cmb3, CB_SETCURSEL, 0, 0);
1009 if (!((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC))
1010 ReleaseDC(hDlg,hdc);
1014 WARN("HDC failure !!!\n");
1015 EndDialog (hDlg, 0);
1022 case cmb3:if (HIWORD(wParam)==CBN_SELCHANGE || HIWORD(wParam)== BN_CLICKED )
1025 TRACE("WM_COMMAND/cmb2,3 =%08lX\n", lParam);
1026 i=SendDlgItemMessageA(hDlg,cmb1,CB_GETCURSEL,0,0);
1028 i=GetDlgItemTextA( hDlg, cmb1, str, 256 );
1031 SendDlgItemMessageA(hDlg,cmb1,CB_GETLBTEXT,i,
1033 l=SendDlgItemMessageA(hDlg,cmb1,CB_GETITEMDATA,i,0);
1035 lpcf->nFontType = LOWORD(l);
1036 /* FIXME: lpcf->nFontType |= .... SIMULATED_FONTTYPE and so */
1037 /* same value reported to the EnumFonts
1038 call back with the extra FONTTYPE_... bits added */
1039 lpxx->lfPitchAndFamily=j&0xff;
1040 lpxx->lfCharSet=j>>8;
1042 strcpy(lpxx->lfFaceName,str);
1043 i=SendDlgItemMessageA(hDlg, cmb2, CB_GETCURSEL, 0, 0);
1046 l=SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, i, 0);
1047 if (0!=(lpxx->lfItalic=HIWORD(l)))
1048 lpcf->nFontType |= ITALIC_FONTTYPE;
1049 if ((lpxx->lfWeight=LOWORD(l)) > FW_MEDIUM)
1050 lpcf->nFontType |= BOLD_FONTTYPE;
1052 i=SendDlgItemMessageA(hDlg, cmb3, CB_GETCURSEL, 0, 0);
1054 lpxx->lfHeight=-LOWORD(SendDlgItemMessageA(hDlg, cmb3, CB_GETITEMDATA, i, 0));
1057 lpxx->lfStrikeOut=IsDlgButtonChecked(hDlg,chx1);
1058 lpxx->lfUnderline=IsDlgButtonChecked(hDlg,chx2);
1059 lpxx->lfWidth=lpxx->lfOrientation=lpxx->lfEscapement=0;
1060 lpxx->lfOutPrecision=OUT_DEFAULT_PRECIS;
1061 lpxx->lfClipPrecision=CLIP_DEFAULT_PRECIS;
1062 lpxx->lfQuality=DEFAULT_QUALITY;
1063 lpcf->iPointSize= -10*lpxx->lfHeight;
1065 hFont=CreateFontIndirectA(lpxx);
1068 HFONT oldFont=SendDlgItemMessageA(hDlg, stc6,
1070 SendDlgItemMessageA(hDlg,stc6,WM_SETFONT,hFont,TRUE);
1071 DeleteObject(oldFont);
1076 case cmb4:i=SendDlgItemMessageA(hDlg, cmb4, CB_GETCURSEL, 0, 0);
1079 lpcf->rgbColors=textcolors[i];
1080 InvalidateRect( GetDlgItem(hDlg,stc6), NULL, 0 );
1084 case psh15:i=RegisterWindowMessageA( HELPMSGSTRINGA );
1085 if (lpcf->hwndOwner)
1086 SendMessageA(lpcf->hwndOwner, i, 0, (LPARAM)GetWindowLongA(hDlg, DWL_USER));
1087 /* if (CFn_HookCallChk(lpcf))
1088 CallWindowProc16(lpcf->lpfnHook,hDlg,WM_COMMAND,psh15,(LPARAM)lpcf);*/
1091 case IDOK:if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||
1092 ( (lpcf->Flags & CF_LIMITSIZE) &&
1093 (-lpxx->lfHeight >= lpcf->nSizeMin) &&
1094 (-lpxx->lfHeight <= lpcf->nSizeMax)))
1095 EndDialog(hDlg, TRUE);
1099 sprintf(buffer,"Select a font size between %d and %d points.",
1100 lpcf->nSizeMin,lpcf->nSizeMax);
1101 MessageBoxA(hDlg, buffer, NULL, MB_OK);
1104 case IDCANCEL:EndDialog(hDlg, FALSE);
1110 static LRESULT CFn_WMDestroy(HWND hwnd, WPARAM wParam, LPARAM lParam)
1112 DeleteObject(SendDlgItemMessageA(hwnd, stc6, WM_GETFONT, 0, 0));
1117 /***********************************************************************
1118 * FormatCharDlgProc (COMMDLG.16)
1119 FIXME: 1. some strings are "hardcoded", but it's better load from sysres
1120 2. some CF_.. flags are not supported
1121 3. some TType extensions
1123 BOOL16 CALLBACK FormatCharDlgProc16(HWND16 hDlg16, UINT16 message,
1124 WPARAM16 wParam, LPARAM lParam)
1126 HWND hDlg = HWND_32(hDlg16);
1127 LPCHOOSEFONT16 lpcf;
1128 LPCHOOSEFONTA lpcf32a;
1130 if (message!=WM_INITDIALOG)
1132 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER);
1135 if (CFn_HookCallChk(lpcf))
1136 res=CallWindowProc16((WNDPROC16)lpcf->lpfnHook,hDlg16,message,wParam,lParam);
1142 lpcf=(LPCHOOSEFONT16)lParam;
1143 lpcf32a=(LPCHOOSEFONTA)lpcf->lpTemplateName;
1144 if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf32a))
1146 TRACE("CFn_WMInitDialog returned FALSE\n");
1149 if (CFn_HookCallChk(lpcf))
1150 return CallWindowProc16((WNDPROC16)lpcf->lpfnHook,hDlg16,WM_INITDIALOG,wParam,lParam);
1152 lpcf32a=(LPCHOOSEFONTA)lpcf->lpTemplateName;
1155 case WM_MEASUREITEM:
1157 MEASUREITEMSTRUCT16* mis16 = MapSL(lParam);
1158 MEASUREITEMSTRUCT mis;
1159 mis.CtlType = mis16->CtlType;
1160 mis.CtlID = mis16->CtlID;
1161 mis.itemID = mis16->itemID;
1162 mis.itemWidth = mis16->itemWidth;
1163 mis.itemHeight = mis16->itemHeight;
1164 mis.itemData = mis16->itemData;
1165 res = CFn_WMMeasureItem(hDlg, wParam, (LPARAM)&mis);
1166 mis16->itemWidth = (UINT16)mis.itemWidth;
1167 mis16->itemHeight = (UINT16)mis.itemHeight;
1172 DRAWITEMSTRUCT16* dis16 = MapSL(lParam);
1174 dis.CtlType = dis16->CtlType;
1175 dis.CtlID = dis16->CtlID;
1176 dis.itemID = dis16->itemID;
1177 dis.itemAction = dis16->itemAction;
1178 dis.itemState = dis16->itemState;
1179 dis.hwndItem = HWND_32(dis16->hwndItem);
1180 dis.hDC = dis16->hDC;
1181 dis.itemData = dis16->itemData;
1182 CONV_RECT16TO32( &dis16->rcItem, &dis.rcItem );
1183 res = CFn_WMDrawItem(hDlg, wParam, (LPARAM)&dis);
1187 if (HIWORD(lParam) == CTLCOLOR_STATIC)
1188 res=CFn_WMCtlColorStatic(hDlg, (HDC)wParam, LOWORD(lParam), lpcf32a);
1191 res=CFn_WMCommand(hDlg, MAKEWPARAM( wParam, HIWORD(lParam) ), LOWORD(lParam), lpcf32a);
1194 res=CFn_WMDestroy(hDlg, wParam, lParam);
1196 case WM_CHOOSEFONT_GETLOGFONT:
1197 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", lParam);
1198 FIXME("current logfont back to caller\n");
1204 /***********************************************************************
1205 * FormatCharDlgProcA [internal]
1207 INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
1211 INT_PTR res = FALSE;
1212 if (uMsg!=WM_INITDIALOG)
1214 lpcf=(LPCHOOSEFONTA)GetWindowLongA(hDlg, DWL_USER);
1217 if (CFn_HookCallChk32(lpcf))
1218 res=CallWindowProcA((WNDPROC)lpcf->lpfnHook, hDlg, uMsg, wParam, lParam);
1224 lpcf=(LPCHOOSEFONTA)lParam;
1225 if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf))
1227 TRACE("CFn_WMInitDialog returned FALSE\n");
1230 if (CFn_HookCallChk32(lpcf))
1231 return CallWindowProcA((WNDPROC)lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam);
1235 case WM_MEASUREITEM:
1236 return CFn_WMMeasureItem(hDlg, wParam, lParam);
1238 return CFn_WMDrawItem(hDlg, wParam, lParam);
1239 case WM_CTLCOLORSTATIC:
1240 return CFn_WMCtlColorStatic(hDlg, wParam, lParam, lpcf);
1242 return CFn_WMCommand(hDlg, wParam, lParam, lpcf);
1244 return CFn_WMDestroy(hDlg, wParam, lParam);
1245 case WM_CHOOSEFONT_GETLOGFONT:
1246 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n",
1248 FIXME("current logfont back to caller\n");
1254 /***********************************************************************
1255 * FormatCharDlgProcW [internal]
1257 INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam,
1260 LPCHOOSEFONTW lpcf32w;
1261 LPCHOOSEFONTA lpcf32a;
1262 INT_PTR res = FALSE;
1263 if (uMsg!=WM_INITDIALOG)
1265 lpcf32w=(LPCHOOSEFONTW)GetWindowLongA(hDlg, DWL_USER);
1268 if (CFn_HookCallChk32((LPCHOOSEFONTA)lpcf32w))
1269 res=CallWindowProcW((WNDPROC)lpcf32w->lpfnHook, hDlg, uMsg, wParam, lParam);
1275 lpcf32w=(LPCHOOSEFONTW)lParam;
1276 lpcf32a=(LPCHOOSEFONTA)lpcf32w->lpTemplateName;
1277 if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf32a))
1279 TRACE("CFn_WMInitDialog returned FALSE\n");
1282 if (CFn_HookCallChk32((LPCHOOSEFONTA)lpcf32w))
1283 return CallWindowProcW((WNDPROC)lpcf32w->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam);
1285 lpcf32a=(LPCHOOSEFONTA)lpcf32w->lpTemplateName;
1288 case WM_MEASUREITEM:
1289 return CFn_WMMeasureItem(hDlg, wParam, lParam);
1291 return CFn_WMDrawItem(hDlg, wParam, lParam);
1292 case WM_CTLCOLORSTATIC:
1293 return CFn_WMCtlColorStatic(hDlg, wParam, lParam, lpcf32a);
1295 return CFn_WMCommand(hDlg, wParam, lParam, lpcf32a);
1297 return CFn_WMDestroy(hDlg, wParam, lParam);
1298 case WM_CHOOSEFONT_GETLOGFONT:
1299 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n",
1301 FIXME("current logfont back to caller\n");