From c0925ad1e8c80c682f3fe4b20b9b7161f08b477b Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Fri, 7 Oct 2022 07:36:15 -1000 Subject: [PATCH] BESM6: Add option to SET CPU PANEL{=fontfilename.ttf} to specify the font name The BESM6 makefile build has always allowed a makefile argument FONTFILE=. That option still exists and will change the default font file. Also extend the default font file names to include one which is found on NetBSD. --- BESM6/besm6_cpu.c | 6 +++--- BESM6/besm6_panel.c | 14 +++++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/BESM6/besm6_cpu.c b/BESM6/besm6_cpu.c index 9239c523..f99c9651 100644 --- a/BESM6/besm6_cpu.c +++ b/BESM6/besm6_cpu.c @@ -149,9 +149,9 @@ MTAB cpu_mod[] = { { MTAB_XTD|MTAB_VDV, 0, NULL, "REQ", &cpu_req, NULL, NULL, "Sends a request interrupt" }, - { MTAB_XTD|MTAB_VDV, - 0, "PANEL", "PANEL", &besm6_init_panel, &besm6_show_panel, NULL, - "Displays graphical panel" }, + { MTAB_XTD|MTAB_VDV|MTAB_VALO|MTAB_QUOTE, + 0, "PANEL", "PANEL{=fontfilename}", &besm6_init_panel, &besm6_show_panel, NULL, + "Enable Display of graphical panel optionally specifying font name" }, { MTAB_XTD|MTAB_VDV, 0, NULL, "NOPANEL", &besm6_close_panel, NULL, NULL, "Closes graphical panel" }, diff --git a/BESM6/besm6_panel.c b/BESM6/besm6_panel.c index 3202aef5..28d2fe02 100644 --- a/BESM6/besm6_panel.c +++ b/BESM6/besm6_panel.c @@ -451,7 +451,7 @@ static SDL_Texture *sdlTexture; */ t_stat besm6_init_panel (UNIT *u, int32 val, CONST char *cptr, void *desc) { - const char *fontfile = NULL; + const char *fontfile = cptr; char fontfilepath[PATH_MAX + 1]; struct stat stat_buf; @@ -460,11 +460,19 @@ t_stat besm6_init_panel (UNIT *u, int32 val, CONST char *cptr, void *desc) #if defined (FONTFILE) fontfile = QUOTE(FONTFILE); #endif - if ((fontfile == NULL) || (sim_stat (fontfile, &stat_buf))) { + if ((fontfile == NULL) || + (sim_stat (fontfile, &stat_buf))) { const char *dirs[] = {"/usr/share/fonts", "/Library/Fonts", "/usr/lib/jvm", "/System/Library/Frameworks/JavaVM.framework/Versions", "/System/Library/Fonts/Supplemental", "C:/Windows/Fonts", NULL}; - const char *fonts[] = {"DejaVuSans.ttf", "LucidaSansRegular.ttf", "FreeSans.ttf", "AppleGothic.ttf", "tahoma.ttf", NULL}; + char *fonts[] = {NULL, "DejaVuSans.ttf", "LucidaSansRegular.ttf", "FreeSans.ttf", "AppleGothic.ttf", "tahoma.ttf", "LiberationSans-Regular.ttf", NULL}; const char **d, **f; + if (fontfile != NULL) + fonts[0] = fontfile; + else { + for (f = fonts; *(f + 1) = NULL; ++f) + *f = *(f + 1); + } + fontfile = NULL; for (d = dirs; (fontfile == NULL) && (*d != NULL); d++) { char **filelist;