1
0
mirror of https://github.com/simh/simh.git synced 2026-03-04 10:34:40 +00:00

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.
This commit is contained in:
Mark Pizzolato
2022-10-07 07:36:15 -10:00
parent 5ccefb4163
commit c0925ad1e8
2 changed files with 14 additions and 6 deletions

View File

@@ -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" },

View File

@@ -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;