git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 2/2] compat/winansi: drop pre-Vista workaround

From
Matthias Aßhauer via GitGitGadget <gitgitgadget@gmail.com>
Date
Apr 6, 2026, 05:45 UTC
Message-ID
<0b50c30cdd97e52212dcbbd13f16632f04258431.1775454330.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.2081.v2.git.1775454330.gitgitgadget@gmail.com>
From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= <mha1993@live.de>

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>
---
 compat/winansi.c | 37 ++++---------------------------------
 1 file changed, 4 insertions(+), 33 deletions(-)
diff --git a/compat/winansi.c b/compat/winansi.c
index ac2ffb7869..3ce1900939 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -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 "
-- 
gitgitgadget
Previous: Matthias Aßhauer via GitGitGadgetNext: Junio C Hamano
Message 4 of 5 in “unify and bump _WIN32_WINNT definition to Windows 8.1”
  1. unify and bump _WIN32_WINNT definition to Windows 8.1Johannes Schindelin via GitGitGadget, Apr 5, 2026
  2. 0/2 unify and bump _WIN32_WINNT definition to Windows 8.1Johannes Schindelin via GitGitGadget, Apr 6, 2026
  3. 1/2 unify and bump _WIN32_WINNT definition to Windows 8.1Matthias Aßhauer via GitGitGadget, Apr 6, 2026
  4. 2/2 compat/winansi: drop pre-Vista workaroundMatthias Aßhauer via GitGitGadget, Apr 6, 2026
  5. Junio C HamanoApr 6, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.