From 06970c54a7faf4c4fc8cce6d0871fb907714e96d Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Tue, 30 Dec 2008 19:43:34 +0000 Subject: [PATCH] Added two new Windows OSD options: -debugger_font and -debugger_font_size, which control the font and size used in the debugger text Windows. These default to "Lucida Console" and 9pt, which is the same face as previously hard-coded but 1pt larger. Personally, I prefer "Consolas" 9pt, which is one of the new "C" fonts included with Windows Vista and later (also available for free download on older systems). Note that only fixed-width fonts really work here, for obvious reasons. --- src/osd/windows/debugwin.c | 23 ++++++++--- src/osd/windows/winmain.c | 2 + src/osd/windows/winmain.h | 82 +++++++++++++++++++++++++------------- 3 files changed, 75 insertions(+), 32 deletions(-) diff --git a/src/osd/windows/debugwin.c b/src/osd/windows/debugwin.c index 3a771aa3b6f..cef22ad28da 100644 --- a/src/osd/windows/debugwin.c +++ b/src/osd/windows/debugwin.c @@ -26,6 +26,7 @@ // MAMEOS headers #include "debugwin.h" +#include "winmain.h" #include "window.h" #include "video.h" #include "input.h" @@ -390,17 +391,29 @@ void debugwin_init_windows(void) if (temp_dc != NULL) { - // create a standard Lucida Console 8 font - debug_font = CreateFont(-MulDiv(8, GetDeviceCaps(temp_dc, LOGPIXELSY), 72), 0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, - ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, TEXT("Lucida Console")); + int size = options_get_int(mame_options(), WINOPTION_DEBUGGER_FONT_SIZE); + TCHAR *t_face; + + // create a standard font + t_face = tstring_from_utf8(options_get_string(mame_options(), WINOPTION_DEBUGGER_FONT)); + debug_font = CreateFont(-MulDiv(size, GetDeviceCaps(temp_dc, LOGPIXELSY), 72), 0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, + ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, t_face); + free(t_face); + + // fall back to Lucida Console 8 if (debug_font == NULL) - fatalerror("Unable to create debug font"); + { + debug_font = CreateFont(-MulDiv(8, GetDeviceCaps(temp_dc, LOGPIXELSY), 72), 0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, + ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, TEXT("Lucida Console")); + if (debug_font == NULL) + fatalerror("Unable to create debug font"); + } // get the metrics old_font = SelectObject(temp_dc, debug_font); if (GetTextMetrics(temp_dc, &metrics)) { - debug_font_width = metrics.tmMaxCharWidth; + debug_font_width = metrics.tmAveCharWidth; debug_font_height = metrics.tmHeight; debug_font_ascent = metrics.tmAscent + metrics.tmExternalLeading; } diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c index 8e75c833a6a..7725f383140 100644 --- a/src/osd/windows/winmain.c +++ b/src/osd/windows/winmain.c @@ -126,6 +126,8 @@ const options_entry mame_win_options[] = { NULL, NULL, OPTION_HEADER, "WINDOWS DEBUGGING OPTIONS" }, { "oslog", "0", OPTION_BOOLEAN, "output error.log data to the system debugger" }, { "watchdog;wdog", "0", 0, "force the program to terminate if no updates within specified number of seconds" }, + { "debugger_font;dfont", "Lucida Console", 0, "specifies the font to use for debugging; defaults to Lucida Console" }, + { "debugger_font_size;dfontsize", "9", 0, "specifies the font size to use for debugging; defaults to 9 pt" }, // performance options { NULL, NULL, OPTION_HEADER, "WINDOWS PERFORMANCE OPTIONS" }, diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h index 9565020579f..7a601c051ae 100644 --- a/src/osd/windows/winmain.h +++ b/src/osd/windows/winmain.h @@ -12,45 +12,73 @@ // CONSTANTS //============================================================ +// debugging options +#define WINOPTION_OSLOG "oslog" +#define WINOPTION_WATCHDOG "watchdog" +#define WINOPTION_DEBUGGER_FONT "debugger_font" +#define WINOPTION_DEBUGGER_FONT_SIZE "debugger_font_size" + +// performance options +#define WINOPTION_PRIORITY "priority" +#define WINOPTION_MULTITHREADING "multithreading" + // video options -#define WINOPTION_D3DVERSION "d3dversion" #define WINOPTION_VIDEO "video" -#define WINOPTION_PRESCALE "prescale" #define WINOPTION_NUMSCREENS "numscreens" -#define WINOPTION_WAITVSYNC "waitvsync" -#define WINOPTION_TRIPLEBUFFER "triplebuffer" -#define WINOPTION_HWSTRETCH "hwstretch" -#define WINOPTION_SWITCHRES "switchres" +#define WINOPTION_WINDOW "window" +#define WINOPTION_MAXIMIZE "maximize" #define WINOPTION_KEEPASPECT "keepaspect" -#define WINOPTION_SYNCREFRESH "syncrefresh" -#define WINOPTION_FULLSCREENGAMMA "full_screen_gamma" -#define WINOPTION_FULLSCREENBRIGHTNESS "full_screen_brightness" -#define WINOPTION_FULLLSCREENCONTRAST "full_screen_contrast" +#define WINOPTION_PRESCALE "prescale" #define WINOPTION_EFFECT "effect" +#define WINOPTION_WAITVSYNC "waitvsync" +#define WINOPTION_SYNCREFRESH "syncrefresh" + +// DirectDraw-specific options +#define WINOPTION_HWSTRETCH "hwstretch" + +// Direct3D-specific options +#define WINOPTION_D3DVERSION "d3dversion" +#define WINOPTION_FILTER "filter" + +// per-window options +#define WINOPTION_SCREEN "screen" #define WINOPTION_ASPECT "aspect" #define WINOPTION_RESOLUTION "resolution" -#define WINOPTION_RESOLUTION0 "resolution0" -#define WINOPTION_RESOLUTION1 "resolution1" -#define WINOPTION_RESOLUTION2 "resolution2" -#define WINOPTION_RESOLUTION3 "resolution3" -#define WINOPTION_FILTER "filter" -#define WINOPTION_SCREEN "screen" - -// window options #define WINOPTION_VIEW "view" -#define WINOPTION_MAXIMIZE "maximize" -#define WINOPTION_WINDOW "window" + +#define WINOPTION_SCREEN0 "screen0" +#define WINOPTION_ASPECT0 "aspect0" +#define WINOPTION_RESOLUTION0 "resolution0" +#define WINOPTION_VIEW0 "view0" + +#define WINOPTION_SCREEN1 "screen1" +#define WINOPTION_ASPECT1 "aspect1" +#define WINOPTION_RESOLUTION1 "resolution1" +#define WINOPTION_VIEW1 "view1" + +#define WINOPTION_SCREEN2 "screen2" +#define WINOPTION_ASPECT2 "aspect2" +#define WINOPTION_RESOLUTION2 "resolution2" +#define WINOPTION_VIEW2 "view2" + +#define WINOPTION_SCREEN3 "screen3" +#define WINOPTION_ASPECT3 "aspect3" +#define WINOPTION_RESOLUTION3 "resolution3" +#define WINOPTION_VIEW3 "view3" + +// full screen options +#define WINOPTION_TRIPLEBUFFER "triplebuffer" +#define WINOPTION_SWITCHRES "switchres" +#define WINOPTION_FULLSCREENBRIGHTNESS "full_screen_brightness" +#define WINOPTION_FULLLSCREENCONTRAST "full_screen_contrast" +#define WINOPTION_FULLSCREENGAMMA "full_screen_gamma" + +// sound options +#define WINOPTION_AUDIO_LATENCY "audio_latency" // input options #define WINOPTION_DUAL_LIGHTGUN "dual_lightgun" -// misc options -#define WINOPTION_AUDIO_LATENCY "audio_latency" -#define WINOPTION_PRIORITY "priority" -#define WINOPTION_MULTITHREADING "multithreading" -#define WINOPTION_WATCHDOG "watchdog" -#define WINOPTION_OSLOG "oslog" - //============================================================