Use Consolas font if it exists, special Japanese font if required
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7244 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
3fd700e56c
commit
72dd0e4f72
7 changed files with 38 additions and 2 deletions
|
@ -211,6 +211,9 @@ Version History
|
|||
2.3.6
|
||||
- Added GUID generator tool
|
||||
|
||||
2.3.7
|
||||
- Use Consolas font if it exists
|
||||
|
||||
Copyright Information
|
||||
---------------------
|
||||
Copyright (c) 2002 Robert Rainwater
|
||||
|
|
|
@ -58,7 +58,7 @@ BuildUtil(
|
|||
res = res,
|
||||
resources = resources,
|
||||
entry = None,
|
||||
defines = ['RELEASE=2.3.6'],
|
||||
defines = ['RELEASE=2.3.7'],
|
||||
docs = docs,
|
||||
root_util = True
|
||||
)
|
||||
|
|
|
@ -270,7 +270,21 @@ INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
|
|||
CreateToolBar();
|
||||
InitTooltips(g_sdata.hwnd);
|
||||
SetDlgItemText(g_sdata.hwnd,IDC_VERSION,g_sdata.branding);
|
||||
HFONT hFont = CreateFontPt(hwndDlg,8,FW_NORMAL,FIXED_PITCH|FF_DONTCARE,DEFAULT_CHARSET,_T("Courier New"));
|
||||
LPCTSTR fontname = _T("Courier New"), fontconsolas = _T("Consolas");
|
||||
BYTE fontsize = 8, fontcharset = DEFAULT_CHARSET, suppwin4 = SupportsWNT4() || SupportsW9X();
|
||||
if (FontExists(fontconsolas))
|
||||
{
|
||||
fontname = fontconsolas, ++fontsize;
|
||||
}
|
||||
else if (SupportsW2000() && GetACP() == 932) // According to older Inno, Courier New cannot display Japanese on < WinXP
|
||||
{
|
||||
LPCWSTR msgothlocalutf = L"\xff2d\xff33 \xff30\x30b4\x30b7\x30c3\x30af";
|
||||
const CHAR msgothlocal932[] = { -126, 'l', -126, 'r', ' ', -125, 'S', -125, 'V', -125, 'b', -125, 'N', '\0' };
|
||||
fontcharset = SHIFTJIS_CHARSET, ++fontsize;
|
||||
fontname = _T("MS Gothic"); // Win2000 can handle this, downlevel cannot
|
||||
if (suppwin4 && !FontExists(fontname)) fontname = sizeof(TCHAR) > 1 ? (LPCTSTR) msgothlocalutf : (LPCTSTR) msgothlocal932;
|
||||
}
|
||||
HFONT hFont = CreateFontPt(hwndDlg,fontsize,FW_NORMAL,FIXED_PITCH|FF_DONTCARE,fontcharset,fontname);
|
||||
SendDlgItemMessage(hwndDlg,IDC_LOGWIN,WM_SETFONT,(WPARAM)hFont,0);
|
||||
RestoreWindowPos(g_sdata.hwnd);
|
||||
RestoreCompressor();
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#define SupportsWNT4() ( sizeof(void*) == 4 && !DpiAwarePerMonitor() ) // NT4 does not support the MultiMon API
|
||||
#define SupportsW9X() ( sizeof(TCHAR) == 1 )
|
||||
#define SupportsW95() ( FALSE && SupportsW9X() && !DpiAwarePerMonitor() )
|
||||
#define SupportsW2000() ( sizeof(void*) == 4 )
|
||||
|
||||
// Defines
|
||||
#define NSIS_URL "https://nsis.sourceforge.io/"
|
||||
|
|
|
@ -1118,6 +1118,20 @@ HFONT CreateFontHelper(INT_PTR Data, int Height, DWORD p1, LPCTSTR Face)
|
|||
return CreateFont(Height, 0, 0, 0, w, FALSE, FALSE, FALSE, cs, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, paf, Face);
|
||||
}
|
||||
|
||||
BOOL CALLBACK FontExistsCallback(const LOGFONT*pLF, const TEXTMETRIC*pTM, DWORD Type, LPARAM Cookie)
|
||||
{
|
||||
*((BOOL*) Cookie) = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
BOOL FontExists(LPCTSTR Face)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
HDC hDC = GetDC(0);
|
||||
EnumFonts(hDC, Face, FontExistsCallback, (LPARAM) &ret);
|
||||
ReleaseDC(0, hDC);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL FillRectColor(HDC hDC, const RECT &Rect, COLORREF Color)
|
||||
{
|
||||
COLORREF orgclr = SetBkColor(hDC, Color);
|
||||
|
|
|
@ -127,6 +127,7 @@ inline HFONT CreateFontPt(HWND hWndDPI, int Height, WORD Weight, BYTE PitchAndFa
|
|||
{
|
||||
return CreateFont((INT_PTR) hWndDPI, CFF_DPIFROMHWND|CFF_DPIPT, Height, Weight, PitchAndFamily, CharSet, Face);
|
||||
}
|
||||
BOOL FontExists(LPCTSTR Face);
|
||||
BOOL FillRectColor(HDC hDC, const RECT &Rect, COLORREF Color);
|
||||
BOOL DrawHorzGradient(HDC hDC, LONG l, LONG t, LONG r, LONG b, COLORREF c1, COLORREF c2);
|
||||
inline long RectW(const RECT&r) { return r.right - r.left; }
|
||||
|
|
|
@ -723,6 +723,9 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
|
|||
#ifndef DEFAULT_CHARSET
|
||||
# define DEFAULT_CHARSET 1
|
||||
#endif
|
||||
#ifndef SHIFTJIS_CHARSET
|
||||
# define SHIFTJIS_CHARSET 128
|
||||
#endif
|
||||
#ifndef OUT_DEFAULT_PRECIS
|
||||
# define OUT_DEFAULT_PRECIS 0
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue