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
,
41 /* Font-enumeration callback */
43 EnumFontNames(ENUMLOGFONTEX
*lpelfe
,
44 NEWTEXTMETRICEX
*lpntme
,
48 HWND hwndCombo
= (HWND
)lParam
;
49 TCHAR
*pszName
= lpelfe
->elfLogFont
.lfFaceName
;
51 /* make sure font doesn't already exist in our list */
52 if(SendMessage(hwndCombo
,
55 (LPARAM
)pszName
) == CB_ERR
)
62 idx
= (INT
)SendMessage(hwndCombo
,
67 /* record the font's attributes (Fixedwidth and Truetype) */
68 fFixed
= (lpelfe
->elfLogFont
.lfPitchAndFamily
& FIXED_PITCH
) ? TRUE
: FALSE
;
69 fTrueType
= (lpelfe
->elfLogFont
.lfOutPrecision
== OUT_STROKE_PRECIS
) ? TRUE
: FALSE
;
71 /* store this information in the list-item's userdata area */
72 SendMessage(hwndCombo
,
75 MAKEWPARAM(fFixed
, fTrueType
));
83 FillFontSizeComboList(HWND hwndCombo
)
86 HDC hdc
= GetDC(hwndCombo
);
90 INT i
, count
, nearest
= 0;
92 HFONT hFont
= (HFONT
) GetStockObject(DEFAULT_GUI_FONT
);
94 SendMessage(hwndCombo
,
99 lf
.lfCharSet
= DEFAULT_CHARSET
;
100 lf
.lfPitchAndFamily
= 0;
103 SendMessage(hwndCombo
,
108 /* enumerate font sizes */
109 EnumFontFamiliesEx(hdc
,
111 (FONTENUMPROC
)EnumFontSizes
,
115 /* set selection to first item */
116 count
= (INT
)SendMessage(hwndCombo
,
121 for(i
= 0; i
< count
; i
++)
123 INT n
= (INT
)SendMessage(hwndCombo
,
132 SendMessage(hwndCombo
,
142 /* Initialize the font-list by enumeration all system fonts */
144 FillFontStyleComboList(HWND hwndCombo
)
146 HDC hdc
= GetDC(hwndCombo
);
149 /* FIXME: draw each font in its own style */
150 HFONT hFont
= (HFONT
)GetStockObject(DEFAULT_GUI_FONT
);
151 SendMessage(hwndCombo
,
156 /* FIXME: set this in relation to the widest string */
157 SendMessage(hwndCombo
, CB_SETDROPPEDWIDTH
, 150, 0);
159 lf
.lfCharSet
= ANSI_CHARSET
; // DEFAULT_CHARSET;
160 lf
.lfFaceName
[0] = _T('\0'); // all fonts
161 lf
.lfPitchAndFamily
= 0;
163 /* store the list of fonts in the combo */
164 EnumFontFamiliesEx(hdc
,
166 (FONTENUMPROC
)EnumFontNames
,
167 (LPARAM
)hwndCombo
, 0);
172 /* set default to Arial */
173 SendMessage(hwndCombo
,
176 (LPARAM
)_T("Arial"));