ReactOS 0.4.17-dev-934-g091855f
fontdlg.c File Reference
#include <ctype.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "wingdi.h"
#include "winuser.h"
#include "commdlg.h"
#include "dlgs.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "cderr.h"
#include "cdlg.h"
Include dependency graph for fontdlg.c:

Go to the source code of this file.

Classes

struct  CFn_ENUMSTRUCT
 

Macros

#define TTBITMAP_XSIZE   20 /* x-size of the bitmaps */
 
#define CI(cs)   ((IDS_CHARSET_##cs)-IDS_CHARSET_ANSI)
 
#define XX(x)   { x, #x },
 
#define TEXT_EXTRAS   4
 
#define TEXT_COLORS   16
 
#define FSTYLES   4
 

Typedefs

typedef struct CFn_ENUMSTRUCT * LPCFn_ENUMSTRUCT
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (commdlg)
 
static INT_PTR CALLBACK FormatCharDlgProcA (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK FormatCharDlgProcW (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static void _dump_cf_flags (DWORD cflags)
 
BOOL WINAPI ChooseFontW (LPCHOOSEFONTW lpChFont)
 
BOOL WINAPI ChooseFontA (LPCHOOSEFONTA lpChFont)
 
static BOOL CFn_HookCallChk32 (const CHOOSEFONTW *lpcf)
 
static INT AddFontFamily (const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM, UINT nFontType, const CHOOSEFONTW *lpcf, HWND hwnd, LPCFn_ENUMSTRUCT e)
 
static INT WINAPI FontFamilyEnumProc (const ENUMLOGFONTEXW *lpElfex, const TEXTMETRICW *metrics, DWORD dwFontType, LPARAM lParam)
 
static BOOL SetFontStylesToCombo2 (HWND hwnd, HDC hdc, const LOGFONTW *lplf)
 
static BOOL AddFontSizeToCombo3 (HWND hwnd, UINT h, const CHOOSEFONTW *lpcf)
 
static BOOL SetFontSizesToCombo3 (HWND hwnd, const CHOOSEFONTW *lpcf)
 
static HDC CFn_GetDC (const CHOOSEFONTW *lpcf)
 
static int GetScreenDPI (void)
 
static void CFn_ReleaseDC (const CHOOSEFONTW *lpcf, HDC hdc)
 
static void select_combo_item (HWND dialog, int id, int sel)
 
static INT AddFontStyle (const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM, UINT nFontType, const CHOOSEFONTW *lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg)
 
static void CFn_FitFontSize (HWND hDlg, int points)
 
static BOOL CFn_FitFontStyle (HWND hDlg, LONG packedstyle)
 
static BOOL CFn_FitCharSet (HWND hDlg, int charset)
 
static INT WINAPI FontStyleEnumProc (const ENUMLOGFONTEXW *lpElfex, const TEXTMETRICW *metrics, DWORD dwFontType, LPARAM lParam)
 
static LRESULT CFn_WMInitDialog (HWND hDlg, LPARAM lParam, LPCHOOSEFONTW lpcf)
 
static LRESULT CFn_WMMeasureItem (HWND hDlg, LPARAM lParam)
 
static LRESULT CFn_WMDrawItem (LPARAM lParam)
 
static INT get_dialog_font_point_size (HWND hDlg, CHOOSEFONTW *cf)
 
static LRESULT CFn_WMCommand (HWND hDlg, WPARAM wParam, LPARAM lParam, LPCHOOSEFONTW lpcf)
 
static LRESULT CFn_WMDestroy (HWND hwnd, LPCHOOSEFONTW lpcfw)
 
static LRESULT CFn_WMPaint (HWND hDlg, WPARAM wParam, LPARAM lParam, const CHOOSEFONTW *lpcf)
 

Variables

static const WCHAR strWineFontData [] = L"__WINE_FONTDLGDATA"
 
static const WCHAR strWineFontData_a [] = L"__WINE_FONTDLGDATA_A"
 
static HIMAGELIST himlTT = 0
 
static const WCHAR *const sample_lang_text []
 
static const BYTE CHARSET_ORDER [256]
 
struct {
   DWORD   mask
 
   const char *   name
 
} cfflags []
 
static const COLORREF textcolors [TEXT_COLORS]
 

Macro Definition Documentation

◆ CI

#define CI (   cs)    ((IDS_CHARSET_##cs)-IDS_CHARSET_ANSI)

Definition at line 65 of file fontdlg.c.

◆ FSTYLES

#define FSTYLES   4

◆ TEXT_COLORS

#define TEXT_COLORS   16

Definition at line 278 of file fontdlg.c.

◆ TEXT_EXTRAS

#define TEXT_EXTRAS   4

Definition at line 277 of file fontdlg.c.

◆ TTBITMAP_XSIZE

#define TTBITMAP_XSIZE   20 /* x-size of the bitmaps */

Definition at line 55 of file fontdlg.c.

◆ XX

#define XX (   x)    { x, #x },

Typedef Documentation

◆ LPCFn_ENUMSTRUCT

Function Documentation

◆ _dump_cf_flags()

static void _dump_cf_flags ( DWORD  cflags)
static

Definition at line 152 of file fontdlg.c.

153{
154 unsigned int i;
155
156 for (i = 0; i < ARRAY_SIZE(cfflags); i++)
157 if (cfflags[i].mask & cflags)
158 TRACE("%s|",cfflags[i].name);
159 TRACE("\n");
160}
#define ARRAY_SIZE(A)
Definition: main.h:20
static const struct @435 cfflags[]
GLenum GLint GLuint mask
Definition: glext.h:6028
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TRACE(s)
Definition: solgame.cpp:4
Definition: name.c:39

Referenced by ChooseFontA(), and ChooseFontW().

◆ AddFontFamily()

static INT AddFontFamily ( const ENUMLOGFONTEXW *  lpElfex,
const NEWTEXTMETRICEXW *  lpNTM,
UINT  nFontType,
const CHOOSEFONTW *  lpcf,
HWND  hwnd,
LPCFn_ENUMSTRUCT  e 
)
static

Definition at line 303 of file fontdlg.c.

305{
306 int i;
307 WORD w;
308 const LOGFONTW *lplf = &(lpElfex->elfLogFont);
309
310 TRACE("font=%s (nFontType=%d)\n", debugstr_w(lplf->lfFaceName), nFontType);
311
312 if (lpcf->Flags & CF_FIXEDPITCHONLY)
313 if (!(lplf->lfPitchAndFamily & FIXED_PITCH))
314 return 1;
315 if (lpcf->Flags & CF_ANSIONLY)
316 if (lplf->lfCharSet != ANSI_CHARSET)
317 return 1;
318 if (lpcf->Flags & CF_TTONLY)
319 if (!(nFontType & TRUETYPE_FONTTYPE))
320 return 1;
321 if (lpcf->Flags & CF_NOVERTFONTS)
322 if (lplf->lfFaceName[0] == '@')
323 return 1;
324
325 if (e) e->added++;
326
328 if (i == CB_ERR) {
330 if( i != CB_ERR) {
331 /* store some important font information */
332 w = (lplf->lfPitchAndFamily) << 8 |
333 (HIWORD(lpNTM->ntmTm.ntmFlags) & 0xff);
335 }
336 }
337 return 1;
338}
#define CF_TTONLY
Definition: commdlg.h:80
#define CF_ANSIONLY
Definition: commdlg.h:70
#define CF_NOVERTFONTS
Definition: commdlg.h:86
#define CF_FIXEDPITCHONLY
Definition: commdlg.h:76
unsigned short WORD
Definition: ntddk_ex.h:93
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define e
Definition: ke_i.h:82
#define debugstr_w
Definition: kernel32.h:32
LONG_PTR LPARAM
Definition: minwindef.h:175
#define CB_SETITEMDATA
Definition: winuser.h:1995
#define CB_ERR
Definition: winuser.h:2471
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1969
#define CB_ADDSTRING
Definition: winuser.h:1965
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfPitchAndFamily
Definition: dimm.idl:71
DWORD Flags
Definition: commdlg.h:284
LOGFONTW elfLogFont
Definition: wingdi.h:3148
NEWTEXTMETRICW ntmTm
Definition: wingdi.h:3121
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HIWORD(l)
Definition: typedefs.h:247
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define FIXED_PITCH
Definition: wingdi.h:444
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1109
#define ANSI_CHARSET
Definition: wingdi.h:383

Referenced by FontFamilyEnumProc().

◆ AddFontSizeToCombo3()

static BOOL AddFontSizeToCombo3 ( HWND  hwnd,
UINT  h,
const CHOOSEFONTW *  lpcf 
)
static

Definition at line 408 of file fontdlg.c.

409{
410 int j;
411 WCHAR buffer[20];
412
413 if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||
414 ((lpcf->Flags & CF_LIMITSIZE) && (h >= lpcf->nSizeMin) && (h <= lpcf->nSizeMax)))
415 {
418 if (j==CB_ERR)
419 {
422 if (j==CB_ERR) return TRUE;
423 }
424 }
425 return FALSE;
426}
#define CF_LIMITSIZE
Definition: commdlg.h:75
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define swprintf
Definition: precomp.h:40
#define L(x)
Definition: resources.c:13
GLuint buffer
Definition: glext.h:5915
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
short WCHAR
Definition: pedump.c:58
#define CB_INSERTSTRING
Definition: winuser.h:1986

Referenced by AddFontStyle(), and SetFontSizesToCombo3().

◆ AddFontStyle()

static INT AddFontStyle ( const ENUMLOGFONTEXW *  lpElfex,
const NEWTEXTMETRICEXW *  lpNTM,
UINT  nFontType,
const CHOOSEFONTW *  lpcf,
HWND  hcmb2,
HWND  hcmb3,
HWND  hDlg 
)
static

Definition at line 490 of file fontdlg.c.

492{
493 int i;
494 const LOGFONTW *lplf = &(lpElfex->elfLogFont);
495 HWND hcmb5;
496 HDC hdc;
497
498 TRACE("(nFontType=%d)\n",nFontType);
499 TRACE(" %s h=%ld w=%ld e=%ld o=%ld wg=%ld i=%d u=%d s=%d"
500 " ch=%d op=%d cp=%d q=%d pf=%xh\n",
501 debugstr_w(lplf->lfFaceName),lplf->lfHeight,lplf->lfWidth,
502 lplf->lfEscapement,lplf->lfOrientation,
503 lplf->lfWeight,lplf->lfItalic,lplf->lfUnderline,
504 lplf->lfStrikeOut,lplf->lfCharSet, lplf->lfOutPrecision,
505 lplf->lfClipPrecision,lplf->lfQuality, lplf->lfPitchAndFamily);
506 if (nFontType & RASTER_FONTTYPE)
507 {
508 INT points;
510 72, GetScreenDPI());
511 if (AddFontSizeToCombo3(hcmb3, points, lpcf))
512 return 0;
513 } else if (SetFontSizesToCombo3(hcmb3, lpcf)) return 0;
514
515 if (!SendMessageW(hcmb2, CB_GETCOUNT, 0, 0))
516 {
517 BOOL res;
518 if(!(hdc = CFn_GetDC(lpcf))) return 0;
519 res = SetFontStylesToCombo2(hcmb2,hdc,lplf);
520 CFn_ReleaseDC(lpcf, hdc);
521 if (res)
522 return 0;
523 }
524 if (!( hcmb5 = GetDlgItem(hDlg, cmb5))) return 1;
525 i = SendMessageW( hcmb5, CB_FINDSTRINGEXACT, 0,
526 (LPARAM)lpElfex->elfScript);
527 if( i == CB_ERR) {
528 i = SendMessageW( hcmb5, CB_ADDSTRING, 0,
529 (LPARAM)lpElfex->elfScript);
530 if( i != CB_ERR)
531 SendMessageW( hcmb5, CB_SETITEMDATA, i, lplf->lfCharSet);
532 }
533 return 1 ;
534}
#define cmb5
Definition: dlgs.h:57
static HDC CFn_GetDC(const CHOOSEFONTW *lpcf)
Definition: fontdlg.c:444
static BOOL SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTW *lplf)
Definition: fontdlg.c:357
static BOOL SetFontSizesToCombo3(HWND hwnd, const CHOOSEFONTW *lpcf)
Definition: fontdlg.c:431
static int GetScreenDPI(void)
Definition: fontdlg.c:456
static BOOL AddFontSizeToCombo3(HWND hwnd, UINT h, const CHOOSEFONTW *lpcf)
Definition: fontdlg.c:408
static void CFn_ReleaseDC(const CHOOSEFONTW *lpcf, HDC hdc)
Definition: fontdlg.c:471
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint res
Definition: glext.h:9613
GLsizei const GLfloat * points
Definition: glext.h:8112
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
#define CB_GETCOUNT
Definition: winuser.h:1971
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BYTE lfOutPrecision
Definition: dimm.idl:68
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
LONG lfOrientation
Definition: dimm.idl:62
LONG lfWidth
Definition: dimm.idl:60
BYTE lfUnderline
Definition: dimm.idl:65
BYTE lfClipPrecision
Definition: dimm.idl:69
LONG lfEscapement
Definition: dimm.idl:61
BYTE lfQuality
Definition: dimm.idl:70
WCHAR elfScript[LF_FACESIZE]
Definition: wingdi.h:3151
LONG tmInternalLeading
Definition: wingdi.h:3093
int32_t INT
Definition: typedefs.h:58
#define RASTER_FONTTYPE
Definition: wingdi.h:1107

Referenced by FontStyleEnumProc().

◆ CFn_FitCharSet()

static BOOL CFn_FitCharSet ( HWND  hDlg,
int  charset 
)
static

Definition at line 574 of file fontdlg.c.

575{
576 int i,n,cs;
577 /* look for fitting char set in combobox5 */
579 for (i=0;i<n;i++)
580 {
582 if (charset == cs)
583 {
584 select_combo_item( hDlg, cmb5, i );
585 return TRUE;
586 }
587 }
588 /* no charset fits: select the first one in the list */
589 select_combo_item( hDlg, cmb5, 0 );
590 return FALSE;
591}
CFF_Charset charset
Definition: cffcmap.c:137
static void select_combo_item(HWND dialog, int id, int sel)
Definition: fontdlg.c:480
GLdouble n
Definition: glext.h:7729
#define cs
Definition: i386-dis.c:442
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETITEMDATA
Definition: winuser.h:1979

Referenced by CFn_WMCommand(), and CFn_WMInitDialog().

◆ CFn_FitFontSize()

static void CFn_FitFontSize ( HWND  hDlg,
int  points 
)
static

Definition at line 536 of file fontdlg.c.

537{
538 int i,n;
539
540 /* look for fitting font size in combobox3 */
542 for (i=0;i<n;i++)
543 {
544 if (points == (int)SendDlgItemMessageW
545 (hDlg,cmb3, CB_GETITEMDATA,i,0))
546 {
547 select_combo_item( hDlg, cmb3, i );
548 return;
549 }
550 }
551
552 /* no default matching size, set text manually */
553 SetDlgItemInt(hDlg, cmb3, points, TRUE);
554}
#define cmb3
Definition: dlgs.h:55
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)

Referenced by CFn_WMCommand(), and CFn_WMInitDialog().

◆ CFn_FitFontStyle()

static BOOL CFn_FitFontStyle ( HWND  hDlg,
LONG  packedstyle 
)
static

Definition at line 556 of file fontdlg.c.

557{
558 LONG id;
559 int i;
560 /* look for fitting font style in combobox2 */
561 for (i=0;i<TEXT_EXTRAS;i++)
562 {
563 id = SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, i, 0);
564 if (packedstyle == id)
565 {
566 select_combo_item( hDlg, cmb2, i );
567 return TRUE;
568 }
569 }
570 return FALSE;
571}
#define cmb2
Definition: dlgs.h:54
#define TEXT_EXTRAS
Definition: fontdlg.c:277
GLuint id
Definition: glext.h:5910
long LONG
Definition: pedump.c:60

Referenced by CFn_WMCommand(), and CFn_WMInitDialog().

◆ CFn_GetDC()

static HDC CFn_GetDC ( const CHOOSEFONTW *  lpcf)
inlinestatic

Definition at line 444 of file fontdlg.c.

