summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2013-10-28 05:02:36 +0000
committerSimon Howard2013-10-28 05:02:36 +0000
commit387fcd4fa49ed888a287079c65f3c60c99b4be49 (patch)
tree669e9813372d82baa3774d08fcd77b36b055230d
parentbdb5c58d08eebeead15d4a8a08bae8b69c4cb0f7 (diff)
parent5387e91e31c7fc3653b51215f76f07144656000d (diff)
downloadchocolate-doom-387fcd4fa49ed888a287079c65f3c60c99b4be49.tar.gz
chocolate-doom-387fcd4fa49ed888a287079c65f3c60c99b4be49.tar.bz2
chocolate-doom-387fcd4fa49ed888a287079c65f3c60c99b4be49.zip
Merge from trunk.
Subversion-branch: /branches/v2-branch Subversion-revision: 2731
-rw-r--r--textscreen/txt_sdl.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c
index 20796dd5..895e1da0 100644
--- a/textscreen/txt_sdl.c
+++ b/textscreen/txt_sdl.c
@@ -122,6 +122,34 @@ static SDL_Color ega_colors[] =
#endif
+#ifdef _WIN32
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+// Examine system DPI settings to determine whether to use the large font.
+
+static int Win32_UseLargeFont(void)
+{
+ HDC hdc = GetDC(NULL);
+ int dpix;
+
+ if (!hdc)
+ {
+ return 0;
+ }
+
+ dpix = GetDeviceCaps(hdc, LOGPIXELSX);
+ ReleaseDC(NULL, hdc);
+
+ // 144 is the DPI when using "150%" scaling. If the user has this set
+ // then consider this an appropriate threshold for using the large font.
+
+ return dpix >= 144;
+}
+
+#endif
+
static txt_font_t *FontForName(char *name)
{
if (!strcmp(name, "small"))
@@ -190,10 +218,20 @@ static void ChooseFont(void)
{
font = &small_font;
}
+#ifdef _WIN32
+ // On Windows we can use the system DPI settings to make a
+ // more educated guess about whether to use the large font.
+
+ else if (Win32_UseLargeFont())
+ {
+ font = &large_font;
+ }
+#else
else if (info->current_w >= 1920 && info->current_h >= 1080)
{
font = &large_font;
}
+#endif
else
{
font = &main_font;