Improve font support in Notepad.
This commit is contained in:
parent
960aadaceb
commit
5f5418a331
|
@ -620,7 +620,7 @@ VOID DIALOG_SelectFont(VOID)
|
|||
cf.lStructSize=sizeof(cf);
|
||||
cf.hwndOwner=Globals.hMainWnd;
|
||||
cf.lpLogFont=&lf;
|
||||
cf.Flags=CF_SCREENFONTS;
|
||||
cf.Flags=CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT;
|
||||
|
||||
if( ChooseFont(&cf) )
|
||||
{
|
||||
|
|
|
@ -47,6 +47,36 @@ VOID SetFileName(LPCWSTR szFileName)
|
|||
GetFileTitle(szFileName, Globals.szFileTitle, sizeof(Globals.szFileTitle));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* NOTEPAD_InitFont
|
||||
*
|
||||
* Initialize font for the edit window
|
||||
*/
|
||||
static VOID NOTEPAD_InitFont()
|
||||
{
|
||||
LOGFONT *lf = &Globals.lfFont;
|
||||
static const WCHAR systemW[] = { 'S','y','s','t','e','m',0 };
|
||||
|
||||
lf->lfHeight = -10;
|
||||
lf->lfWidth = 0;
|
||||
lf->lfEscapement = 0;
|
||||
lf->lfOrientation = 0;
|
||||
lf->lfWeight = FW_BOLD;
|
||||
lf->lfItalic = FALSE;
|
||||
lf->lfUnderline = FALSE;
|
||||
lf->lfStrikeOut = FALSE;
|
||||
lf->lfCharSet = DEFAULT_CHARSET;
|
||||
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
|
||||
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
||||
lf->lfQuality = DEFAULT_QUALITY;
|
||||
lf->lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
|
||||
lstrcpy(lf->lfFaceName, systemW);
|
||||
|
||||
Globals.hFont = CreateFontIndirect(lf);
|
||||
SendMessage(Globals.hEdit, WM_SETFONT, (WPARAM)Globals.hFont, (LPARAM)FALSE);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* NOTEPAD_MenuCommand
|
||||
|
@ -153,6 +183,7 @@ static LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
|||
ES_AUTOVSCROLL | ES_MULTILINE,
|
||||
0, 0, rc.right, rc.bottom, hWnd,
|
||||
NULL, Globals.hInstance, NULL);
|
||||
NOTEPAD_InitFont();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue