ReactOS 0.4.15-dev-5664-g3bf4ef6
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_ENUMSTRUCTLPCFn_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 [] = {'_','_','W','I','N','E','_','F','O','N','T','D','L','G','D','A','T','A',0}
 
static const WCHAR strWineFontData_a []
 
static const WCHAR chooseFontW [] = {'C','H','O','O','S','E','_','F','O','N','T',0}
 
static const WCHAR fontsizefmtW [] = {'%','d',0}
 
static HIMAGELIST himlTT = 0
 
static const WCHAR stWestern [] ={'A','a','B','b','Y','y','Z','z',0}
 
static const WCHAR stSymbol [] ={'S','y','m','b','o','l',0}
 
static const WCHAR stShiftJis [] ={'A','a',0x3042,0x3041,0x30a2,0x30a1,0x4e9c,0x5b87,0}
 
static const WCHAR stHangul [] ={0xac00,0xb098,0xb2e4,'A','a','B','Y','y','Z','z',0}
 
static const WCHAR stGB2312 [] ={0x5fae,0x8f6f,0x4e2d,0x6587,0x8f6f,0x4ef6,0}
 
static const WCHAR stBIG5 [] ={0x4e2d,0x6587,0x5b57,0x578b,0x7bc4,0x4f8b,0}
 
static const WCHAR stGreek [] ={'A','a','B','b',0x0391,0x03b1,0x0392,0x03b2,0}
 
static const WCHAR stTurkish [] ={'A','a','B','b',0x011e,0x011f,0x015e,0x015f,0}
 
static const WCHAR stHebrew [] ={'A','a','B','b',0x05e0,0x05e1,0x05e9,0x05ea,0}
 
static const WCHAR stArabic [] ={'A','a','B','b',0x0627,0x0628,0x062c,0x062f,0x0647,0x0648,0x0632,0}
 
static const WCHAR stBaltic [] ={'A','a','B','b','Y','y','Z','z',0}
 
static const WCHAR stVietname [] ={'A','a','B','b',0x01a0,0x01a1,0x01af,0x01b0,0}
 
static const WCHAR stCyrillic [] ={'A','a','B','b',0x0411,0x0431,0x0424,0x0444,0}
 
static const WCHAR stEastEur [] ={'A','a','B','b',0xc1,0xe1,0xd4,0xf4,0}
 
static const WCHAR stThai [] ={'A','a','B','b',0x0e2d,0x0e31,0x0e01,0x0e29,0x0e23,0x0e44,0x0e17,0x0e22,0}
 
static const WCHAR stJohab [] ={0xac00,0xb098,0xb2e4,'A','a','B','Y','y','Z','z',0}
 
static const WCHAR stMac [] ={'A','a','B','b','Y','y','Z','z',0}
 
static const WCHAR stOEM [] ={'A','a','B','b',0xf8,0xf1,0xfd,0}
 
static const WCHAR stVISCII [] ={'A','a','B','b',0}
 
static const WCHAR stTCVN [] ={'A','a','B','b',0}
 
static const WCHAR stKOI8 [] ={'A','a','B','b',0}
 
static const WCHAR stIso88593 [] ={'A','a','B','b',0}
 
static const WCHAR stIso88594 [] ={'A','a','B','b',0}
 
static const WCHAR stIso885910 [] ={'A','a','B','b',0}
 
static const WCHAR stCeltic [] ={'A','a','B','b',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 68 of file fontdlg.c.

◆ FSTYLES

#define FSTYLES   4

◆ TEXT_COLORS

#define TEXT_COLORS   16

Definition at line 287 of file fontdlg.c.

◆ TEXT_EXTRAS

#define TEXT_EXTRAS   4

Definition at line 286 of file fontdlg.c.

◆ TTBITMAP_XSIZE

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

Definition at line 58 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 161 of file fontdlg.c.

162{
163 unsigned int i;
164
165 for (i = 0; i < ARRAY_SIZE(cfflags); i++)
166 if (cfflags[i].mask & cflags)
167 TRACE("%s|",cfflags[i].name);
168 TRACE("\n");
169}
#define ARRAY_SIZE(a)
Definition: main.h:24
static const struct @336 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 312 of file fontdlg.c.

314{
315 int i;
316 WORD w;
317 const LOGFONTW *lplf = &(lpElfex->elfLogFont);
318
319 TRACE("font=%s (nFontType=%d)\n", debugstr_w(lplf->lfFaceName), nFontType);
320
321 if (lpcf->Flags & CF_FIXEDPITCHONLY)
322 if (!(lplf->lfPitchAndFamily & FIXED_PITCH))
323 return 1;
324 if (lpcf->Flags & CF_ANSIONLY)
325 if (lplf->lfCharSet != ANSI_CHARSET)
326 return 1;
327 if (lpcf->Flags & CF_TTONLY)
328 if (!(nFontType & TRUETYPE_FONTTYPE))
329 return 1;
330 if (lpcf->Flags & CF_NOVERTFONTS)
331 if (lplf->lfFaceName[0] == '@')
332 return 1;
333
334 if (e) e->added++;
335
337 if (i == CB_ERR) {
339 if( i != CB_ERR) {
340 /* store some important font information */
341 w = (lplf->lfPitchAndFamily) << 8 |
342 (HIWORD(lpNTM->ntmTm.ntmFlags) & 0xff);
344 }
345 }
346 return 1;
347}
#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
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:2702
NEWTEXTMETRICW ntmTm
Definition: wingdi.h:2675
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HIWORD(l)
Definition: typedefs.h:247
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
#define FIXED_PITCH
Definition: wingdi.h:444
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1109
#define ANSI_CHARSET
Definition: wingdi.h:383
#define CB_SETITEMDATA
Definition: winuser.h:1956
#define CB_ERR
Definition: winuser.h:2425
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1930
#define CB_ADDSTRING
Definition: winuser.h:1926
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by FontFamilyEnumProc().

◆ AddFontSizeToCombo3()

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

Definition at line 417 of file fontdlg.c.

418{
419 int j;
420 WCHAR buffer[20];
421
422 if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||
423 ((lpcf->Flags & CF_LIMITSIZE) && (h >= lpcf->nSizeMin) && (h <= lpcf->nSizeMax)))
424 {
427 if (j==CB_ERR)
428 {
431 if (j==CB_ERR) return TRUE;
432 }
433 }
434 return FALSE;
435}
#define CF_LIMITSIZE
Definition: commdlg.h:75
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const WCHAR fontsizefmtW[]
Definition: fontdlg.c:54
#define swprintf
Definition: precomp.h:40
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
#define CB_INSERTSTRING
Definition: winuser.h:1947
__wchar_t WCHAR
Definition: xmlstorage.h:180

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 499 of file fontdlg.c.

501{
502 int i;
503 const LOGFONTW *lplf = &(lpElfex->elfLogFont);
504 HWND hcmb5;
505 HDC hdc;
506
507 TRACE("(nFontType=%d)\n",nFontType);
508 TRACE(" %s h=%d w=%d e=%d o=%d wg=%d i=%d u=%d s=%d"
509 " ch=%d op=%d cp=%d q=%d pf=%xh\n",
510 debugstr_w(lplf->lfFaceName),lplf->lfHeight,lplf->lfWidth,
511 lplf->lfEscapement,lplf->lfOrientation,
512 lplf->lfWeight,lplf->lfItalic,lplf->lfUnderline,
513 lplf->lfStrikeOut,lplf->lfCharSet, lplf->lfOutPrecision,
514 lplf->lfClipPrecision,lplf->lfQuality, lplf->lfPitchAndFamily);
515 if (nFontType & RASTER_FONTTYPE)
516 {
517 INT points;
519 72, GetScreenDPI());
520 if (AddFontSizeToCombo3(hcmb3, points, lpcf))
521 return 0;
522 } else if (SetFontSizesToCombo3(hcmb3, lpcf)) return 0;
523
524 if (!SendMessageW(hcmb2, CB_GETCOUNT, 0, 0))
525 {
526 BOOL res;
527 if(!(hdc = CFn_GetDC(lpcf))) return 0;
528 res = SetFontStylesToCombo2(hcmb2,hdc,lplf);
529 CFn_ReleaseDC(lpcf, hdc);
530 if (res)
531 return 0;
532 }
533 if (!( hcmb5 = GetDlgItem(hDlg, cmb5))) return 1;
534 i = SendMessageW( hcmb5, CB_FINDSTRINGEXACT, 0,
535 (LPARAM)lpElfex->elfScript);
536 if( i == CB_ERR) {
537 i = SendMessageW( hcmb5, CB_ADDSTRING, 0,
538 (LPARAM)lpElfex->elfScript);
539 if( i != CB_ERR)
540 SendMessageW( hcmb5, CB_SETITEMDATA, i, lplf->lfCharSet);
541 }
542 return 1 ;
543}
#define cmb5
Definition: dlgs.h:52
static HDC CFn_GetDC(const CHOOSEFONTW *lpcf)
Definition: fontdlg.c:453
static BOOL SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTW *lplf)
Definition: fontdlg.c:366
static BOOL SetFontSizesToCombo3(HWND hwnd, const CHOOSEFONTW *lpcf)
Definition: fontdlg.c:440
static int GetScreenDPI(void)
Definition: fontdlg.c:465
static BOOL AddFontSizeToCombo3(HWND hwnd, UINT h, const CHOOSEFONTW *lpcf)
Definition: fontdlg.c:417
static void CFn_ReleaseDC(const CHOOSEFONTW *lpcf, HDC hdc)
Definition: fontdlg.c:480
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:92
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
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:2705
LONG tmInternalLeading
Definition: wingdi.h:2647
int32_t INT
Definition: typedefs.h:58
#define RASTER_FONTTYPE
Definition: wingdi.h:1107
#define CB_GETCOUNT
Definition: winuser.h:1932
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)

Referenced by FontStyleEnumProc().

◆ CFn_FitCharSet()

static BOOL CFn_FitCharSet ( HWND  hDlg,
int  charset 
)
static

Definition at line 583 of file fontdlg.c.

584{
585 int i,n,cs;
586 /* look for fitting char set in combobox5 */
588 for (i=0;i<n;i++)
589 {
591 if (charset == cs)
592 {
593 select_combo_item( hDlg, cmb5, i );
594 return TRUE;
595 }
596 }
597 /* no charset fits: select the first one in the list */
598 select_combo_item( hDlg, cmb5, 0 );
599 return FALSE;
600}
CFF_Charset charset
Definition: cffcmap.c:138
static void select_combo_item(HWND dialog, int id, int sel)
Definition: fontdlg.c:489
GLdouble n
Definition: glext.h:7729
#define cs
Definition: i386-dis.c:443
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETITEMDATA
Definition: winuser.h:1940

Referenced by CFn_WMCommand(), and CFn_WMInitDialog().

◆ CFn_FitFontSize()

static void CFn_FitFontSize ( HWND  hDlg,
int  points 
)
static

Definition at line 545 of file fontdlg.c.

546{
547 int i,n;
548
549 /* look for fitting font size in combobox3 */
551 for (i=0;i<n;i++)
552 {
553 if (points == (int)SendDlgItemMessageW
554 (hDlg,cmb3, CB_GETITEMDATA,i,0))
555 {
556 select_combo_item( hDlg, cmb3, i );
557 return;
558 }
559 }
560
561 /* no default matching size, set text manually */
562 SetDlgItemInt(hDlg, cmb3, points, TRUE);
563}
#define cmb3
Definition: dlgs.h:50
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 565 of file fontdlg.c.

566{
567 LONG id;
568 int i;
569 /* look for fitting font style in combobox2 */
570 for (i=0;i<TEXT_EXTRAS;i++)
571 {
572 id = SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, i, 0);
573 if (packedstyle == id)
574 {
575 select_combo_item( hDlg, cmb2, i );
576 return TRUE;
577 }
578 }
579 return FALSE;
580}
#define cmb2
Definition: dlgs.h:49
#define TEXT_EXTRAS
Definition: fontdlg.c:286
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 453 of file fontdlg.c.

454{
455 HDC ret = ((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC) ?
456 lpcf->hDC :
457 GetDC(0);
458 if(!ret) ERR("HDC failure!!!\n");
459 return ret;
460}
#define ERR(fmt,...)
Definition: debug.h:110
#define CF_PRINTERFONTS
Definition: commdlg.h:60
int ret
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 300 of file fontdlg.c.

301{
302 if (lpcf)
303 if(lpcf->Flags & CF_ENABLEHOOK)
304 if (lpcf->lpfnHook)
305 return TRUE;
306 return FALSE;
307}
#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 480 of file fontdlg.c.

481{
482 if(!((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC))
483 ReleaseDC(0, hdc);
484}
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 922 of file fontdlg.c.

923{
924 int i;
925 long l;
926 HDC hdc;
927 BOOL cmb_selected_by_edit = FALSE;
928
929 if (!lpcf) return FALSE;
930
932 {
933 int idx;
934 WCHAR str_edit[256], str_cmb[256];
935 int cmb = LOWORD(wParam);
936
937 GetDlgItemTextW(hDlg, cmb, str_edit, ARRAY_SIZE(str_edit));
938 idx = SendDlgItemMessageW(hDlg, cmb, CB_FINDSTRING, -1, (LPARAM)str_edit);
939 if(idx != -1)
940 {
941 SendDlgItemMessageW(hDlg, cmb, CB_GETLBTEXT, idx, (LPARAM)str_cmb);
942
943 /* Select listbox entry only if we have an exact match */
944 if(lstrcmpiW(str_edit, str_cmb) == 0)
945 {
946 SendDlgItemMessageW(hDlg, cmb, CB_SETCURSEL, idx, 0);
947 SendDlgItemMessageW(hDlg, cmb, CB_SETEDITSEL, 0, -1); /* Remove edit field selection */
948 cmb_selected_by_edit = TRUE;
949 }
950 }
951 }
952
953 TRACE("WM_COMMAND wParam=%08X lParam=%08lX\n", (LONG)wParam, lParam);
954 switch (LOWORD(wParam))
955 {
956 case cmb1:
957 if (HIWORD(wParam) == CBN_SELCHANGE || cmb_selected_by_edit)
958 {
959 INT pointsize; /* save current pointsize */
960 LONG pstyle; /* save current style */
961 int charset;
962 int idx;
963 if(!(hdc = CFn_GetDC(lpcf)))
964 {
965 EndDialog (hDlg, 0);
966 return TRUE;
967 }
969 pointsize = (int)SendDlgItemMessageW( hDlg, cmb3, CB_GETITEMDATA,
970 idx, 0);
972 pstyle = SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, idx, 0);
975
980 if (i!=CB_ERR)
981 {
984 LOGFONTW enumlf;
986 (LPARAM)enumlf.lfFaceName);
987 TRACE("WM_COMMAND/cmb1 =>%s\n", debugstr_w(enumlf.lfFaceName));
988 s.hWnd1=GetDlgItem(hDlg, cmb2);
989 s.hWnd2=GetDlgItem(hDlg, cmb3);
990 s.lpcf32w=lpcf;
991 enumlf.lfCharSet = DEFAULT_CHARSET; /* enum all charsets */
992 enumlf.lfPitchAndFamily = 0;
993 EnumFontFamiliesExW(hdc, &enumlf,
995 CFn_FitFontStyle(hDlg, pstyle);
996 if( pointsize != CB_ERR) CFn_FitFontSize(hDlg, pointsize);
997 if( charset != CB_ERR) CFn_FitCharSet( hDlg, charset );
998 SetCursor(hcursor);
999 }
1000 CFn_ReleaseDC(lpcf, hdc);
1001 }
1002 break;
1003 case chx1:
1004 case chx2:
1005 case cmb2:
1006 case cmb3:
1007 case cmb5:
1008 if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == BN_CLICKED || cmb_selected_by_edit)
1009 {
1010 WCHAR str[256];
1011 WINDOWINFO wininfo;
1012 LPLOGFONTW lpxx=lpcf->lpLogFont;
1013
1014 TRACE("WM_COMMAND/cmb2,3 =%08lX\n", lParam);
1015
1016 /* face name */
1018 if (i==CB_ERR)
1020 else
1021 {
1023 (LPARAM)str);
1025 lpcf->nFontType = LOWORD(l);
1026 /* FIXME: lpcf->nFontType |= .... SIMULATED_FONTTYPE and so */
1027 /* same value reported to the EnumFonts
1028 call back with the extra FONTTYPE_... bits added */
1029 lpxx->lfPitchAndFamily = HIWORD(l) >> 8;
1030 }
1032
1033 /* style */
1034 i=SendDlgItemMessageW(hDlg, cmb2, CB_GETCURSEL, 0, 0);
1035 if (i!=CB_ERR)
1036 {
1038 if (0!=(lpxx->lfItalic=HIWORD(l)))
1039 lpcf->nFontType |= ITALIC_FONTTYPE;
1040 if ((lpxx->lfWeight=LOWORD(l)) > FW_MEDIUM)
1041 lpcf->nFontType |= BOLD_FONTTYPE;
1042 }
1043
1044 /* size */
1045 get_dialog_font_point_size(hDlg, lpcf);
1046
1047 /* charset */
1048 i=SendDlgItemMessageW(hDlg, cmb5, CB_GETCURSEL, 0, 0);
1049 if (i!=CB_ERR)
1051 else
1052 lpxx->lfCharSet = DEFAULT_CHARSET;
1055 lpxx->lfWidth=lpxx->lfOrientation=lpxx->lfEscapement=0;
1059
1060 wininfo.cbSize=sizeof(wininfo);
1061
1062 if( GetWindowInfo( GetDlgItem( hDlg, stc5), &wininfo ) )
1063 {
1064 MapWindowPoints( 0, hDlg, (LPPOINT) &wininfo.rcWindow, 2);
1065 InvalidateRect( hDlg, &wininfo.rcWindow, TRUE );
1066 }
1067 }
1068 break;
1069
1070 case cmb4:
1071 i=SendDlgItemMessageW(hDlg, cmb4, CB_GETCURSEL, 0, 0);
1072 if (i!=CB_ERR)
1073 {
1074 WINDOWINFO wininfo;
1075
1077 wininfo.cbSize=sizeof(wininfo);
1078
1079 if( GetWindowInfo( GetDlgItem( hDlg, stc5), &wininfo ) )
1080 {
1081 MapWindowPoints( 0, hDlg, (LPPOINT) &wininfo.rcWindow, 2);
1082 InvalidateRect( hDlg, &wininfo.rcWindow, TRUE );
1083 }
1084 }
1085 break;
1086
1087 case psh15:
1089 if (lpcf->hwndOwner)
1091 break;
1092
1093 case IDOK:
1094 {
1095 WCHAR msgW[80];
1096 INT pointsize;
1097
1098 pointsize = get_dialog_font_point_size(hDlg, lpcf);
1099 if (pointsize == -1)
1100 {
1102 MessageBoxW(hDlg, msgW, NULL, MB_OK | MB_ICONINFORMATION);
1103 return TRUE;
1104 }
1105
1106 if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||
1107 ( (lpcf->Flags & CF_LIMITSIZE) &&
1108 (lpcf->iPointSize >= 10 * lpcf->nSizeMin) &&
1109 (lpcf->iPointSize <= 10 * lpcf->nSizeMax)))
1110 EndDialog(hDlg, TRUE);
1111 else
1112 {
1113 WCHAR format[80];
1114 DWORD_PTR args[2];
1116 args[0] = lpcf->nSizeMin;
1117 args[1] = lpcf->nSizeMax;
1119 format, 0, 0, msgW, ARRAY_SIZE(msgW),
1120 (__ms_va_list*)args);
1121 MessageBoxW(hDlg, msgW, NULL, MB_OK);
1122 }
1123 return(TRUE);
1124 }
1125 case IDCANCEL:
1126 EndDialog(hDlg, FALSE);
1127 return(TRUE);
1128 }
1129 return(FALSE);
1130}
r l[0]
Definition: byte_order.h:167
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define IDS_FONT_SIZE_INPUT
Definition: cdlg.h:183
#define IDS_FONT_SIZE
Definition: cdlg.h:176
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 ITALIC_FONTTYPE
Definition: commdlg.h:91
#define cmb1
Definition: dlgs.h:48
#define stc5
Definition: dlgs.h:164
#define cmb4
Definition: dlgs.h:51
#define chx1
Definition: dlgs.h:31
#define chx2
Definition: dlgs.h:32
#define psh15
Definition: dlgs.h:126
#define NULL
Definition: types.h:112
unsigned int idx
Definition: utils.c:41
static BOOL CFn_FitFontStyle(HWND hDlg, LONG packedstyle)
Definition: fontdlg.c:565
static void CFn_FitFontSize(HWND hDlg, int points)
Definition: fontdlg.c:545
static INT get_dialog_font_point_size(HWND hDlg, CHOOSEFONTW *cf)
Definition: fontdlg.c:894
static BOOL CFn_FitCharSet(HWND hDlg, int charset)
Definition: fontdlg.c:583
static INT WINAPI FontStyleEnumProc(const ENUMLOGFONTEXW *lpElfex, const TEXTMETRICW *metrics, DWORD dwFontType, LPARAM lParam)
Definition: fontdlg.c:605
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
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLdouble s
Definition: gl.h:2039
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define LOWORD(l)
Definition: pedump.c:82
const WCHAR * str
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: wingdi.h:1906
LONG lfWidth
Definition: wingdi.h:1898
BYTE lfCharSet
Definition: wingdi.h:1905
BYTE lfQuality
Definition: wingdi.h:1908
WCHAR lfFaceName[LF_FACESIZE]
Definition: wingdi.h:1910
BYTE lfUnderline
Definition: wingdi.h:1903
LONG lfOrientation
Definition: wingdi.h:1900
BYTE lfItalic
Definition: wingdi.h:1902
BYTE lfStrikeOut
Definition: wingdi.h:1904
LONG lfWeight
Definition: wingdi.h:1901
BYTE lfClipPrecision
Definition: wingdi.h:1907
LONG lfEscapement
Definition: wingdi.h:1899
BYTE lfPitchAndFamily
Definition: wingdi.h:1909
DWORD cbSize
Definition: winuser.h:3756
RECT rcWindow
Definition: winuser.h:3757
uint32_t DWORD_PTR
Definition: typedefs.h:65
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:421
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:424
#define __ms_va_list
Definition: windef.h:456
HICON HCURSOR
Definition: windef.h:299
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:2897
#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
#define CB_GETLBTEXT
Definition: winuser.h:1942
#define IDCANCEL
Definition: winuser.h:825
BOOL WINAPI GetWindowInfo(_In_ HWND, _Inout_ PWINDOWINFO)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define CB_SETCURSEL
Definition: winuser.h:1951
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define CB_RESETCONTENT
Definition: winuser.h:1949
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
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:824
#define CBN_SELCHANGE
Definition: winuser.h:1969
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
UINT WINAPI RegisterWindowMessageW(_In_ LPCWSTR)
#define MB_OK
Definition: winuser.h:784
#define CB_SETEDITSEL
Definition: winuser.h:1953
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
#define MB_ICONINFORMATION
Definition: winuser.h:796
#define IDC_WAIT
Definition: winuser.h:684
#define BN_CLICKED
Definition: winuser.h:1915
#define CB_FINDSTRING
Definition: winuser.h:1929
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define CB_GETCURSEL
Definition: winuser.h:1933
#define CBN_EDITCHANGE
Definition: winuser.h:1965
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FormatCharDlgProcA(), and FormatCharDlgProcW().

◆ CFn_WMDestroy()

static LRESULT CFn_WMDestroy ( HWND  hwnd,
LPCHOOSEFONTW  lpcfw 
)
static

Definition at line 1132 of file fontdlg.c.

1133{
1134 LPCHOOSEFONTA lpcfa;
1135 LPSTR lpszStyle;
1136 LPLOGFONTA lpLogFonta;
1137 int len;
1138
1139 if (!lpcfw) return FALSE;
1140
1142 lpLogFonta = lpcfa->lpLogFont;
1143 lpszStyle = lpcfa->lpszStyle;
1144 memcpy(lpcfa, lpcfw, sizeof(CHOOSEFONTA));
1145 lpcfa->lpLogFont = lpLogFonta;
1146 lpcfa->lpszStyle = lpszStyle;
1147 memcpy(lpcfa->lpLogFont, lpcfw->lpLogFont, sizeof(LOGFONTA));
1150
1151 if((lpcfw->Flags & CF_USESTYLE) && lpcfw->lpszStyle) {
1152 len = WideCharToMultiByte(CP_ACP, 0, lpcfw->lpszStyle, -1, NULL, 0, 0, 0);
1153 WideCharToMultiByte(CP_ACP, 0, lpcfw->lpszStyle, -1, lpcfa->lpszStyle, len, 0, 0);
1154 heap_free(lpcfw->lpszStyle);
1155 }
1156
1157 heap_free(lpcfw->lpLogFont);
1158 heap_free(lpcfw);
1160
1161 return TRUE;
1162}
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#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
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:1894
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
char * LPSTR
Definition: xmlstorage.h:182

Referenced by FormatCharDlgProcA().

◆ CFn_WMDrawItem()

static LRESULT CFn_WMDrawItem ( LPARAM  lParam)
static

Definition at line 792 of file fontdlg.c.

793{
794 HBRUSH hBrush;
795 WCHAR buffer[40];
796 COLORREF cr, oldText=0, oldBk=0;
797 RECT rect;
798 int nFontType;
799 int cx, cy, idx;
801
802 if (lpdi->itemID == (UINT)-1) /* got no items */
803 DrawFocusRect(lpdi->hDC, &lpdi->rcItem);
804 else
805 {
806 if (lpdi->CtlType == ODT_COMBOBOX)
807 {
808 if (lpdi->itemState & ODS_SELECTED)
809 {
813 } else
814 {
816 SelectObject(lpdi->hDC, hBrush);
817 }
818 FillRect(lpdi->hDC, &lpdi->rcItem, hBrush);
819 }
820 else
821 return TRUE; /* this should never happen */
822
823 rect=lpdi->rcItem;
824 switch (lpdi->CtlID)
825 {
826 case cmb1:
827 /* TRACE(commdlg,"WM_Drawitem cmb1\n"); */
830 (LPARAM)buffer);
831 TextOutW(lpdi->hDC, lpdi->rcItem.left + cx + 4,
832 lpdi->rcItem.top, buffer, lstrlenW(buffer));
833 nFontType = SendMessageW(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L);
834 idx = -1;
835 if (nFontType & TRUETYPE_FONTTYPE) {
836 idx = 0; /* picture: TT */
837 if( nFontType & NTM_TT_OPENTYPE)
838 idx = 2; /* picture: O */
839 } else if( nFontType & NTM_PS_OPENTYPE)
840 idx = 3; /* picture: O+ps */
841 else if( nFontType & NTM_TYPE1)
842 idx = 4; /* picture: a */
843 else if( nFontType & DEVICE_FONTTYPE)
844 idx = 1; /* picture: printer */
845 if( idx >= 0)
846 ImageList_Draw( himlTT, idx, lpdi->hDC, lpdi->rcItem.left,
847 (lpdi->rcItem.top + lpdi->rcItem.bottom - cy) / 2, ILD_TRANSPARENT);
848 break;
849 case cmb2:
850 case cmb3:
851 /* TRACE(commdlg,"WM_DRAWITEN cmb2,cmb3\n"); */
852 case cmb5:
854 (LPARAM)buffer);
855 TextOutW(lpdi->hDC, lpdi->rcItem.left,
856 lpdi->rcItem.top, buffer, lstrlenW(buffer));
857 break;
858
859 case cmb4:
860 /* TRACE(commdlg,"WM_DRAWITEM cmb4 (=COLOR)\n"); */
862 (LPARAM)buffer);
863 TextOutW(lpdi->hDC, lpdi->rcItem.left + 25+5,
864 lpdi->rcItem.top, buffer, lstrlenW(buffer));
865 cr = SendMessageW(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L);
866 hBrush = CreateSolidBrush(cr);
867 if (hBrush)
868 {
869 hBrush = SelectObject (lpdi->hDC, hBrush) ;
870 rect.right=rect.left+25;
871 rect.top++;
872 rect.left+=5;
873 rect.bottom--;
874 Rectangle( lpdi->hDC, rect.left, rect.top,
875 rect.right, rect.bottom );
876 DeleteObject( SelectObject (lpdi->hDC, hBrush)) ;
877 }
878 rect=lpdi->rcItem;
879 rect.left+=25+5;
880 break;
881
882 default:
883 return TRUE; /* this should never happen */
884 }
885 if (lpdi->itemState & ODS_SELECTED)
886 {
887 SetTextColor(lpdi->hDC, oldText);
888 SetBkColor(lpdi->hDC, oldBk);
889 }
890 }
891 return TRUE;
892}
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1228
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037
static HIMAGELIST himlTT
Definition: fontdlg.c:57
#define lstrlenW
Definition: compat.h:750
pKey DeleteObject()
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
_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
& rect
Definition: startmenu.cpp:1413
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
DWORD COLORREF
Definition: windef.h:300
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:1539
#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:918
#define NTM_TYPE1
Definition: wingdi.h:29
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define ODT_COMBOBOX
Definition: winuser.h:2529
DWORD WINAPI GetSysColor(_In_ int)
#define ODS_SELECTED
Definition: winuser.h:2535
#define COLOR_HIGHLIGHT
Definition: winuser.h:920
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:921
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)

Referenced by FormatCharDlgProcA(), and FormatCharDlgProcW().

◆ CFn_WMInitDialog()

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

Definition at line 619 of file fontdlg.c.

620{
621 HDC hdc;
622 int i,j;
623 BOOL init = FALSE;
624 long pstyle;
626 LPLOGFONTW lpxx;
628 static const WCHAR strColorName[] = {'[','c','o','l','o','r',' ','n','a','m','e',']',0};
629
630 SetPropW(hDlg, strWineFontData, lpcf);
631 lpxx=lpcf->lpLogFont;
632 TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
633
634 if (lpcf->lStructSize != sizeof(CHOOSEFONTW))
635 {
636 ERR("structure size failure!!!\n");
637 EndDialog (hDlg, 0);
638 return FALSE;
639 }
640 if (!himlTT)
643
644 /* Set effect flags */
645 if((lpcf->Flags & CF_EFFECTS) && (lpcf->Flags & CF_INITTOLOGFONTSTRUCT))
646 {
647 if(lpxx->lfUnderline)
648 CheckDlgButton(hDlg, chx2, TRUE);
649 if(lpxx->lfStrikeOut)
650 CheckDlgButton(hDlg, chx1, TRUE);
651 }
652
653 if (!(lpcf->Flags & CF_SHOWHELP) || !IsWindow(lpcf->hwndOwner))
655 if (!(lpcf->Flags & CF_APPLY))
657 if (lpcf->Flags & CF_NOSCRIPTSEL)
659 if (lpcf->Flags & CF_EFFECTS)
660 {
661 for (i=0;i<TEXT_COLORS;i++)
662 {
663 WCHAR name[30];
664
666 ARRAY_SIZE(name)) == 0 )
667 {
668 memcpy(name, strColorName, sizeof(strColorName));
669 }
672 /* look for a fitting value in color combobox */
673 if (textcolors[i]==lpcf->rgbColors)
675 }
676 }
677 else
678 {
684 }
685 if(!(hdc = CFn_GetDC(lpcf)))
686 {
687 EndDialog (hDlg, 0);
688 return FALSE;
689 }
690 s.hWnd1=GetDlgItem(hDlg,cmb1);
691 s.lpcf32w=lpcf;
692 do {
693 LOGFONTW elf;
694 s.added = 0;
695 elf.lfCharSet = DEFAULT_CHARSET; /* enum all charsets */
696 elf.lfPitchAndFamily = 0;
697 elf.lfFaceName[0] = '\0'; /* enum all fonts */
699 {
700 TRACE("EnumFontFamiliesEx returns 0\n");
701 break;
702 }
703 if (s.added) break;
704 if (lpcf->Flags & CF_FIXEDPITCHONLY) {
705 FIXME("No font found with fixed pitch only, dropping flag.\n");
706 lpcf->Flags &= ~CF_FIXEDPITCHONLY;
707 continue;
708 }
709 if (lpcf->Flags & CF_TTONLY) {
710 FIXME("No font found with truetype only, dropping flag.\n");
711 lpcf->Flags &= ~CF_TTONLY;
712 continue;
713 }
714 break;
715 } while (1);
716
717
718 if (lpcf->Flags & CF_INITTOLOGFONTSTRUCT)
719 {
720 /* look for fitting font name in combobox1 */
722 if (j!=CB_ERR)
723 {
724 INT height = lpxx->lfHeight < 0 ? -lpxx->lfHeight :
725 lpxx->lfHeight;
726 INT points;
727 int charset = lpxx->lfCharSet;
728 points = MulDiv( height, 72, GetScreenDPI());
729 pstyle = MAKELONG(lpxx->lfWeight > FW_MEDIUM ? FW_BOLD:
730 FW_NORMAL,lpxx->lfItalic !=0);
731 select_combo_item( hDlg, cmb1, j );
732 init = TRUE;
733 /* look for fitting font style in combobox2 */
734 CFn_FitFontStyle(hDlg, pstyle);
735 /* look for fitting font size in combobox3 */
736 CFn_FitFontSize(hDlg, points);
737 CFn_FitCharSet( hDlg, charset );
738 }
739 }
740 if (!init)
741 {
742 select_combo_item( hDlg, cmb1, 0 );
743 select_combo_item( hDlg, cmb2, 0 );
744 select_combo_item( hDlg, cmb3, 0 );
745 select_combo_item( hDlg, cmb5, 0 );
746 }
747 /* limit text length user can type in as font size */
749
750 if ((lpcf->Flags & CF_USESTYLE) && lpcf->lpszStyle)
751 {
753 if (j!=CB_ERR) select_combo_item( hDlg, cmb2, j );
754 }
755 CFn_ReleaseDC(lpcf, hdc);
756 SetCursor(hcursor);
757 return TRUE;
758}
#define FIXME(fmt,...)
Definition: debug.h:111
#define IDS_COLOR_BLACK
Definition: cdlg.h:137
#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 CF_NOSCRIPTSEL
Definition: commdlg.h:85
#define pshHelp
Definition: dlgs.h:127
#define psh3
Definition: dlgs.h:114
#define stc4
Definition: dlgs.h:163
#define grp1
Definition: dlgs.h:86
HIMAGELIST WINAPI ImageList_LoadImageW(HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow, COLORREF clrMask, UINT uType, UINT uFlags)
Definition: imagelist.c:2208
#define TTBITMAP_XSIZE
Definition: fontdlg.c:58
static const COLORREF textcolors[TEXT_COLORS]
Definition: fontdlg.c:289
#define TEXT_COLORS
Definition: fontdlg.c:287
static INT WINAPI FontFamilyEnumProc(const ENUMLOGFONTEXW *lpElfex, const TEXTMETRICW *metrics, DWORD dwFontType, LPARAM lParam)
Definition: fontdlg.c:352
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define CLR_DEFAULT
Definition: commctrl.h:320
DWORD lStructSize
Definition: commdlg.h:279
LONG lfHeight
Definition: wingdi.h:1897
#define FW_BOLD
Definition: wingdi.h:378
#define FW_NORMAL
Definition: wingdi.h:373
static int init
Definition: wintirpc.c:33
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define SW_HIDE
Definition: winuser.h:762
#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:1948
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by FormatCharDlgProcA(), and FormatCharDlgProcW().

◆ CFn_WMMeasureItem()

static LRESULT CFn_WMMeasureItem ( HWND  hDlg,
LPARAM  lParam 
)
static

Definition at line 764 of file fontdlg.c.

765{
766 HDC hdc;
767 HFONT hfontprev;
770 INT height = 0, cx;
771
772 if (!himlTT)
776 lpmi->itemHeight = height + 2;
777 /* use MAX of bitmap height and tm.tmHeight .*/
778 hdc=GetDC(hDlg);
779 if(!hdc) return 0;
780 hfontprev = SelectObject( hdc, (HFONT)SendMessageW( hDlg, WM_GETFONT, 0, 0 ));
782 if( tm.tmHeight > lpmi->itemHeight) lpmi->itemHeight = tm.tmHeight;
783 SelectObject(hdc, hfontprev);
784 ReleaseDC(hDlg, hdc);
785 return 0;
786}
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
Definition: time.h:68
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
struct tagMEASUREITEMSTRUCT * LPMEASUREITEMSTRUCT
#define WM_GETFONT
Definition: winuser.h:1641

Referenced by FormatCharDlgProcA(), and FormatCharDlgProcW().

◆ CFn_WMPaint()

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

Definition at line 1164 of file fontdlg.c.

1165{
1167
1168 if (!lpcf) return FALSE;
1169
1170 info.cbSize=sizeof(info);
1171 if( GetWindowInfo( GetDlgItem( hDlg, stc5), &info ) )
1172 {
1173 PAINTSTRUCT ps;
1174 HDC hdc;
1175 HFONT hOrigFont;
1176 LOGFONTW lf = *(lpcf->lpLogFont);
1177
1178 MapWindowPoints( 0, hDlg, (LPPOINT) &info.rcWindow, 2);
1179 hdc = BeginPaint( hDlg, &ps );
1180
1181 TRACE("erase %d, rect=%s\n", ps.fErase, wine_dbgstr_rect(&ps.rcPaint));
1182
1183 /* Paint frame */
1184 DrawEdge( hdc, &info.rcWindow, EDGE_SUNKEN, BF_RECT|BF_ADJUST );
1185
1186 /* Draw the sample text itself */
1187 hOrigFont = SelectObject( hdc, CreateFontIndirectW( &lf ) );
1188 SetTextColor( hdc, lpcf->rgbColors );
1190
1191 DrawTextW( hdc,
1193 -1, &info.rcWindow, DT_CENTER|DT_VCENTER|DT_SINGLELINE );
1194
1195 DeleteObject(SelectObject( hdc, hOrigFont ));
1196 EndPaint( hDlg, &ps );
1197 }
1198 return FALSE;
1199}
static const WCHAR *const sample_lang_text[]
Definition: fontdlg.c:101
static const BYTE CHARSET_ORDER[256]
Definition: fontdlg.c:109
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
static __inline const char * wine_dbgstr_rect(const RECT *rect)
Definition: debug.h:219
#define TRANSPARENT
Definition: wingdi.h:950
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
#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

Referenced by FormatCharDlgProcA(), and FormatCharDlgProcW().

◆ ChooseFontA()

BOOL WINAPI ChooseFontA ( LPCHOOSEFONTA  lpChFont)

Definition at line 238 of file fontdlg.c.

239{
240 LPCVOID template;
241 HRSRC hResInfo;
242 HINSTANCE hDlginst;
243 HGLOBAL hDlgTmpl;
244
245 TRACE("(%p)\n", lpChFont);
246
247 if ( (lpChFont->Flags&CF_ENABLETEMPLATEHANDLE)!=0 )
248 {
249 template=lpChFont->hInstance;
250 } else
251 {
252 if ( (lpChFont->Flags&CF_ENABLETEMPLATE)!=0 )
253 {
254 hDlginst=lpChFont->hInstance;
255 if( !(hResInfo = FindResourceA(hDlginst, lpChFont->lpTemplateName,
256 (LPSTR)RT_DIALOG)))
257 {
259 return FALSE;
260 }
261 } else
262 {
263 hDlginst=COMDLG32_hInstance;
264 if (!(hResInfo = FindResourceW(hDlginst, chooseFontW, (LPWSTR)RT_DIALOG)))
265 {
267 return FALSE;
268 }
269 }
270 if (!(hDlgTmpl = LoadResource(hDlginst, hResInfo )) ||
271 !(template = LockResource( hDlgTmpl )))
272 {
274 return FALSE;
275 }
276 }
277 if (TRACE_ON(commdlg))
278 _dump_cf_flags(lpChFont->Flags);
279 if (lpChFont->Flags & CF_SELECTSCRIPT)
280 FIXME(": unimplemented flag (ignored)\n");
281
283 lpChFont->hwndOwner, FormatCharDlgProcA, (LPARAM)lpChFont );
284}
#define CDERR_LOADRESFAILURE
Definition: cderr.h:12
#define CDERR_FINDRESFAILURE
Definition: cderr.h:11
void COMDLG32_SetCommDlgExtendedError(DWORD err) DECLSPEC_HIDDEN
Definition: cdlg32.c:128
#define CF_ENABLETEMPLATEHANDLE
Definition: commdlg.h:65
#define CF_SELECTSCRIPT
Definition: commdlg.h:84
#define CF_ENABLETEMPLATE
Definition: commdlg.h:64
static const WCHAR chooseFontW[]
Definition: fontdlg.c:53
static INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: fontdlg.c:1204
static void _dump_cf_flags(DWORD cflags)
Definition: fontdlg.c:161
#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
#define RT_DIALOG
Definition: pedump.c:367
LPCSTR lpTemplateName
Definition: commdlg.h:270
HINSTANCE hInstance
Definition: commdlg.h:271
HWND hwndOwner
Definition: commdlg.h:262
DWORD Flags
Definition: commdlg.h:266
CONST void * LPCVOID
Definition: windef.h:191
INT_PTR WINAPI DialogBoxIndirectParamA(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by test_ChooseFontA().

◆ ChooseFontW()

BOOL WINAPI ChooseFontW ( LPCHOOSEFONTW  lpChFont)

Definition at line 184 of file fontdlg.c.

185{
186 LPCVOID template;
187 HRSRC hResInfo;
188 HINSTANCE hDlginst;
189 HGLOBAL hDlgTmpl;
190
191 TRACE("(%p)\n", lpChFont);
192
193 if ( (lpChFont->Flags&CF_ENABLETEMPLATEHANDLE)!=0 )
194 {
195 template=lpChFont->hInstance;
196 } else
197 {
198 if ( (lpChFont->Flags&CF_ENABLETEMPLATE)!=0 )
199 {
200 hDlginst=lpChFont->hInstance;
201 if( !(hResInfo = FindResourceW(hDlginst, lpChFont->lpTemplateName,
202 (LPWSTR)RT_DIALOG)))
203 {
205 return FALSE;
206 }
207 } else
208 {
209 hDlginst=COMDLG32_hInstance;
210 if (!(hResInfo = FindResourceW(hDlginst, chooseFontW, (LPWSTR)RT_DIALOG)))
211 {
213 return FALSE;
214 }
215 }
216 if (!(hDlgTmpl = LoadResource(hDlginst, hResInfo )) ||
217 !(template = LockResource( hDlgTmpl )))
218 {
220 return FALSE;
221 }
222 }
223 if (TRACE_ON(commdlg))
224 _dump_cf_flags(lpChFont->Flags);
225
226 if (lpChFont->Flags & CF_SELECTSCRIPT)
227 FIXME(": unimplemented flag (ignored)\n");
228
230 lpChFont->hwndOwner, FormatCharDlgProcW, (LPARAM)lpChFont );
231}
static INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: fontdlg.c:1270
HINSTANCE hInstance
Definition: commdlg.h:289
LPCWSTR lpTemplateName
Definition: commdlg.h:288
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

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 352 of file fontdlg.c.

354{
357 return AddFontFamily( lpElfex, (const NEWTEXTMETRICEXW *) metrics,
358 dwFontType, e->lpcf32w, e->hWnd1, e);
359}
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:312
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 605 of file fontdlg.c.

607{
609 HWND hcmb2=s->hWnd1;
610 HWND hcmb3=s->hWnd2;
611 HWND hDlg=GetParent(hcmb3);
612 return AddFontStyle( lpElfex, (const NEWTEXTMETRICEXW *) metrics,
613 dwFontType, s->lpcf32w, hcmb2, hcmb3, hDlg);
614}
static INT AddFontStyle(const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM, UINT nFontType, const CHOOSEFONTW *lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg)
Definition: fontdlg.c:499
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 1204 of file fontdlg.c.

1205{
1206 LPCHOOSEFONTW lpcfw;
1207 LPCHOOSEFONTA lpcfa;
1208 INT_PTR res = FALSE;
1209 int len;
1210
1211 if (uMsg!=WM_INITDIALOG) {
1212 lpcfw = GetPropW(hDlg, strWineFontData);
1213 if (lpcfw && CFn_HookCallChk32(lpcfw))
1214 res=CallWindowProcA((WNDPROC)lpcfw->lpfnHook, hDlg, uMsg, wParam, lParam);
1215 if (res)
1216 return res;
1217 } else {
1218 lpcfa=(LPCHOOSEFONTA)lParam;
1220
1221 lpcfw = heap_alloc(sizeof(*lpcfw));
1222 memcpy(lpcfw, lpcfa, sizeof(CHOOSEFONTA));
1223 lpcfw->lpLogFont = heap_alloc(sizeof(*lpcfw->lpLogFont));
1224 memcpy(lpcfw->lpLogFont, lpcfa->lpLogFont, sizeof(LOGFONTA));
1227
1228 if((lpcfa->Flags & CF_USESTYLE) && lpcfa->lpszStyle) {
1229 len = MultiByteToWideChar(CP_ACP, 0, lpcfa->lpszStyle, -1, NULL, 0);
1230 lpcfw->lpszStyle = heap_alloc(len * sizeof(WCHAR));
1231 MultiByteToWideChar(CP_ACP, 0, lpcfa->lpszStyle, -1, lpcfw->lpszStyle, len);
1232 }
1233
1234 if (!CFn_WMInitDialog(hDlg, lParam, lpcfw))
1235 {
1236 TRACE("CFn_WMInitDialog returned FALSE\n");
1237 return FALSE;
1238 }
1239 if (CFn_HookCallChk32(lpcfw))
1241 }
1242 switch (uMsg)
1243 {
1244 case WM_MEASUREITEM:
1245 return CFn_WMMeasureItem(hDlg,lParam);
1246 case WM_DRAWITEM:
1247 return CFn_WMDrawItem(lParam);
1248 case WM_COMMAND:
1249 return CFn_WMCommand(hDlg, wParam, lParam, lpcfw);
1250 case WM_DESTROY:
1251 return CFn_WMDestroy(hDlg, lpcfw);
1253 {
1254 LOGFONTA *logfont = (LOGFONTA *)lParam;
1255 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", lParam);
1256 memcpy( logfont, lpcfw->lpLogFont, FIELD_OFFSET( LOGFONTA, lfFaceName ));
1258 logfont->lfFaceName, LF_FACESIZE, NULL, NULL );
1259 break;
1260 }
1261 case WM_PAINT:
1262 return CFn_WMPaint(hDlg, wParam, lParam, lpcfw);
1263 }
1264 return res;
1265}
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#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:922
static LRESULT CFn_WMDrawItem(LPARAM lParam)
Definition: fontdlg.c:792
static LRESULT CFn_WMInitDialog(HWND hDlg, LPARAM lParam, LPCHOOSEFONTW lpcf)
Definition: fontdlg.c:619
static BOOL CFn_HookCallChk32(const CHOOSEFONTW *lpcf)
Definition: fontdlg.c:300
static LRESULT CFn_WMDestroy(HWND hwnd, LPCHOOSEFONTW lpcfw)
Definition: fontdlg.c:1132
static LRESULT CFn_WMMeasureItem(HWND hDlg, LPARAM lParam)
Definition: fontdlg.c:764
static LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam, const CHOOSEFONTW *lpcf)
Definition: fontdlg.c:1164
#define MultiByteToWideChar
Definition: compat.h:110
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
#define WM_PAINT
Definition: winuser.h:1610
#define WM_COMMAND
Definition: winuser.h:1730
#define WM_INITDIALOG
Definition: winuser.h:1729
#define WM_DRAWITEM
Definition: winuser.h:1635
#define WM_MEASUREITEM
Definition: winuser.h:1636
#define WM_DESTROY
Definition: winuser.h:1599
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2896
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ChooseFontA().

◆ FormatCharDlgProcW()

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

Definition at line 1270 of file fontdlg.c.

1271{
1272 LPCHOOSEFONTW lpcf;
1273 INT_PTR res = FALSE;
1274
1275 if (uMsg!=WM_INITDIALOG)
1276 {
1277 lpcf= GetPropW(hDlg, strWineFontData);
1278 if (lpcf && CFn_HookCallChk32(lpcf))
1279 res=CallWindowProcW((WNDPROC)lpcf->lpfnHook, hDlg, uMsg, wParam, lParam);
1280 if (res)
1281 return res;
1282 }
1283 else
1284 {
1285 lpcf=(LPCHOOSEFONTW)lParam;
1286 if (!CFn_WMInitDialog(hDlg, lParam, lpcf))
1287 {
1288 TRACE("CFn_WMInitDialog returned FALSE\n");
1289 return FALSE;
1290 }
1291 if (CFn_HookCallChk32(lpcf))
1293 }
1294 switch (uMsg)
1295 {
1296 case WM_MEASUREITEM:
1297 return CFn_WMMeasureItem(hDlg, lParam);
1298 case WM_DRAWITEM:
1299 return CFn_WMDrawItem(lParam);
1300 case WM_COMMAND:
1301 return CFn_WMCommand(hDlg, wParam, lParam, lpcf);
1302 case WM_DESTROY:
1303 return TRUE;
1305 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", lParam);
1306 memcpy( (LOGFONTW *)lParam, lpcf->lpLogFont, sizeof(LOGFONTW) );
1307 break;
1308 case WM_PAINT:
1309 return CFn_WMPaint(hDlg, wParam, lParam, lpcf);
1310 }
1311 return res;
1312}
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 894 of file fontdlg.c.

895{
896 BOOL invalid_size = FALSE;
897 INT i, size;
898
899 i = SendDlgItemMessageW(hDlg, cmb3, CB_GETCURSEL, 0, 0);
900 if (i != CB_ERR)
902 else
903 {
904 WCHAR buffW[8], *endptrW;
905
906 GetDlgItemTextW(hDlg, cmb3, buffW, ARRAY_SIZE(buffW));
907 size = wcstol(buffW, &endptrW, 10);
908 invalid_size = size == 0 && *endptrW;
909
910 if (size == 0)
911 size = 10;
912 }
913
914 cf->iPointSize = 10 * size;
915 cf->lpLogFont->lfHeight = -MulDiv(cf->iPointSize, GetScreenDPI(), 720);
916 return invalid_size ? -1 : size;
917}
GLsizeiptr size
Definition: glext.h:5919
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)

Referenced by CFn_WMCommand().

◆ GetScreenDPI()

static int GetScreenDPI ( void  )
inlinestatic

Definition at line 465 of file fontdlg.c.

466{
467 HDC hdc;
468 int result;
469
470 hdc = GetDC(0);
472 ReleaseDC(0, hdc);
473
474 return result;
475}
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 489 of file fontdlg.c.

490{
491 HWND combo = GetDlgItem( dialog, id );
492 SendMessageW( combo, CB_SETCURSEL, sel, 0 );
494}
static HWND dialog
Definition: gui.c:33
#define MAKEWPARAM(l, h)
Definition: winuser.h:3999

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

◆ SetFontSizesToCombo3()

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

Definition at line 440 of file fontdlg.c.

441{
442 static const BYTE sizes[]={6,7,8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
443 unsigned int i;
444
445 for (i = 0; i < ARRAY_SIZE(sizes); i++)
446 if (AddFontSizeToCombo3(hwnd, sizes[i], lpcf)) return TRUE;
447 return FALSE;
448}
static const struct @529 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 366 of file fontdlg.c.

367{
368#define FSTYLES 4
369 struct FONTSTYLE
370 {
371 int italic;
372 int weight;
373 UINT resId;
374 };
375 static const struct FONTSTYLE fontstyles[FSTYLES]={
378 { 0, FW_BOLD, IDS_FONT_BOLD },
380 };
381 HFONT hf;
383 int i,j;
384 LOGFONTW lf;
385
386 lf = *lplf;
387
388 for (i=0;i<FSTYLES;i++)
389 {
390 lf.lfItalic=fontstyles[i].italic;
391 lf.lfWeight=fontstyles[i].weight;
392 hf=CreateFontIndirectW(&lf);
393 hf=SelectObject(hdc,hf);
395 hf=SelectObject(hdc,hf);
396 DeleteObject(hf);
397 /* font successful created ? */
398 if (((fontstyles[i].weight == FW_NORMAL && tm.tmWeight <= FW_MEDIUM) ||
399 (fontstyles[i].weight == FW_BOLD && tm.tmWeight > FW_MEDIUM)) &&
400 ((tm.tmItalic != 0)==fontstyles[i].italic))
401 {
402 WCHAR name[64];
403 LoadStringW(COMDLG32_hInstance, fontstyles[i].resId, name, 64);
405 if (j==CB_ERR) return TRUE;
407 MAKELONG(tm.tmWeight,fontstyles[i].italic));
408 if (j==CB_ERR) return TRUE;
409 }
410 }
411 return FALSE;
412}
#define IDS_FONT_BOLD_ITALIC
Definition: cdlg.h:133
#define IDS_FONT_ITALIC
Definition: cdlg.h:132
#define IDS_FONT_REGULAR
Definition: cdlg.h:130
#define IDS_FONT_BOLD
Definition: cdlg.h:131
#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),
}
#define CI(cs)
Definition: fontdlg.c:68
@ MAC
Definition: isohybrid.c:57

Definition at line 109 of file fontdlg.c.

