summaryrefslogtreecommitdiff
path: root/textscreen
diff options
context:
space:
mode:
Diffstat (limited to 'textscreen')
-rw-r--r--textscreen/txt_sdl.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c
index 0df9fc93..315d2762 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