]> git.ipfire.org Git - thirdparty/git.git/commitdiff
compat/winansi: drop pre-Vista workaround
authorMatthias Aßhauer <mha1993@live.de>
Mon, 6 Apr 2026 05:45:30 +0000 (05:45 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Apr 2026 17:06:22 +0000 (10:06 -0700)
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>
compat/winansi.c

index ac2ffb78691a7d6bcae3b29e75019c8fb9339a67..3ce190093901b4b208864ba72644b069feafaacf 100644 (file)
@@ -32,47 +32,18 @@ static int non_ascii_used = 0;
 static HANDLE hthread, hread, hwrite;
 static HANDLE hconsole1, hconsole2;
 
-#ifdef __MINGW32__
-#if !defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 5
-typedef struct _CONSOLE_FONT_INFOEX {
-       ULONG cbSize;
-       DWORD nFont;
-       COORD dwFontSize;
-       UINT FontFamily;
-       UINT FontWeight;
-       WCHAR FaceName[LF_FACESIZE];
-} CONSOLE_FONT_INFOEX, *PCONSOLE_FONT_INFOEX;
-#endif
-#endif
-
 static void warn_if_raster_font(void)
 {
        DWORD fontFamily = 0;
-       DECLARE_PROC_ADDR(kernel32.dll, BOOL, WINAPI,
-                       GetCurrentConsoleFontEx, HANDLE, BOOL,
-                       PCONSOLE_FONT_INFOEX);
+       CONSOLE_FONT_INFOEX cfi;
 
        /* don't bother if output was ascii only */
        if (!non_ascii_used)
                return;
 
-       /* GetCurrentConsoleFontEx is available since Vista */
-       if (INIT_PROC_ADDR(GetCurrentConsoleFontEx)) {
-               CONSOLE_FONT_INFOEX cfi;
-               cfi.cbSize = sizeof(cfi);
-               if (GetCurrentConsoleFontEx(console, 0, &cfi))
-                       fontFamily = cfi.FontFamily;
-       } else {
-               /* pre-Vista: check default console font in registry */
-               HKEY hkey;
-               if (ERROR_SUCCESS == RegOpenKeyExA(HKEY_CURRENT_USER, "Console",
-                               0, KEY_READ, &hkey)) {
-                       DWORD size = sizeof(fontFamily);
-                       RegQueryValueExA(hkey, "FontFamily", NULL, NULL,
-                                       (LPVOID) &fontFamily, &size);
-                       RegCloseKey(hkey);
-               }
-       }
+       cfi.cbSize = sizeof(cfi);
+       if (GetCurrentConsoleFontEx(console, 0, &cfi))
+               fontFamily = cfi.FontFamily;
 
        if (!(fontFamily & TMPF_TRUETYPE)) {
                const wchar_t *msg = L"\nWarning: Your console font probably "