445{
446 HDC ret = ((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC) ?
447 lpcf->hDC :
448 GetDC(0);
449 if(!ret) ERR("HDC failure!!!\n");
450 return ret;
451}
#define ERR(fmt,...)
Definition: precomp.h:57
#define CF_PRINTERFONTS
Definition: commdlg.h:60
return ret
Definition: mutex.c:147
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by AddFontStyle(), CFn_WMCommand(), and CFn_WMInitDialog().

◆ CFn_HookCallChk32()

static BOOL CFn_HookCallChk32 ( const CHOOSEFONTW *  lpcf)
static

Definition at line 291 of file fontdlg.c.

292{
293 if (lpcf)
294 if(lpcf->Flags & CF_ENABLEHOOK)
295 if (lpcf->lpfnHook)
296 return TRUE;
297 return FALSE;
298}
#define CF_ENABLEHOOK
Definition: commdlg.h:63
LPCFHOOKPROC lpfnHook
Definition: commdlg.h:287

Referenced by FormatCharDlgProcA(), and FormatCharDlgProcW().

◆ CFn_ReleaseDC()

static void CFn_ReleaseDC ( const CHOOSEFONTW *  lpcf,
HDC  hdc 
)
inlinestatic

Definition at line 471 of file fontdlg.c.

472{
473 if(!((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC))
474 ReleaseDC(0, hdc);
475}
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)

Referenced by AddFontStyle(), CFn_WMCommand(), and CFn_WMInitDialog().

◆ CFn_WMCommand()

static LRESULT CFn_WMCommand ( HWND  hDlg,
WPARAM  wParam,
LPARAM  lParam,
LPCHOOSEFONTW  lpcf 
)
static

Definition at line 909 of file fontdlg.c.

910{
911 int i;
912 long l;
913 HDC hdc;
914 BOOL cmb_selected_by_edit = FALSE;
915
916 if (!lpcf) return FALSE;
917
919 {
920 int idx;
921 WCHAR str_edit[256], str_cmb[256];
922 int cmb = LOWORD(wParam);
923
924 GetDlgItemTextW(hDlg, cmb, str_edit, ARRAY_SIZE(str_edit));
925 idx = SendDlgItemMessageW(hDlg, cmb, CB_FINDSTRING, -1, (LPARAM)str_edit);
926 if(idx != -1)
927 {
928 SendDlgItemMessageW(hDlg, cmb, CB_GETLBTEXT, idx, (LPARAM)str_cmb);
929
930 /* Select listbox entry only if we have an exact match */
931 if(lstrcmpiW(str_edit, str_cmb) == 0)
932 {
933 SendDlgItemMessageW(hDlg, cmb, CB_SETCURSEL, idx, 0);
934 SendDlgItemMessageW(hDlg, cmb, CB_SETEDITSEL, 0, -1); /* Remove edit field selection */
935 cmb_selected_by_edit = TRUE;
936 }
937 }
938 }
939
940 TRACE("WM_COMMAND wParam=%08IX lParam=%08IX\n", wParam, lParam);
941 switch (LOWORD(wParam))
942 {
943 case cmb1:
944 if (HIWORD(wParam) == CBN_SELCHANGE || cmb_selected_by_edit)
945 {
946 INT pointsize; /* save current pointsize */
947 LONG pstyle; /* save current style */
948 int charset;
949 int idx;
950 if(!(hdc = CFn_GetDC(lpcf)))
951 {
952 EndDialog (hDlg, 0);
953 return TRUE;
954 }
956 pointsize = (int)SendDlgItemMessageW( hDlg, cmb3, CB_GETITEMDATA,
957 idx, 0);
959 pstyle = SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, idx, 0);
962
967 if (i!=CB_ERR)
968 {
971 LOGFONTW enumlf;
973 (LPARAM)enumlf.lfFaceName);
974 TRACE("WM_COMMAND/cmb1 =>%s\n", debugstr_w(enumlf.lfFaceName));
975 s.hWnd1=GetDlgItem(hDlg, cmb2);
976 s.hWnd2=GetDlgItem(hDlg, cmb3);
977 s.lpcf32w=lpcf;
978 enumlf.lfCharSet = DEFAULT_CHARSET; /* enum all charsets */
979 enumlf.lfPitchAndFamily = 0;
980 EnumFontFamiliesExW(hdc, &enumlf,
982 CFn_FitFontStyle(hDlg, pstyle);
983 if( pointsize != CB_ERR) CFn_FitFontSize(hDlg, pointsize);
984 if( charset != CB_ERR) CFn_FitCharSet( hDlg, charset );
985 SetCursor(hcursor);
986 }
987 CFn_ReleaseDC(lpcf, hdc);
988 }
989 break;
990 case chx1:
991 case chx2:
992 case cmb2:
993 case cmb3:
994 case cmb5:
995 if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == BN_CLICKED || cmb_selected_by_edit)
996 {
997 WCHAR str[256];
998 WINDOWINFO wininfo;
999 LPLOGFONTW lpxx=lpcf->lpLogFont;
1000
1001 TRACE("WM_COMMAND/cmb2,3 =%08IX\n", lParam);
1002
1003 /* face name */
1005 if (i==CB_ERR)
1007 else
1008 {
1010 (LPARAM)str);
1012 lpcf->nFontType = LOWORD(l);
1013 /* FIXME: lpcf->nFontType |= .... SIMULATED_FONTTYPE and so */
1014 /* same value reported to the EnumFonts
1015 call back with the extra FONTTYPE_... bits added */
1016 lpxx->lfPitchAndFamily = HIWORD(l) >> 8;
1017 }
1019
1020 /* style */
1021 i=SendDlgItemMessageW(hDlg, cmb2, CB_GETCURSEL, 0, 0);
1022 if (i!=CB_ERR)
1023 {
1025 if (0!=(lpxx->lfItalic=HIWORD(l)))
1026 lpcf->nFontType |= ITALIC_FONTTYPE;
1027 if ((lpxx->lfWeight=LOWORD(l)) > FW_MEDIUM)
1028 lpcf->nFontType |= BOLD_FONTTYPE;
1029 }
1030
1031 /* size */
1032 get_dialog_font_point_size(hDlg, lpcf);
1033
1034 /* charset */
1035 if (lpcf->Flags & CF_NOSCRIPTSEL)
1036 lpxx->lfCharSet = DEFAULT_CHARSET;
1037 else
1038 {
1039 i=SendDlgItemMessageW(hDlg, cmb5, CB_GETCURSEL, 0, 0);
1040 if (i!=CB_ERR)
1042 else
1043 lpxx->lfCharSet = DEFAULT_CHARSET;
1044 }
1047 lpxx->lfWidth=lpxx->lfOrientation=lpxx->lfEscapement=0;
1051
1052 wininfo.cbSize=sizeof(wininfo);
1053
1054 if( GetWindowInfo( GetDlgItem( hDlg, stc5), &wininfo ) )
1055 {
1056 MapWindowPoints( 0, hDlg, (LPPOINT) &wininfo.rcWindow, 2);
1057 InvalidateRect( hDlg, &wininfo.rcWindow, TRUE );
1058 }
1059 }
1060 break;
1061
1062 case cmb4:
1063 i=SendDlgItemMessageW(hDlg, cmb4, CB_GETCURSEL, 0, 0);
1064 if (i!=CB_ERR)
1065 {
1066 WINDOWINFO wininfo;
1067
1069 wininfo.cbSize=sizeof(wininfo);
1070
1071 if( GetWindowInfo( GetDlgItem( hDlg, stc5), &wininfo ) )
1072 {
1073 MapWindowPoints( 0, hDlg, (LPPOINT) &wininfo.rcWindow, 2);
1074 InvalidateRect( hDlg, &wininfo.rcWindow, TRUE );
1075 }
1076 }
1077 break;
1078
1079 case psh15:
1081 if (lpcf->hwndOwner)
1083 break;
1084
1085 case IDOK:
1086 {
1087 WCHAR msgW[80];
1088 INT pointsize;
1089
1090 pointsize = get_dialog_font_point_size(hDlg, lpcf);
1091 if (pointsize == -1)
1092 {
1094 MessageBoxW(hDlg, msgW, NULL, MB_OK | MB_ICONINFORMATION);
1095 return TRUE;
1096 }
1097
1098 if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||
1099 ( (lpcf->Flags & CF_LIMITSIZE) &&
1100 (lpcf->iPointSize >= 10 * lpcf->nSizeMin) &&
1101 (lpcf->iPointSize <= 10 * lpcf->nSizeMax)))
1102 EndDialog(hDlg, TRUE);
1103 else
1104 {
1105 WCHAR format[80];
1106 DWORD_PTR args[2];
1108 args[0] = lpcf->nSizeMin;
1109 args[1] = lpcf->nSizeMax;
1111 format, 0, 0, msgW, ARRAY_SIZE(msgW), (va_list *)args);
1112 MessageBoxW(hDlg, msgW, NULL, MB_OK);
1113 }
1114 return(TRUE);
1115 }
1116 case IDCANCEL:
1117 EndDialog(hDlg, FALSE);
1118 return(TRUE);
1119 }
1120 return(FALSE);
1121}
r l[0]
Definition: byte_order.h:168
#define IDS_FONT_SIZE_INPUT
Definition: cdlg.h:162
#define IDS_FONT_SIZE
Definition: cdlg.h:155
HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define HELPMSGSTRINGW
Definition: commdlg.h:27
#define BOLD_FONTTYPE
Definition: commdlg.h:90
#define CF_NOSCRIPTSEL
Definition: commdlg.h:85
#define ITALIC_FONTTYPE
Definition: commdlg.h:91
#define cmb1
Definition: dlgs.h:53
#define stc5
Definition: dlgs.h:169
#define cmb4
Definition: dlgs.h:56
#define chx1
Definition: dlgs.h:36
#define chx2
Definition: dlgs.h:37
#define psh15
Definition: dlgs.h:131
#define NULL
Definition: types.h:112
unsigned int idx
Definition: utils.c:40
static BOOL CFn_FitFontStyle(HWND hDlg, LONG packedstyle)
Definition: fontdlg.c:556
static void CFn_FitFontSize(HWND hDlg, int points)
Definition: fontdlg.c:536
static INT get_dialog_font_point_size(HWND hDlg, CHOOSEFONTW *cf)
Definition: fontdlg.c:881
static BOOL CFn_FitCharSet(HWND hDlg, int charset)
Definition: fontdlg.c:574
static INT WINAPI FontStyleEnumProc(const ENUMLOGFONTEXW *lpElfex, const TEXTMETRICW *metrics, DWORD dwFontType, LPARAM lParam)
Definition: fontdlg.c:596
static const WCHAR strWineFontData[]
Definition: fontdlg.c:50
#define lstrcpynW
Definition: compat.h:738
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4171
char * va_list
Definition: vadefs.h:50
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLdouble s
Definition: gl.h:2039
#define LOWORD(l)
Definition: pedump.c:82
#define CB_GETLBTEXT
Definition: winuser.h:1981
#define IDCANCEL
Definition: winuser.h:842
BOOL WINAPI GetWindowInfo(_In_ HWND, _Inout_ PWINDOWINFO)
#define CB_SETCURSEL
Definition: winuser.h:1990
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define CB_RESETCONTENT
Definition: winuser.h:1988
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2474
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define IDOK
Definition: winuser.h:841
#define CBN_SELCHANGE
Definition: winuser.h:2008
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
UINT WINAPI RegisterWindowMessageW(_In_ LPCWSTR)
#define MB_OK
Definition: winuser.h:801
#define CB_SETEDITSEL
Definition: winuser.h:1992
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
#define MB_ICONINFORMATION
Definition: winuser.h:813
#define IDC_WAIT
Definition: winuser.h:697
#define BN_CLICKED
Definition: winuser.h:1954
#define CB_FINDSTRING
Definition: winuser.h:1968
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define CB_GETCURSEL
Definition: winuser.h:1972
#define CBN_EDITCHANGE
Definition: winuser.h:2004
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
const WCHAR * str
#define LoadStringW
Definition: utils.h:64
Definition: match.c:390
INT iPointSize
Definition: commdlg.h:283
LPLOGFONTW lpLogFont
Definition: commdlg.h:282
HWND hwndOwner
Definition: commdlg.h:280
WORD nFontType
Definition: commdlg.h:291
DWORD rgbColors
Definition: commdlg.h:285
BYTE lfOutPrecision
Definition: dwrite.idl:1130
LONG lfWidth
Definition: dwrite.idl:1122
BYTE lfCharSet
Definition: dwrite.idl:1129
BYTE lfQuality
Definition: dwrite.idl:1132
BYTE lfUnderline
Definition: dwrite.idl:1127
LONG lfOrientation
Definition: dwrite.idl:1124
WCHAR lfFaceName[LF_FACESIZE]
Definition: dwrite.idl:1134
BYTE lfItalic
Definition: dwrite.idl:1126
BYTE lfStrikeOut
Definition: dwrite.idl:1128
LONG lfWeight
Definition: dwrite.idl:1125
BYTE lfClipPrecision
Definition: dwrite.idl:1131
LONG lfEscapement
Definition: dwrite.idl:1123
BYTE lfPitchAndFamily
Definition: dwrite.idl:1133
DWORD cbSize
Definition: winuser.h:3874
RECT rcWindow
Definition: winuser.h:3875
uint32_t DWORD_PTR
Definition: typedefs.h:65
uint16_t * LPWSTR
Definition: typedefs.h:56
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2283
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:398
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:401
HICON HCURSOR
Definition: windef.h:99
int WINAPI EnumFontFamiliesExW(_In_ HDC, _In_ PLOGFONTW, _In_ FONTENUMPROCW, _In_ LPARAM, _In_ DWORD)
#define DEFAULT_QUALITY
Definition: wingdi.h:436
FARPROC FONTENUMPROCW
Definition: wingdi.h:3343
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:415
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:426
#define FW_MEDIUM
Definition: wingdi.h:375

