Skip to content

Commit 0b50c30

Browse files
rimruldscho
authored andcommitted
compat/winansi: drop pre-Vista workaround
1edeb9a (Win32: warn if the console font doesn't support Unicode, 2014-06-10) introduced both code to detect the current console font on Windows Vista and newer and a fallback for older systems to detect the default console font and issue a warning if that font doesn't support unicode. Since we haven't supported any Windows older than Vista in almost a decade, we don't need to keep the workaround. Signed-off-by: Matthias Aßhauer <mha1993@live.de> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 949696d commit 0b50c30

File tree

1 file changed

+4
-33
lines changed

1 file changed

+4
-33
lines changed

compat/winansi.c

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,47 +32,18 @@ static int non_ascii_used = 0;
3232
static HANDLE hthread, hread, hwrite;
3333
static HANDLE hconsole1, hconsole2;
3434

35-
#ifdef __MINGW32__
36-
#if !defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 5
37-
typedef struct _CONSOLE_FONT_INFOEX {
38-
ULONG cbSize;
39-
DWORD nFont;
40-
COORD dwFontSize;
41-
UINT FontFamily;
42-
UINT FontWeight;
43-
WCHAR FaceName[LF_FACESIZE];
44-
} CONSOLE_FONT_INFOEX, *PCONSOLE_FONT_INFOEX;
45-
#endif
46-
#endif
47-
4835
static void warn_if_raster_font(void)
4936
{
5037
DWORD fontFamily = 0;
51-
DECLARE_PROC_ADDR(kernel32.dll, BOOL, WINAPI,
52-
GetCurrentConsoleFontEx, HANDLE, BOOL,
53-
PCONSOLE_FONT_INFOEX);
38+
CONSOLE_FONT_INFOEX cfi;
5439

5540
/* don't bother if output was ascii only */
5641
if (!non_ascii_used)
5742
return;
5843

59-
/* GetCurrentConsoleFontEx is available since Vista */
60-
if (INIT_PROC_ADDR(GetCurrentConsoleFontEx)) {
61-
CONSOLE_FONT_INFOEX cfi;
62-
cfi.cbSize = sizeof(cfi);
63-
if (GetCurrentConsoleFontEx(console, 0, &cfi))
64-
fontFamily = cfi.FontFamily;
65-
} else {
66-
/* pre-Vista: check default console font in registry */
67-
HKEY hkey;
68-
if (ERROR_SUCCESS == RegOpenKeyExA(HKEY_CURRENT_USER, "Console",
69-
0, KEY_READ, &hkey)) {
70-
DWORD size = sizeof(fontFamily);
71-
RegQueryValueExA(hkey, "FontFamily", NULL, NULL,
72-
(LPVOID) &fontFamily, &size);
73-
RegCloseKey(hkey);
74-
}
75-
}
44+
cfi.cbSize = sizeof(cfi);
45+
if (GetCurrentConsoleFontEx(console, 0, &cfi))
46+
fontFamily = cfi.FontFamily;
7647

7748
if (!(fontFamily & TMPF_TRUETYPE)) {
7849
const wchar_t *msg = L"\nWarning: Your console font probably "

0 commit comments

Comments
 (0)