diff options
author | Simon Howard | 2010-12-10 22:44:01 +0000 |
---|---|---|
committer | Simon Howard | 2010-12-10 22:44:01 +0000 |
commit | 8dab0a3e635db40359c8ddeb9afaa9eca626ee98 (patch) | |
tree | cfd01bd0c96a97fcffad588782a5d106ca1b3d2f /textscreen/txt_sdl.c | |
parent | 005747a6174d2d5b72e1af196a72cafb9b801a58 (diff) | |
parent | 678a8f9aeea9fa1966b3e8a94974688fda4d8fe1 (diff) | |
download | chocolate-doom-8dab0a3e635db40359c8ddeb9afaa9eca626ee98.tar.gz chocolate-doom-8dab0a3e635db40359c8ddeb9afaa9eca626ee98.tar.bz2 chocolate-doom-8dab0a3e635db40359c8ddeb9afaa9eca626ee98.zip |
Merge from trunk. This is slightly out of date as I did the merge
several days ago.
Subversion-branch: /branches/raven-branch
Subversion-revision: 2212
Diffstat (limited to 'textscreen/txt_sdl.c')
-rw-r--r-- | textscreen/txt_sdl.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index a0cbe3d6..33659fcc 100644 --- a/textscreen/txt_sdl.c +++ b/textscreen/txt_sdl.c @@ -119,6 +119,22 @@ static SDL_Color ega_colors[] = #endif +static txt_font_t *FontForName(char *name) +{ + if (!strcmp(name, "small")) + { + return &small_font; + } + else if (!strcmp(name, "normal")) + { + return &main_font; + } + else + { + return NULL; + } +} + // // Select the font to use, based on screen resolution // @@ -129,9 +145,22 @@ static SDL_Color ega_colors[] = static void ChooseFont(void) { SDL_Rect **modes; + char *env; int i; - font = &main_font; + // Allow normal selection to be overridden from an environment variable: + + env = getenv("TEXTSCREEN_FONT"); + + if (env != NULL) + { + font = FontForName(env); + + if (font != NULL) + { + return; + } + } // Check all modes @@ -140,6 +169,8 @@ static void ChooseFont(void) // If in doubt and we can't get a list, always prefer to // fall back to the normal font: + font = &main_font; + if (modes == NULL || modes == (SDL_Rect **) -1 || *modes == NULL) { #ifdef _WIN32_WCE |