Git development
 help / color / mirror / Atom feed
From: "Matthias Aßhauer via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Johannes Schindelin" <johannes.schindelin@gmx.de>,
	"Matthias Aßhauer" <mha1993@live.de>
Subject: [PATCH v2 2/2] compat/winansi: drop pre-Vista workaround
Date: Mon, 06 Apr 2026 05:45:30 +0000	[thread overview]
Message-ID: <0b50c30cdd97e52212dcbbd13f16632f04258431.1775454330.git.gitgitgadget@gmail.com> (raw)
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

  parent reply	other threads:[~2026-04-06  5:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-05 10:54 [PATCH] unify and bump _WIN32_WINNT definition to Windows 8.1 Johannes Schindelin via GitGitGadget
2026-04-06  5:45 ` [PATCH v2 0/2] " Johannes Schindelin via GitGitGadget
2026-04-06  5:45   ` [PATCH v2 1/2] " Matthias Aßhauer via GitGitGadget
2026-04-06  5:45   ` Matthias Aßhauer via GitGitGadget [this message]
2026-04-06 17:07   ` [PATCH v2 0/2] " Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b50c30cdd97e52212dcbbd13f16632f04258431.1775454330.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=mha1993@live.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox