diff --git a/Contrib/Makensisw/Readme.txt b/Contrib/Makensisw/Readme.txt index fc7952bc..e6487182 100644 --- a/Contrib/Makensisw/Readme.txt +++ b/Contrib/Makensisw/Readme.txt @@ -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 diff --git a/Contrib/Makensisw/SConscript b/Contrib/Makensisw/SConscript index d7a6f7e0..a8732607 100644 --- a/Contrib/Makensisw/SConscript +++ b/Contrib/Makensisw/SConscript @@ -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 ) diff --git a/Contrib/Makensisw/makensisw.cpp b/Contrib/Makensisw/makensisw.cpp index 87efbe73..12983683 100644 --- a/Contrib/Makensisw/makensisw.cpp +++ b/Contrib/Makensisw/makensisw.cpp @@ -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(); diff --git a/Contrib/Makensisw/makensisw.h b/Contrib/Makensisw/makensisw.h index 28683823..2c54fb8a 100644 --- a/Contrib/Makensisw/makensisw.h +++ b/Contrib/Makensisw/makensisw.h @@ -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/" diff --git a/Contrib/Makensisw/utils.cpp b/Contrib/Makensisw/utils.cpp index cb4b8617..606ffb1a 100644 --- a/Contrib/Makensisw/utils.cpp +++ b/Contrib/Makensisw/utils.cpp @@ -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); diff --git a/Contrib/Makensisw/utils.h b/Contrib/Makensisw/utils.h index 65b7b635..7659a25d 100644 --- a/Contrib/Makensisw/utils.h +++ b/Contrib/Makensisw/utils.h @@ -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; } diff --git a/Source/Platform.h b/Source/Platform.h index c18d9012..39eed14b 100644 --- a/Source/Platform.h +++ b/Source/Platform.h @@ -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