4 EnumFontSizes(ENUMLOGFONTEX
*lpelfe
,
5 NEWTEXTMETRICEX
*lpntme
,
9 static int ttsizes
[] = { 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72 };
12 BOOL fTrueType
= (lpelfe
->elfLogFont
.lfOutPrecision
== OUT_STROKE_PRECIS
) ? TRUE
: FALSE
;
14 HWND hwndCombo
= (HWND
)lParam
;
19 for (i
= 0; i
< (sizeof(ttsizes
) / sizeof(ttsizes
[0])); i
++)
21 wsprintf(ach
, _T("%d"), ttsizes
[i
]);
23 idx
= (INT
)SendMessage(hwndCombo
,
28 SendMessage(hwndCombo
,
40 /* Font-enumeration callback */
42 EnumFontNames(ENUMLOGFONTEX
*lpelfe
,
43 NEWTEXTMETRICEX
*lpntme
,
47 HWND hwndCombo
= (HWND
)lParam
;
48 TCHAR
*pszName
= lpelfe
->elfLogFont
.lfFaceName
;
50 /* make sure font doesn't already exist in our list */
51 if(SendMessage(hwndCombo
,
54 (LPARAM
)pszName
) == CB_ERR
)
61 idx
= (INT
)SendMessage(hwndCombo
,
66 /* record the font's attributes (Fixedwidth and Truetype) */
67 fFixed
= (lpelfe
->elfLogFont
.lfPitchAndFamily
& FIXED_PITCH
) ? TRUE
: FALSE
;
68 fTrueType
= (lpelfe
->elfLogFont
.lfOutPrecision
== OUT_STROKE_PRECIS
) ? TRUE
: FALSE
;
70 /* store this information in the list-item's userdata area */
71 SendMessage(hwndCombo
,
74 MAKEWPARAM(fFixed
, fTrueType
));
82 FillFontSizeComboList(HWND hwndCombo
)
85 HDC hdc
= GetDC(hwndCombo
);
89 INT i
, count
, nearest
= 0;
91 HFONT hFont
= (HFONT
) GetStockObject(DEFAULT_GUI_FONT
);
93 SendMessage(hwndCombo
,
98 lf
.lfCharSet
= DEFAULT_CHARSET
;
99 lf
.lfPitchAndFamily
= 0;
102 SendMessage(hwndCombo
,
107 /* enumerate font sizes */
108 EnumFontFamiliesEx(hdc
,
110 (FONTENUMPROC
)EnumFontSizes
,
114 /* set selection to first item */
115 count
= (INT
)SendMessage(hwndCombo
,
120 for(i
= 0; i
< count
; i
++)
122 INT n
= (INT
)SendMessage(hwndCombo
,
131 SendMessage(hwndCombo
,
141 /* Initialize the font-list by enumeration all system fonts */
143 FillFontStyleComboList(HWND hwndCombo
)
145 HDC hdc
= GetDC(hwndCombo
);
148 /* FIXME: draw each font in its own style */
149 HFONT hFont
= (HFONT
) GetStockObject(DEFAULT_GUI_FONT
);
150 SendMessage(hwndCombo
,
155 /* FIXME: set this in relation to the widest string */
156 SendMessage(hwndCombo
, CB_SETDROPPEDWIDTH
, 150, 0);
158 lf
.lfCharSet
= ANSI_CHARSET
; // DEFAULT_CHARSET;
159 lf
.lfFaceName
[0] = _T('\0'); // all fonts
160 lf
.lfPitchAndFamily
= 0;
162 /* store the list of fonts in the combo */
163 EnumFontFamiliesEx(hdc
,
165 (FONTENUMPROC
)EnumFontNames
,
166 (LPARAM
)hwndCombo
, 0);
171 /* set default to Arial */
172 SendMessage(hwndCombo
,
175 (LPARAM
)_T("Arial"));