Referenced by FormatCharDlgProcA(), and FormatCharDlgProcW().

◆ CFn_WMDestroy()

static LRESULT CFn_WMDestroy ( HWND  hwnd,
LPCHOOSEFONTW  lpcfw 
)
static

Definition at line 1123 of file fontdlg.c.

1124{
1125 LPCHOOSEFONTA lpcfa;
1126 LPSTR lpszStyle;
1127 LPLOGFONTA lpLogFonta;
1128 int len;
1129
1130 if (!lpcfw) return FALSE;
1131
1133 lpLogFonta = lpcfa->lpLogFont;
1134 lpszStyle = lpcfa->lpszStyle;
1135 memcpy(lpcfa, lpcfw, sizeof(CHOOSEFONTA));
1136 lpcfa->lpLogFont = lpLogFonta;
1137 lpcfa->lpszStyle = lpszStyle;
1138 memcpy(lpcfa->lpLogFont, lpcfw->lpLogFont, sizeof(LOGFONTA));
1141
1142 if((lpcfw->Flags & CF_USESTYLE) && lpcfw->lpszStyle) {
1143 len = WideCharToMultiByte(CP_ACP, 0, lpcfw->lpszStyle, -1, NULL, 0, 0, 0);
1144 WideCharToMultiByte(CP_ACP, 0, lpcfw->lpszStyle, -1, lpcfa->lpszStyle, len, 0, 0);
1145 heap_free(lpcfw->lpszStyle);
1146 }
1147
1148 heap_free(lpcfw->lpLogFont);
1149 heap_free(lpcfw);
1151
1152 return TRUE;
1153}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define CF_USESTYLE
Definition: commdlg.h:67
#define LF_FACESIZE
Definition: dimm.idl:39
static const WCHAR strWineFontData_a[]
Definition: fontdlg.c:51
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
GLenum GLsizei len
Definition: glext.h:6722
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
LPLOGFONTA lpLogFont
Definition: commdlg.h:264
LPSTR lpszStyle
Definition: commdlg.h:272
LPWSTR lpszStyle
Definition: commdlg.h:290
CHAR lfFaceName[LF_FACESIZE]
Definition: wingdi.h:2340
char * LPSTR
Definition: typedefs.h:51

Referenced by FormatCharDlgProcA().

◆ CFn_WMDrawItem()

static LRESULT CFn_WMDrawItem ( LPARAM  lParam)
static

Definition at line 779 of file fontdlg.c.

780{
781 HBRUSH hBrush;
782 WCHAR buffer[40];
783 COLORREF cr, oldText=0, oldBk=0;
784 RECT rect;
785 int nFontType;
786 int cx, cy, idx;
788
789 if (lpdi->itemID == (UINT)-1) /* got no items */
790 DrawFocusRect(lpdi->hDC, &lpdi->rcItem);
791 else
792 {
793 if (lpdi->CtlType == ODT_COMBOBOX)
794 {
795 if (lpdi->itemState & ODS_SELECTED)
796 {
800 } else
801 {
803 SelectObject(lpdi->hDC, hBrush);
804 }
805 FillRect(lpdi->hDC, &lpdi->rcItem, hBrush);
806 }
807 else
808 return TRUE; /* this should never happen */
809
810 rect=lpdi->rcItem;
811 switch (lpdi->CtlID)
812 {
813 case cmb1:
814 /* TRACE(commdlg,"WM_Drawitem cmb1\n"); */
817 (LPARAM)buffer);
818 TextOutW(lpdi->hDC, lpdi->rcItem.left + cx + 4,
819 lpdi->rcItem.top, buffer, lstrlenW(buffer));
820 nFontType = SendMessageW(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L);
821 idx = -1;
822 if (nFontType & TRUETYPE_FONTTYPE) {
823 idx = 0; /* picture: TT */
824 if( nFontType & NTM_TT_OPENTYPE)
825 idx = 2; /* picture: O */
826 } else if( nFontType & NTM_PS_OPENTYPE)
827 idx = 3; /* picture: O+ps */
828 else if( nFontType & NTM_TYPE1)
829 idx = 4; /* picture: a */
830 else if( nFontType & DEVICE_FONTTYPE)
831 idx = 1; /* picture: printer */
832 if( idx >= 0)
833 ImageList_Draw( himlTT, idx, lpdi->hDC, lpdi->rcItem.left,
834 (lpdi->rcItem.top + lpdi->rcItem.bottom - cy) / 2, ILD_TRANSPARENT);
835 break;
836 case cmb2:
837 case cmb3:
838 /* TRACE(commdlg,"WM_DRAWITEN cmb2,cmb3\n"); */
839 case cmb5:
841 (LPARAM)buffer);
842 TextOutW(lpdi->hDC, lpdi->rcItem.left,
843 lpdi->rcItem.top, buffer, lstrlenW(buffer));
844 break;
845
846 case cmb4:
847 /* TRACE(commdlg,"WM_DRAWITEM cmb4 (=COLOR)\n"); */
849 (LPARAM)buffer);
850 TextOutW(lpdi->hDC, lpdi->rcItem.left + 25+5,
851 lpdi->rcItem.top, buffer, lstrlenW(buffer));
852 cr = SendMessageW(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L);
853 hBrush = CreateSolidBrush(cr);
854 if (hBrush)
855 {
856 hBrush = SelectObject (lpdi->hDC, hBrush) ;
857 rect.right=rect.left+25;
858 rect.top++;
859 rect.left+=5;
860 rect.bottom--;
861 Rectangle( lpdi->hDC, rect.left, rect.top,
863 DeleteObject( SelectObject (lpdi->hDC, hBrush)) ;
864 }
865 rect=lpdi->rcItem;
866 rect.left+=25+5;
867 break;
868
869 default:
870 return TRUE; /* this should never happen */
871 }
872 if (lpdi->itemState & ODS_SELECTED)
873 {
874 SetTextColor(lpdi->hDC, oldText);
875 SetBkColor(lpdi->hDC, oldBk);
876 }
877 }
878 return TRUE;
879}
RECT rect
Definition: combotst.c:67
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1246
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2055
static HIMAGELIST himlTT
Definition: fontdlg.c:54
#define lstrlenW
Definition: compat.h:750
pKey DeleteObject()
unsigned int UINT
Definition: sysinfo.c:13
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
#define ILD_TRANSPARENT
Definition: commctrl.h:418
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define ODT_COMBOBOX
Definition: winuser.h:2575
DWORD WINAPI GetSysColor(_In_ int)
#define ODS_SELECTED
Definition: winuser.h:2581
#define COLOR_HIGHLIGHT
Definition: winuser.h:937
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:938
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
DWORD COLORREF
Definition: windef.h:100
HGDIOBJ WINAPI GetStockObject(_In_ int)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
#define LTGRAY_BRUSH
Definition: wingdi.h:900
#define DEVICE_FONTTYPE
Definition: wingdi.h:1108
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define NTM_TT_OPENTYPE
Definition: wingdi.h:27
#define NTM_PS_OPENTYPE
Definition: wingdi.h:26
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:917
#define NTM_TYPE1
Definition: wingdi.h:29
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)

