void ro_gui_options_fonts_default(wimp_pointer *pointer) { const char *fallback = nsfont_fallback_font(); /* set the default values */ ro_gui_set_icon_decimal(pointer->w, FONT_DEFAULT_SIZE, 128, 1); ro_gui_set_icon_decimal(pointer->w, FONT_MINIMUM_SIZE, 85, 1); ro_gui_set_icon_string(pointer->w, FONT_SANS_FIELD, nsfont_exists("Homerton") ? "Homerton" : fallback, true); ro_gui_set_icon_string(pointer->w, FONT_SERIF_FIELD, nsfont_exists("Trinity") ? "Trinity" : fallback, true); ro_gui_set_icon_string(pointer->w, FONT_MONOSPACE_FIELD, nsfont_exists("Corpus") ? "Corpus" : fallback, true); ro_gui_set_icon_string(pointer->w, FONT_CURSIVE_FIELD, nsfont_exists("Churchill") ? "Churchill" : fallback, true); ro_gui_set_icon_string(pointer->w, FONT_FANTASY_FIELD, nsfont_exists("Sassoon") ? "Sassoon" : fallback, true); ro_gui_set_icon_string(pointer->w, FONT_DEFAULT_FIELD, font_names[0], true); }
/** * Initialize font handling. * * Exits through die() on error. */ void nsfont_init(void) { const char *fallback; rufl_code code; nsfont_check_fonts(); LOG("Initialise RUfl"); code = rufl_init(); if (code != rufl_OK) { if (code == rufl_FONT_MANAGER_ERROR) LOG("rufl_init: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess); else LOG("rufl_init: 0x%x", code); die("The Unicode font library could not be initialized. " "Please report this to the developers."); } LOG("RUfl initialised"); if (rufl_family_list_entries == 0) die("No fonts could be found. At least one font must be " "installed."); fallback = nsfont_fallback_font(); nsfont_check_option(&nsoption_charp(font_sans), "Homerton", fallback); nsfont_check_option(&nsoption_charp(font_serif), "Trinity", fallback); nsfont_check_option(&nsoption_charp(font_mono), "Corpus", fallback); nsfont_check_option(&nsoption_charp(font_cursive), "Churchill", fallback); nsfont_check_option(&nsoption_charp(font_fantasy), "Sassoon", fallback); if (nsoption_int(font_default) != PLOT_FONT_FAMILY_SANS_SERIF && nsoption_int(font_default) != PLOT_FONT_FAMILY_SERIF && nsoption_int(font_default) != PLOT_FONT_FAMILY_MONOSPACE && nsoption_int(font_default) != PLOT_FONT_FAMILY_CURSIVE && nsoption_int(font_default) != PLOT_FONT_FAMILY_FANTASY) { nsoption_set_int(font_default, PLOT_FONT_FAMILY_SANS_SERIF); } }