shithub: cstory

Download patch

ref: 0faf06224f647c67a5252ce1df68bbfe1e3b6204
parent: ea489f9063394a30743dc68f89e71a608f801fd0
author: Clownacy <Clownacy@users.noreply.github.com>
date: Sun Sep 1 16:30:26 EDT 2019

Added a bugfix for font creation

Fixes Japanese builds using the wrong charset on non-Japanese Windows
installations, and fixed the font using antialiasing, causing it to
clash with the game's colour-keying.

--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -829,10 +829,26 @@
 
 	// The game uses DEFAULT_CHARSET when it should have used SHIFTJIS_CHARSET.
 	// This breaks the Japanese text on English Windows installations.
-	font = CreateFontA(height, width, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_DONTCARE, name);
 
+	// Also, the game uses DEFAULT_QUALITY instead of NONANTIALIASED_QUALITY,
+	// causing font antialiasing to blend with the colour-key, giving text ab
+	// ugly black outline.
+#ifdef FIX_BUGS
+	#define QUALITY NONANTIALIASED_QUALITY
+	#ifdef JAPANESE
+		#define CHARSET SHIFTJIS_CHARSET
+	#else
+		#define CHARSET DEFAULT_CHARSET
+	#endif
+#else
+	#define QUALITY DEFAULT_QUALITY
+	#define CHARSET DEFAULT_CHARSET
+#endif
+
+	font = CreateFontA(height, width, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, QUALITY, FIXED_PITCH | FF_DONTCARE, name);
+
 	if (font == NULL)
-		font = CreateFontA(height, width, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_DONTCARE, NULL);
+		font = CreateFontA(height, width, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, QUALITY, FIXED_PITCH | FF_DONTCARE, NULL);
 }
 
 void PutText(int x, int y, const char *text, unsigned long color)