Referenced by FormatCharDlgProcA(), and FormatCharDlgProcW().

◆ CFn_WMInitDialog()

static LRESULT CFn_WMInitDialog ( HWND  hDlg,
LPARAM  lParam,
LPCHOOSEFONTW  lpcf 
)
static

Definition at line 610 of file fontdlg.c.

611{
612 HDC hdc;
613 int i,j;
614 BOOL init = FALSE;
615 long pstyle;
617 LPLOGFONTW lpxx;
619
620 SetPropW(hDlg, strWineFontData, lpcf);
621 lpxx=lpcf->lpLogFont;
622 TRACE("WM_INITDIALOG lParam=%08IX\n", lParam);
623
624 if (lpcf->lStructSize != sizeof(CHOOSEFONTW))
625 {
626 ERR("structure size failure!!!\n");
627 EndDialog (hDlg, 0);
628 return FALSE;
629 }
630 if (!himlTT)
633
634 /* Set effect flags */
635 if((lpcf->Flags & CF_EFFECTS) && (lpcf->Flags & CF_INITTOLOGFONTSTRUCT))
636 {
637 if(lpxx->lfUnderline)
638 CheckDlgButton(hDlg, chx2, TRUE);
639 if(lpxx->lfStrikeOut)
640 CheckDlgButton(hDlg, chx1, TRUE);
641 }
642
643 if (!(lpcf->Flags & CF_SHOWHELP) || !IsWindow(lpcf->hwndOwner))
645 if (!(lpcf->Flags & CF_APPLY))
647 if (lpcf->Flags & CF_NOSCRIPTSEL)
649 if (lpcf->Flags & CF_EFFECTS)
650 {
651 for (i=0;i<TEXT_COLORS;i++)
652 {
653 WCHAR name[30];
654
656 lstrcpyW(name, L"[color name]");
659 /* look for a fitting value in color combobox */
660 if (textcolors[i]==lpcf->rgbColors)
662 }
663 }
664 else
665 {
671 }
672 if(!(hdc = CFn_GetDC(lpcf)))
673 {
674 EndDialog (hDlg, 0);
675 return FALSE;
676 }
677 s.hWnd1=GetDlgItem(hDlg,cmb1);
678 s.lpcf32w=lpcf;
679 do {
680 LOGFONTW elf;
681 s.added = 0;
682 elf.lfCharSet = DEFAULT_CHARSET; /* enum all charsets */
683 elf.lfPitchAndFamily = 0;
684 elf.lfFaceName[0] = '\0'; /* enum all fonts */
686 {
687 TRACE("EnumFontFamiliesEx returns 0\n");
688 break;
689 }
690 if (s.added) break;
691 if (lpcf->Flags & CF_FIXEDPITCHONLY) {
692 FIXME("No font found with fixed pitch only, dropping flag.\n");
693 lpcf->Flags &= ~CF_FIXEDPITCHONLY;
694 continue;
695 }
696 if (lpcf->Flags & CF_TTONLY) {
697 FIXME("No font found with truetype only, dropping flag.\n");
698 lpcf->Flags &= ~CF_TTONLY;
699 continue;
700 }
701 break;
702 } while (1);
703
704
705 if (lpcf->Flags & CF_INITTOLOGFONTSTRUCT)
706 {
707 /* look for fitting font name in combobox1 */
709 if (j!=CB_ERR)
710 {
711 INT height = lpxx->lfHeight < 0 ? -lpxx->lfHeight :
712 lpxx->lfHeight;
713 INT points;
714 int charset = lpxx->lfCharSet;
715 points = MulDiv( height, 72, GetScreenDPI());
716 pstyle = MAKELONG(lpxx->lfWeight > FW_MEDIUM ? FW_BOLD:
717 FW_NORMAL,lpxx->lfItalic !=0);
718 select_combo_item( hDlg, cmb1, j );
719 init = TRUE;
720 /* look for fitting font style in combobox2 */
721 CFn_FitFontStyle(hDlg, pstyle);
722 /* look for fitting font size in combobox3 */
723 CFn_FitFontSize(hDlg, points);
724 CFn_FitCharSet( hDlg, charset );
725 }
726 }
727 if (!init)
728 {
729 select_combo_item( hDlg, cmb1, 0 );
730 select_combo_item( hDlg, cmb2, 0 );
731 select_combo_item( hDlg, cmb3, 0 );
732 select_combo_item( hDlg, cmb5, 0 );
733 }
734 /* limit text length user can type in as font size */
736
737 if ((lpcf->Flags & CF_USESTYLE) && lpcf->lpszStyle)
738 {
740 if (j!=CB_ERR) select_combo_item( hDlg, cmb2, j );
741 }
742 CFn_ReleaseDC(lpcf, hdc);
743 SetCursor(hcursor);
744 return TRUE;
745}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define IDS_COLOR_BLACK
Definition: cdlg.h:138
#define CF_APPLY
Definition: commdlg.h:69
#define CF_EFFECTS
Definition: commdlg.h:68
#define CF_INITTOLOGFONTSTRUCT
Definition: commdlg.h:66
#define CF_SHOWHELP
Definition: commdlg.h:62
#define pshHelp
Definition: dlgs.h:132
#define psh3
Definition: dlgs.h:119
#define stc4
Definition: dlgs.h:168
#define grp1
Definition: dlgs.h:91
HIMAGELIST WINAPI ImageList_LoadImageW(HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow, COLORREF clrMask, UINT uType, UINT uFlags)
Definition: imagelist.c:2226
#define TTBITMAP_XSIZE
Definition: fontdlg.c:55
static const COLORREF textcolors[TEXT_COLORS]
Definition: fontdlg.c:280
#define TEXT_COLORS
Definition: fontdlg.c:278
static INT WINAPI FontFamilyEnumProc(const ENUMLOGFONTEXW *lpElfex, const TEXTMETRICW *metrics, DWORD dwFontType, LPARAM lParam)
Definition: fontdlg.c:343
#define lstrcpyW
Definition: compat.h:749
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define CLR_DEFAULT
Definition: commctrl.h:320
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define SW_HIDE
Definition: winuser.h:779
#define IMAGE_BITMAP
Definition: winuser.h:211
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define CB_LIMITTEXT
Definition: winuser.h:1987
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
DWORD lStructSize
Definition: commdlg.h:279
LONG lfHeight
Definition: dwrite.idl:1121
#define FW_BOLD
Definition: wingdi.h:378
#define FW_NORMAL
Definition: wingdi.h:373
static int init
Definition: wintirpc.c:33

Referenced by FormatCharDlgProcA(), and FormatCharDlgProcW().

◆ CFn_WMMeasureItem()

static LRESULT CFn_WMMeasureItem ( HWND  hDlg,
LPARAM  lParam 
)
static

Definition at line 751 of file fontdlg.c.

