"uifont" option: tell us what we wanted & what we got

The requested font & actual font loaded will be echo'd to STDOUT
when specifying the `uifont` option.

This uses Pango library directly (I was unable to convice SDL2_Pango.h
to actually notice that pango.h was #include'd before it, and expose
its SDLPango_GetPangoFontDescription() function!).  This is okay,
since we want to also add a "--uifont list" option (or similar),
that will list all of the available fonts, if a user wishes to
query them.  (And similar code will be added to tuxpaint-config to make
the setting available as a pull-down, rather than (or as well as) a
freeform type-in field.)
This commit is contained in:
Bill Kendrick 2023-06-01 00:20:41 -07:00
parent 64eeec1a98
commit 1b6ee72e87
5 changed files with 133 additions and 24 deletions

View file

@ -27879,15 +27879,28 @@ static void setup_config(char *argv[])
if (tmpcfg.tp_ui_font)
{
char * tmp_str;
if (strcmp(tmpcfg.tp_ui_font, "default") == 0)
{
printf/*DEBUG_PRINTF*/("UI font will be default: %s\n", PANGO_DEFAULT_FONT);
printf/*DEBUG_PRINTF*/("Requested default UI font, \"%s\"\n", PANGO_DEFAULT_FONT);
tp_ui_font = strdup(PANGO_DEFAULT_FONT);
}
else
{
tp_ui_font = strdup(tmpcfg.tp_ui_font);
printf/*DEBUG_PRINTF*/("UI font will be: %s\n", tp_ui_font);
printf/*DEBUG_PRINTF*/("Requested UI font described by \"%s\"\n", tp_ui_font);
}
tmp_str = ask_pango_for_font(tp_ui_font);
if (tmp_str != NULL)
{
printf("Actual UI font will be \"%s\"\n", tmp_str);
free(tmp_str);
}
else
{
printf("Error asking pango for actual font!\n");
}
}
else