Referenced by CFn_WMPaint().

◆ chooseFontW

const WCHAR chooseFontW[] = {'C','H','O','O','S','E','_','F','O','N','T',0}
static

Definition at line 53 of file fontdlg.c.

Referenced by ChooseFontA(), and ChooseFontW().

◆ fontsizefmtW

const WCHAR fontsizefmtW[] = {'%','d',0}
static

Definition at line 54 of file fontdlg.c.

Referenced by AddFontSizeToCombo3().

◆ himlTT

HIMAGELIST himlTT = 0
static

Definition at line 57 of file fontdlg.c.

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

◆ mask

Definition at line 129 of file fontdlg.c.

◆ name

Definition at line 130 of file fontdlg.c.

◆ sample_lang_text

const WCHAR* const sample_lang_text[]
static
Initial value:
={
static const WCHAR stKOI8[]
Definition: fontdlg.c:95
static const WCHAR stCeltic[]
Definition: fontdlg.c:99
static const WCHAR stShiftJis[]
Definition: fontdlg.c:73
static const WCHAR stTCVN[]
Definition: fontdlg.c:94
static const WCHAR stVietname[]
Definition: fontdlg.c:82
static const WCHAR stThai[]
Definition: fontdlg.c:85
static const WCHAR stIso88593[]
Definition: fontdlg.c:96
static const WCHAR stCyrillic[]
Definition: fontdlg.c:83
static const WCHAR stVISCII[]
Definition: fontdlg.c:93
static const WCHAR stIso88594[]
Definition: fontdlg.c:97
static const WCHAR stJohab[]
Definition: fontdlg.c:86
static const WCHAR stMac[]
Definition: fontdlg.c:87
static const WCHAR stHebrew[]
Definition: fontdlg.c:79
static const WCHAR stArabic[]
Definition: fontdlg.c:80
static const WCHAR stBIG5[]
Definition: fontdlg.c:76
static const WCHAR stSymbol[]
Definition: fontdlg.c:72
static const WCHAR stWestern[]
Definition: fontdlg.c:71
static const WCHAR stHangul[]
Definition: fontdlg.c:74
static const WCHAR stIso885910[]
Definition: fontdlg.c:98
static const WCHAR stOEM[]
Definition: fontdlg.c:88
static const WCHAR stEastEur[]
Definition: fontdlg.c:84
static const WCHAR stGreek[]
Definition: fontdlg.c:77
static const WCHAR stTurkish[]
Definition: fontdlg.c:78
static const WCHAR stBaltic[]
Definition: fontdlg.c:81
static const WCHAR stGB2312[]
Definition: fontdlg.c:75

Definition at line 101 of file fontdlg.c.

Referenced by CFn_WMPaint().

◆ stArabic

const WCHAR stArabic[] ={'A','a','B','b',0x0627,0x0628,0x062c,0x062f,0x0647,0x0648,0x0632,0}
static

Definition at line 80 of file fontdlg.c.

◆ stBaltic

const WCHAR stBaltic[] ={'A','a','B','b','Y','y','Z','z',0}
static

Definition at line 81 of file fontdlg.c.

◆ stBIG5

const WCHAR stBIG5[] ={0x4e2d,0x6587,0x5b57,0x578b,0x7bc4,0x4f8b,0}
static

Definition at line 76 of file fontdlg.c.

◆ stCeltic

const WCHAR stCeltic[] ={'A','a','B','b',0}
static

Definition at line 99 of file fontdlg.c.

◆ stCyrillic

const WCHAR stCyrillic[] ={'A','a','B','b',0x0411,0x0431,0x0424,0x0444,0}
static

Definition at line 83 of file fontdlg.c.

◆ stEastEur

const WCHAR stEastEur[] ={'A','a','B','b',0xc1,0xe1,0xd4,0xf4,0}
static

Definition at line 84 of file fontdlg.c.

◆ stGB2312

const WCHAR stGB2312[] ={0x5fae,0x8f6f,0x4e2d,0x6587,0x8f6f,0x4ef6,0}
static

Definition at line 75 of file fontdlg.c.

◆ stGreek

const WCHAR stGreek[] ={'A','a','B','b',0x0391,0x03b1,0x0392,0x03b2,0}
static

Definition at line 77 of file fontdlg.c.

◆ stHangul

const WCHAR stHangul[] ={0xac00,0xb098,0xb2e4,'A','a','B','Y','y','Z','z',0}
static

Definition at line 74 of file fontdlg.c.

◆ stHebrew

const WCHAR stHebrew[] ={'A','a','B','b',0x05e0,0x05e1,0x05e9,0x05ea,0}
static

Definition at line 79 of file fontdlg.c.

◆ stIso885910

const WCHAR stIso885910[] ={'A','a','B','b',0}
static

Definition at line 98 of file fontdlg.c.

◆ stIso88593

const WCHAR stIso88593[] ={'A','a','B','b',0}
static

Definition at line 96 of file fontdlg.c.

◆ stIso88594

const WCHAR stIso88594[] ={'A','a','B','b',0}
static

Definition at line 97 of file fontdlg.c.

◆ stJohab

const WCHAR stJohab[] ={0xac00,0xb098,0xb2e4,'A','a','B','Y','y','Z','z',0}
static

Definition at line 86 of file fontdlg.c.

◆ stKOI8

const WCHAR stKOI8[] ={'A','a','B','b',0}
static

Definition at line 95 of file fontdlg.c.

◆ stMac

const WCHAR stMac[] ={'A','a','B','b','Y','y','Z','z',0}
static

Definition at line 87 of file fontdlg.c.

◆ stOEM

const WCHAR stOEM[] ={'A','a','B','b',0xf8,0xf1,0xfd,0}
static

Definition at line 88 of file fontdlg.c.

◆ strWineFontData

const WCHAR strWineFontData[] = {'_','_','W','I','N','E','_','F','O','N','T','D','L','G','D','A','T','A',0}
static

◆ strWineFontData_a

const WCHAR strWineFontData_a[]
static
Initial value:
=
{'_','_','W','I','N','E','_','F','O','N','T','D','L','G','D','A','T','A','_','A',0}

Definition at line 51 of file fontdlg.c.

Referenced by CFn_WMDestroy(), and FormatCharDlgProcA().

◆ stShiftJis

const WCHAR stShiftJis[] ={'A','a',0x3042,0x3041,0x30a2,0x30a1,0x4e9c,0x5b87,0}
static

Definition at line 73 of file fontdlg.c.

◆ stSymbol

const WCHAR stSymbol[] ={'S','y','m','b','o','l',0}
static

Definition at line 72 of file fontdlg.c.

◆ stTCVN

const WCHAR stTCVN[] ={'A','a','B','b',0}
static

Definition at line 94 of file fontdlg.c.

◆ stThai

const WCHAR stThai[] ={'A','a','B','b',0x0e2d,0x0e31,0x0e01,0x0e29,0x0e23,0x0e44,0x0e17,0x0e22,0}
static

Definition at line 85 of file fontdlg.c.

◆ stTurkish

const WCHAR stTurkish[] ={'A','a','B','b',0x011e,0x011f,0x015e,0x015f,0}
static

Definition at line 78 of file fontdlg.c.

◆ stVietname

const WCHAR stVietname[] ={'A','a','B','b',0x01a0,0x01a1,0x01af,0x01b0,0}
static

Definition at line 82 of file fontdlg.c.

◆ stVISCII

const WCHAR stVISCII[] ={'A','a','B','b',0}
static

Definition at line 93 of file fontdlg.c.

◆ stWestern

const WCHAR stWestern[] ={'A','a','B','b','Y','y','Z','z',0}
static

Definition at line 71 of file fontdlg.c.

◆ 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 289 of file fontdlg.c.

Referenced by CFn_WMInitDialog().