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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matthias Aßhauer committed
Apr 6, 2026 at 05:45 UTC
2f8c3f6a5a6d6a3de205be709e1a598b9d4b0b3e
1 file changed
+4
-33
compat/winansi.c
+4
-33
@@ -32,47 +32,18 @@ static int non_ascii_used = 0;
32
static HANDLE hthread, hread, hwrite;
33
static HANDLE hconsole1, hconsole2;
34
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
-
35
static void warn_if_raster_font(void)
36
{
37
DWORD fontFamily = 0;
51
- DECLARE_PROC_ADDR(kernel32.dll, BOOL, WINAPI,
52
- GetCurrentConsoleFontEx, HANDLE, BOOL,
53
- PCONSOLE_FONT_INFOEX);
38
+ CONSOLE_FONT_INFOEX cfi;
39
40
/* don't bother if output was ascii only */
41
if (!non_ascii_used)
42
return;
43
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;
47
48
if (!(fontFamily & TMPF_TRUETYPE)) {
49
const wchar_t *msg = L"\nWarning: Your console font probably "