752{
753 HDC hdc;
754 HFONT hfontprev;
757 INT height = 0, cx;
758
759 if (!himlTT)
763 lpmi->itemHeight = height + 2;
764 /* use MAX of bitmap height and tm.tmHeight .*/
765 hdc=GetDC(hDlg);
766 if(!hdc) return 0;
767 hfontprev = SelectObject( hdc, (HFONT)SendMessageW( hDlg, WM_GETFONT, 0, 0 ));
769 if( tm.tmHeight > lpmi->itemHeight) lpmi->itemHeight = tm.tmHeight;
770 SelectObject(hdc, hfontprev);
771 ReleaseDC(hDlg, hdc);
772 return 0;
773}
struct tagMEASUREITEMSTRUCT * LPMEASUREITEMSTRUCT
#define WM_GETFONT
Definition: winuser.h:1679
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221

Referenced by FormatCharDlgProcA(), and FormatCharDlgProcW().

◆ CFn_WMPaint()

static LRESULT CFn_WMPaint ( HWND  hDlg,
WPARAM  wParam,
LPARAM  lParam,
const CHOOSEFONTW *  lpcf 
)
static

Definition at line 1155 of file fontdlg.c.

1156{
1158
1159 if (!lpcf) return FALSE;
1160
1161 info.cbSize=sizeof(info);
1162 if( GetWindowInfo( GetDlgItem( hDlg, stc5), &info ) )
1163 {
1164 PAINTSTRUCT ps;
1165 HDC hdc;
1166 HFONT hOrigFont;
1167 LOGFONTW lf = *(lpcf->lpLogFont);
1168
1169 MapWindowPoints( 0, hDlg, (LPPOINT) &info.rcWindow, 2);
1170 hdc = BeginPaint( hDlg, &ps );
1171
1172 TRACE("erase %d, rect=%s\n", ps.fErase, wine_dbgstr_rect(&ps.rcPaint));
1173
1174 /* Paint frame */
1175 DrawEdge( hdc, &info.rcWindow, EDGE_SUNKEN, BF_RECT|BF_ADJUST );
1176
1177 /* Draw the sample text itself */
1178 hOrigFont = SelectObject( hdc, CreateFontIndirectW( &lf ) );
1179 SetTextColor( hdc, lpcf->rgbColors );
1181
1182 DrawTextW( hdc,
1184 -1, &info.rcWindow, DT_CENTER|DT_VCENTER|DT_SINGLELINE );
1185
1186 DeleteObject(SelectObject( hdc, hOrigFont ));
1187 EndPaint( hDlg, &ps );
1188 }
1189 return FALSE;
1190}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
static const WCHAR *const sample_lang_text[]
Definition: fontdlg.c:67
static const BYTE CHARSET_ORDER[256]
Definition: fontdlg.c:100
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define EDGE_SUNKEN
Definition: winuser.h:451
#define DT_CENTER
Definition: winuser.h:527
#define DT_SINGLELINE
Definition: winuser.h:540
#define BF_ADJUST
Definition: winuser.h:470
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define DT_VCENTER
Definition: winuser.h:543
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define BF_RECT
Definition: winuser.h:462
#define TRANSPARENT
Definition: wingdi.h:950
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056

Referenced by FormatCharDlgProcA(), and FormatCharDlgProcW().

◆ ChooseFontA()

BOOL WINAPI ChooseFontA ( LPCHOOSEFONTA  lpChFont)

Definition at line 229 of file fontdlg.c.

230{
231 LPCVOID template;
232 HRSRC hResInfo;
233 HINSTANCE hDlginst;
234 HGLOBAL hDlgTmpl;
235
236 TRACE("(%p)\n", lpChFont);
237
238 if ( (lpChFont->Flags&CF_ENABLETEMPLATEHANDLE)!=0 )
239 {
240 template=lpChFont->hInstance;
241 } else
242 {
243 if ( (lpChFont->Flags&CF_ENABLETEMPLATE)!=0 )
244 {
245 hDlginst=lpChFont->hInstance;
246 if( !(hResInfo = FindResourceA(hDlginst, lpChFont->lpTemplateName,
247 (LPSTR)RT_DIALOG)))
248 {
250 return FALSE;
251 }
252 } else
253 {
254 hDlginst=COMDLG32_hInstance;
255 if (!(hResInfo = FindResourceW(hDlginst, L"CHOOSE_FONT", (LPWSTR)RT_DIALOG)))
256 {
258 return FALSE;
259 }
260 }
261 if (!(hDlgTmpl = LoadResource(hDlginst, hResInfo )) ||
262 !(template = LockResource( hDlgTmpl )))
263 {
265 return FALSE;
266 }
267 }
268 if (TRACE_ON(commdlg))
269 _dump_cf_flags(lpChFont->Flags);
270 if (lpChFont->Flags & CF_SELECTSCRIPT)
271 FIXME(": unimplemented flag (ignored)\n");
272
274 lpChFont->hwndOwner, FormatCharDlgProcA, (LPARAM)lpChFont );
275}
#define CDERR_LOADRESFAILURE
Definition: cderr.h:12
#define CDERR_FINDRESFAILURE
Definition: cderr.h:11
void COMDLG32_SetCommDlgExtendedError(DWORD err)
Definition: cdlg32.c:124
#define CF_ENABLETEMPLATEHANDLE
Definition: commdlg.h:65
#define CF_SELECTSCRIPT
Definition: commdlg.h:84
#define CF_ENABLETEMPLATE
Definition: commdlg.h:64
static INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: fontdlg.c:1195
static void _dump_cf_flags(DWORD cflags)
Definition: fontdlg.c:152
#define TRACE_ON(x)
Definition: compat.h:75
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
CONST void * LPCVOID
Definition: minwindef.h:164
#define RT_DIALOG
Definition: pedump.c:367
INT_PTR WINAPI DialogBoxIndirectParamA(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
LPCSTR lpTemplateName
Definition: commdlg.h:270
HINSTANCE hInstance
Definition: commdlg.h:271
HWND hwndOwner
Definition: commdlg.h:262
DWORD Flags
Definition: commdlg.h:266

Referenced by test_ChooseFontA().

◆ ChooseFontW()

BOOL WINAPI ChooseFontW ( LPCHOOSEFONTW  lpChFont)

Definition at line 175 of file fontdlg.c.

176{
177 LPCVOID template;
178 HRSRC hResInfo;
179 HINSTANCE hDlginst;
180 HGLOBAL hDlgTmpl;
181
182 TRACE("(%p)\n", lpChFont);
183
184 if ( (lpChFont->Flags&CF_ENABLETEMPLATEHANDLE)!=0 )
185 {
186 template=lpChFont->hInstance;
187 } else
188 {
189 if ( (lpChFont->Flags&CF_ENABLETEMPLATE)!=0 )
190 {
191 hDlginst=lpChFont->hInstance;
192 if( !(hResInfo = FindResourceW(hDlginst, lpChFont->lpTemplateName,
193 (LPWSTR)RT_DIALOG)))
194 {
196 return FALSE;
197 }
198 } else
199 {
200 hDlginst=COMDLG32_hInstance;
201 if (!(hResInfo = FindResourceW(hDlginst, L"CHOOSE_FONT", (LPWSTR)RT_DIALOG)))
202 {
204 return FALSE;
205 }
206 }
207 if (!(hDlgTmpl = LoadResource(hDlginst, hResInfo )) ||
208 !(template = LockResource( hDlgTmpl )))
209 {
211 return FALSE;
212 }
213 }
214 if (TRACE_ON(commdlg))
215 _dump_cf_flags(lpChFont->Flags);
216
217 if (lpChFont->Flags & CF_SELECTSCRIPT)
218 FIXME(": unimplemented flag (ignored)\n");
219
221 lpChFont->hwndOwner, FormatCharDlgProcW, (LPARAM)lpChFont );
222}
static INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: fontdlg.c:1261
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
HINSTANCE hInstance
Definition: commdlg.h:289
LPCWSTR lpTemplateName
Definition: commdlg.h:288

Referenced by dialog_choose_font(), and OSK_ChooseFont().

◆ FontFamilyEnumProc()

static INT WINAPI FontFamilyEnumProc ( const ENUMLOGFONTEXW *  lpElfex,
const TEXTMETRICW *  metrics,
DWORD  dwFontType,
LPARAM  lParam 
)
static

Definition at line 343 of file fontdlg.c.

345{
348 return AddFontFamily( lpElfex, (const NEWTEXTMETRICEXW *) metrics,
349 dwFontType, e->lpcf32w, e->hWnd1, e);
350}
struct CFn_ENUMSTRUCT * LPCFn_ENUMSTRUCT
static INT AddFontFamily(const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM, UINT nFontType, const CHOOSEFONTW *lpcf, HWND hwnd, LPCFn_ENUMSTRUCT e)
Definition: fontdlg.c:303
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
Definition: glext.h:11745

Referenced by CFn_WMInitDialog().

◆ FontStyleEnumProc()

static INT WINAPI FontStyleEnumProc ( const ENUMLOGFONTEXW *  lpElfex,
const TEXTMETRICW *  metrics,
DWORD  dwFontType,
LPARAM  lParam 
)
static

Definition at line 596 of file fontdlg.c.

598{
600 HWND hcmb2=s->hWnd1;
601 HWND hcmb3=s->hWnd2;
602 HWND hDlg=GetParent(hcmb3);
603 return AddFontStyle( lpElfex, (const NEWTEXTMETRICEXW *) metrics,
604 dwFontType, s->lpcf32w, hcmb2, hcmb3, hDlg);
605}
static INT AddFontStyle(const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM, UINT nFontType, const CHOOSEFONTW *lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg)
Definition: fontdlg.c:490
HWND WINAPI GetParent(_In_ HWND)

Referenced by CFn_WMCommand().

◆ FormatCharDlgProcA()

static INT_PTR CALLBACK FormatCharDlgProcA ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1195 of file fontdlg.c.

1196{
1197 LPCHOOSEFONTW lpcfw;
1198 LPCHOOSEFONTA lpcfa;
1199 INT_PTR res = FALSE;
1200 int len;
1201
1202 if (uMsg!=WM_INITDIALOG) {
1203 lpcfw = GetPropW(hDlg, strWineFontData);
1204 if (lpcfw && CFn_HookCallChk32(lpcfw))
1205 res=CallWindowProcA((WNDPROC)lpcfw->lpfnHook, hDlg, uMsg, wParam, lParam);
1206 if (res)
1207 return res;
1208 } else {
1209 lpcfa=(LPCHOOSEFONTA)lParam;
1211
1212 lpcfw = heap_alloc(sizeof(*lpcfw));
1213 memcpy(lpcfw, lpcfa, sizeof(CHOOSEFONTA));
1214 lpcfw->lpLogFont = heap_alloc(sizeof(*lpcfw->lpLogFont));
1215 memcpy(lpcfw->lpLogFont, lpcfa->lpLogFont, sizeof(LOGFONTA));
1218
1219 if((lpcfa->Flags & CF_USESTYLE) && lpcfa->lpszStyle) {
1220 len = MultiByteToWideChar(CP_ACP, 0, lpcfa->lpszStyle, -1, NULL, 0);
1221 lpcfw->lpszStyle = heap_alloc(len * sizeof(WCHAR));
1222 MultiByteToWideChar(CP_ACP, 0, lpcfa->lpszStyle, -1, lpcfw->lpszStyle, len);
1223 }
1224
1225 if (!CFn_WMInitDialog(hDlg, lParam, lpcfw))
1226 {
1227 TRACE("CFn_WMInitDialog returned FALSE\n");
1228 return FALSE;
1229 }
1230 if (CFn_HookCallChk32(lpcfw))
1232 }
1233 switch (uMsg)
1234 {
1235 case WM_MEASUREITEM:
1236 return CFn_WMMeasureItem(hDlg,lParam);
1237 case WM_DRAWITEM:
1238 return CFn_WMDrawItem(lParam);
1239 case WM_COMMAND:
1240 return CFn_WMCommand(hDlg, wParam, lParam, lpcfw);
1241 case WM_DESTROY:
1242 return CFn_WMDestroy(hDlg, lpcfw);
1244 {
1245 LOGFONTA *logfont = (LOGFONTA *)lParam;
1246 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08IX\n", lParam);
1247 memcpy( logfont, lpcfw->lpLogFont, FIELD_OFFSET( LOGFONTA, lfFaceName ));
1249 logfont->lfFaceName, LF_FACESIZE, NULL, NULL );
1250 break;
1251 }
1252 case WM_PAINT:
1253 return CFn_WMPaint(hDlg, wParam, lParam, lpcfw);
1254 }
1255 return res;
1256}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
#define WM_CHOOSEFONT_GETLOGFONT
Definition: commdlg.h:93
struct tagCHOOSEFONTA * LPCHOOSEFONTA
static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam, LPCHOOSEFONTW lpcf)
Definition: fontdlg.c:909
static LRESULT CFn_WMDrawItem(LPARAM lParam)
Definition: fontdlg.c:779
static LRESULT CFn_WMInitDialog(HWND hDlg, LPARAM lParam, LPCHOOSEFONTW lpcf)
Definition: fontdlg.c:610
static BOOL CFn_HookCallChk32(const CHOOSEFONTW *lpcf)
Definition: fontdlg.c:291
static LRESULT CFn_WMDestroy(HWND hwnd, LPCHOOSEFONTW lpcfw)
Definition: fontdlg.c:1123
static LRESULT CFn_WMMeasureItem(HWND hDlg, LPARAM lParam)
Definition: fontdlg.c:751
static LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam, const CHOOSEFONTW *lpcf)
Definition: fontdlg.c:1155
#define MultiByteToWideChar
Definition: compat.h:110
#define WM_PAINT
Definition: winuser.h:1648
#define WM_COMMAND
Definition: winuser.h:1768
#define WM_INITDIALOG
Definition: winuser.h:1767
#define WM_DRAWITEM
Definition: winuser.h:1673
#define WM_MEASUREITEM
Definition: winuser.h:1674
#define WM_DESTROY
Definition: winuser.h:1637
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:3014
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
LPCFHOOKPROC lpfnHook
Definition: commdlg.h:269
int32_t INT_PTR
Definition: typedefs.h:64
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by ChooseFontA().

◆ FormatCharDlgProcW()

static INT_PTR CALLBACK FormatCharDlgProcW ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1261 of file fontdlg.c.

1262{
1263 LPCHOOSEFONTW lpcf;
1264 INT_PTR res = FALSE;
1265
1266 if (uMsg!=WM_INITDIALOG)
1267 {
1268 lpcf= GetPropW(hDlg, strWineFontData);
1269 if (lpcf && CFn_HookCallChk32(lpcf))
1270 res=CallWindowProcW((WNDPROC)lpcf->lpfnHook, hDlg, uMsg, wParam, lParam);
1271 if (res)
1272 return res;
1273 }
1274 else
1275 {
1276 lpcf=(LPCHOOSEFONTW)lParam;
1277 if (!CFn_WMInitDialog(hDlg, lParam, lpcf))
1278 {
1279 TRACE("CFn_WMInitDialog returned FALSE\n");
1280 return FALSE;
1281 }
1282 if (CFn_HookCallChk32(lpcf))
1284 }
1285 switch (uMsg)
1286 {
1287 case WM_MEASUREITEM:
1288 return CFn_WMMeasureItem(hDlg, lParam);
1289 case WM_DRAWITEM:
1290 return CFn_WMDrawItem(lParam);
1291 case WM_COMMAND:
1292 return CFn_WMCommand(hDlg, wParam, lParam, lpcf);
1293 case WM_DESTROY:
1294 return TRUE;
1296 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08IX\n", lParam);
1297 memcpy( (LOGFONTW *)lParam, lpcf->lpLogFont, sizeof(LOGFONTW) );
1298 break;
1299 case WM_PAINT:
1300 return CFn_WMPaint(hDlg, wParam, lParam, lpcf);
1301 }
1302 return res;
1303}
struct tagCHOOSEFONTW * LPCHOOSEFONTW
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ChooseFontW().

◆ get_dialog_font_point_size()

static INT get_dialog_font_point_size ( HWND  hDlg,
CHOOSEFONTW *  cf 
)
static

Definition at line 881 of file fontdlg.c.

882{
883 BOOL invalid_size = FALSE;
884 INT i, size;
885
886 i = SendDlgItemMessageW(hDlg, cmb3, CB_GETCURSEL, 0, 0);
887 if (i != CB_ERR)
889 else
890 {
891 WCHAR buffW[8], *endptrW;
892
893 GetDlgItemTextW(hDlg, cmb3, buffW, ARRAY_SIZE(buffW));
894 size = wcstol(buffW, &endptrW, 10);
895 invalid_size = size == 0 && *endptrW;
896
897 if (size == 0)
898 size = 10;
899 }
900
901 cf->iPointSize = 10 * size;
902 cf->lpLogFont->lfHeight = -MulDiv(cf->iPointSize, GetScreenDPI(), 720);
903 return invalid_size ? -1 : size;
904}
_ACRTIMP __msvcrt_long __cdecl wcstol(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2752
GLsizeiptr size
Definition: glext.h:5919

Referenced by CFn_WMCommand().

◆ GetScreenDPI()

static int GetScreenDPI ( void  )
inlinestatic

Definition at line 456 of file fontdlg.c.

457{
458 HDC hdc;
459 int result;
460
461 hdc = GetDC(0);
463 ReleaseDC(0, hdc);
464
465 return result;
466}
GLuint64EXT * result
Definition: glext.h:11304
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSY
Definition: wingdi.h:719

Referenced by AddFontStyle(), CFn_WMInitDialog(), and get_dialog_font_point_size().

◆ select_combo_item()

static void select_combo_item ( HWND  dialog,
int  id,
int  sel 
)
static

Definition at line 480 of file fontdlg.c.

481{
482 HWND combo = GetDlgItem( dialog, id );
483 SendMessageW( combo, CB_SETCURSEL, sel, 0 );
485}
static HWND dialog
Definition: gui.c:33
#define MAKEWPARAM(l, h)
Definition: winuser.h:4117

Referenced by CFn_FitCharSet(), CFn_FitFontSize(), CFn_FitFontStyle(), and CFn_WMInitDialog().

◆ SetFontSizesToCombo3()

static BOOL SetFontSizesToCombo3 ( HWND  hwnd,
const CHOOSEFONTW *  lpcf 
)
static

Definition at line 431 of file fontdlg.c.

432{
433 static const BYTE sizes[]={6,7,8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
434 unsigned int i;
435
436 for (i = 0; i < ARRAY_SIZE(sizes); i++)
437 if (AddFontSizeToCombo3(hwnd, sizes[i], lpcf)) return TRUE;
438 return FALSE;
439}
static const struct @662 sizes[]
unsigned char BYTE
Definition: xxhash.c:193

Referenced by AddFontStyle().

◆ SetFontStylesToCombo2()

static BOOL SetFontStylesToCombo2 ( HWND  hwnd,
HDC  hdc,
const LOGFONTW *  lplf 
)
static

Definition at line 357 of file fontdlg.c.

358{
359#define FSTYLES 4
360 struct FONTSTYLE
361 {
362 int italic;
363 int weight;
364 UINT resId;
365 };
366 static const struct FONTSTYLE fontstyles[FSTYLES]={
369 { 0, FW_BOLD, IDS_FONT_BOLD },
371 };
372 HFONT hf;
374 int i,j;
375 LOGFONTW lf;
376
377 lf = *lplf;
378
379 for (i=0;i<FSTYLES;i++)
380 {
381 lf.lfItalic=fontstyles[i].italic;
382 lf.lfWeight=fontstyles[i].weight;
383 hf=CreateFontIndirectW(&lf);
384 hf=SelectObject(hdc,hf);
386 hf=SelectObject(hdc,hf);
387 DeleteObject(hf);
388 /* font successful created ? */
389 if (((fontstyles[i].weight == FW_NORMAL && tm.tmWeight <= FW_MEDIUM) ||
390 (fontstyles[i].weight == FW_BOLD && tm.tmWeight > FW_MEDIUM)) &&
391 ((tm.tmItalic != 0)==fontstyles[i].italic))
392 {
393 WCHAR name[64];
394 LoadStringW(COMDLG32_hInstance, fontstyles[i].resId, name, 64);
396 if (j==CB_ERR) return TRUE;
398 MAKELONG(tm.tmWeight,fontstyles[i].italic));
399 if (j==CB_ERR) return TRUE;
400 }
401 }
402 return FALSE;
403}
#define IDS_FONT_BOLD_ITALIC
Definition: cdlg.h:134
#define IDS_FONT_ITALIC
Definition: cdlg.h:133
#define IDS_FONT_REGULAR
Definition: cdlg.h:131
#define IDS_FONT_BOLD
Definition: cdlg.h:132
#define FSTYLES
weight
Definition: sortkey.c:157

Referenced by AddFontStyle().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( commdlg  )

Variable Documentation

◆ 

const struct { ... } cfflags[]
Initial value:
= {
#define XX(x)
}

Referenced by _dump_cf_flags().

◆ CHARSET_ORDER

const BYTE CHARSET_ORDER[256]
static
Initial value:
={
CI(ANSI), 0, CI(SYMBOL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(MAC), 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
CI(JIS), CI(HANGUL), CI(JOHAB), 0, 0, 0, CI(GB2312), 0, CI(BIG5), 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, CI(GREEK), CI(TURKISH), CI(VIETNAMESE), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, CI(HEBREW), CI(ARABIC), 0, 0, 0, 0, 0, 0, 0, CI(BALTIC), 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(RUSSIAN), 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(THAI), 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(EE), 0,
CI(VISCII), CI(TCVN), CI(KOI8), CI(ISO3), CI(ISO4), CI(ISO10), CI(CELTIC), 0, 0, 0, 0, 0, 0, 0, 0, CI(OEM),
}
xD9 x84 xD8 xAD xD9 x80 xF0 x90 xAC x9A xE0 xA7 xA6 xE0 xA7 xAA xF0 x91 x84 xA4 xF0 x91 x84 x89 xF0 x91 x84 x9B xF0 x90 x8A xAB xF0 x90 x8B x89 xE2 xB2 x9E xE2 xB2 x9F xD0 xBE xD0 x9E xF0 x90 x90 x84 xF0 x90 x90 xAC xE1 x83 x98 xE1 x83 x94 xE1 x83 x90 xE1 xB2 xBF xE2 xB0 x95 xE2 xB1 x85 xCE xBF xCE x9F xE0 xA8 xA0 xE0 xA8 xB0 xE0 xA9 xA6 Kayah xEA xA4 x8D xEA xA4 x80 Khmer xE1 xA7 xA1 xE1 xA7 xAA xE0 xBB x90 Latin Subscript xE2 x82 x92 xE2 x82 x80 xEA x93 xB3 xF0 x96 xB9 xA1 xF0 x96 xB9 x9B xF0 x96 xB9 xAF xE1 x80 x9D xE1 x80 x84 xE1 x80 x82 no Old xF0 x90 xB0 x97 xF0 x90 x92 x86 xF0 x90 x92 xA0 xEA xA2 x9D xEA xA3 x90 xE0 xB6 xA7 xE0 xAF xA6 xE0 xB1 xA6 xE0 xB1 xA7 THAI
Definition: afscript.h:357
#define CI(cs)
Definition: fontdlg.c:65
@ MAC
Definition: isohybrid.c:57

Definition at line 100 of file fontdlg.c.

Referenced by CFn_WMPaint().

◆ himlTT

HIMAGELIST himlTT = 0
static

Definition at line 54 of file fontdlg.c.

Referenced by CFn_WMDrawItem(), CFn_WMInitDialog(), and CFn_WMMeasureItem().

◆ mask

Definition at line 120 of file fontdlg.c.

◆ name

Definition at line 121 of file fontdlg.c.

◆ sample_lang_text

const WCHAR* const sample_lang_text[]
static
Initial value:
={
L"AaBbYyZz",
L"Symbol",
L"Aa\x3042\x3041\x30a2\x30a1\x4e9c\x5b87",
L"\xac00\xb098\xb2e4" "AaBYyZz",
L"\x5fae\x8f6f\x4e2d\x6587\x8f6f\x4ef6",
L"\x4e2d\x6587\x5b57\x578b\x7bc4\x4f8b",
L"AaBb\x0391\x03b1\x0392\x03b2",
L"AaBb\x011e\x011f\x015e\x015f",
L"AaBb\x05e0\x05e1\x05e9\x05ea",
L"AaBb\x0627\x0628\x062c\x062f\x0647\x0648\x0632",
L"AaBbYyZz",
L"AaBb\x01a0\x01a1\x01af\x01b0",
L"AaBb\x0411\x0431\x0424\x0444",
L"AaBb\x00c1\x00e1\x00d4\x00f4",
L"AaBb\x0e2d\x0e31\x0e01\x0e29\x0e23\x0e44\x0e17\x0e22",
L"\xac00\xb098\xb2e4" "AaBYyZz",
L"AaBbYyZz",
L"AaBb\x00f8\x00f1\x00fd",
L"AaBb",
L"AaBb",
L"AaBb",
L"AaBb",
L"AaBb",
L"AaBb",
L"AaBb"
}

Definition at line 67 of file fontdlg.c.

Referenced by CFn_WMPaint().

◆ strWineFontData

const WCHAR strWineFontData[] = L"__WINE_FONTDLGDATA"
static

◆ strWineFontData_a

const WCHAR strWineFontData_a[] = L"__WINE_FONTDLGDATA_A"
static

Definition at line 51 of file fontdlg.c.

Referenced by CFn_WMDestroy(), and FormatCharDlgProcA().

◆ textcolors

const COLORREF textcolors[TEXT_COLORS]
static
Initial value:
=
{
0x00000000L,0x00000080L,0x00008000L,0x00008080L,
0x00800000L,0x00800080L,0x00808000L,0x00808080L,
0x00c0c0c0L,0x000000ffL,0x0000ff00L,0x0000ffffL,
0x00ff0000L,0x00ff00ffL,0x00ffff00L,0x00FFFFFFL
}

Definition at line 280 of file fontdlg.c.

Referenced by CFn_WMInitDialog().