Ozone: Add menu font selection

This commit is contained in:
sonninnos 2025-06-15 01:11:26 +03:00
parent 0fc847a176
commit b774a26bae
13 changed files with 93 additions and 3 deletions

View File

@ -1693,6 +1693,9 @@ static struct config_path_setting *populate_settings_path(
#ifdef HAVE_XMB
SETTING_PATH("xmb_font", settings->paths.path_menu_xmb_font, false, NULL, true);
#endif
#ifdef HAVE_OZONE
SETTING_PATH("ozone_font", settings->paths.path_menu_ozone_font, false, NULL, true);
#endif
#endif /* HAVE_MENU */
#ifdef HAVE_OVERLAY
@ -2917,6 +2920,9 @@ void config_set_defaults(void *data)
#ifdef HAVE_XMB
*settings->paths.path_menu_xmb_font = '\0';
#endif
#ifdef HAVE_OZONE
*settings->paths.path_menu_ozone_font = '\0';
#endif
configuration_set_string(settings,
settings->arrays.discord_app_id,
@ -5352,6 +5358,9 @@ bool config_save_file(const char *path)
config_set_path(conf, "xmb_font",
!string_is_empty(settings->paths.path_menu_xmb_font)
? settings->paths.path_menu_xmb_font : "");
config_set_path(conf, "ozone_font",
!string_is_empty(settings->paths.path_menu_ozone_font)
? settings->paths.path_menu_ozone_font : "");
#endif
/* String settings */

View File

@ -578,6 +578,7 @@ typedef struct settings
char bundle_assets_src[PATH_MAX_LENGTH];
char bundle_assets_dst[PATH_MAX_LENGTH];
char path_menu_xmb_font[PATH_MAX_LENGTH];
char path_menu_ozone_font[PATH_MAX_LENGTH];
char path_cheat_database[PATH_MAX_LENGTH];
char path_content_database[PATH_MAX_LENGTH];
char path_overlay[PATH_MAX_LENGTH];

View File

@ -2366,6 +2366,10 @@ MSG_HASH(
MENU_ENUM_LABEL_RGUI_MENU_THEME_PRESET,
"rgui_menu_theme_preset"
)
MSG_HASH(
MENU_ENUM_LABEL_OZONE_FONT,
"ozone_font"
)
MSG_HASH(
MENU_ENUM_LABEL_OZONE_MENU_COLOR_THEME,
"ozone_menu_color_theme"

View File

@ -12330,6 +12330,14 @@ MSG_HASH(
/* Ozone: Settings > User Interface > Appearance */
MSG_HASH(
MENU_ENUM_LABEL_VALUE_OZONE_FONT,
"Font"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_FONT,
"Select a different main font to be used by the menu."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_OZONE_COLLAPSE_SIDEBAR,
"Collapse the Sidebar"

View File

@ -151,6 +151,7 @@ GENERIC_DEFERRED_PUSH(deferred_push_input_overlay, DISPLAYLIST_
GENERIC_DEFERRED_PUSH(deferred_push_input_osk_overlay, DISPLAYLIST_OSK_OVERLAYS)
GENERIC_DEFERRED_PUSH(deferred_push_video_font_path, DISPLAYLIST_VIDEO_FONTS)
GENERIC_DEFERRED_PUSH(deferred_push_xmb_font_path, DISPLAYLIST_FONTS)
GENERIC_DEFERRED_PUSH(deferred_push_ozone_font_path, DISPLAYLIST_FONTS)
GENERIC_DEFERRED_PUSH(deferred_push_content_history_path, DISPLAYLIST_CONTENT_HISTORY)
GENERIC_DEFERRED_PUSH(deferred_push_disc_information, DISPLAYLIST_DISC_INFO)
GENERIC_DEFERRED_PUSH(deferred_push_system_information, DISPLAYLIST_SYSTEM_INFO)
@ -887,6 +888,7 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
{MENU_ENUM_LABEL_INPUT_OSK_OVERLAY, deferred_push_input_osk_overlay},
{MENU_ENUM_LABEL_VIDEO_FONT_PATH, deferred_push_video_font_path},
{MENU_ENUM_LABEL_XMB_FONT, deferred_push_xmb_font_path},
{MENU_ENUM_LABEL_OZONE_FONT, deferred_push_ozone_font_path},
{MENU_ENUM_LABEL_CHEAT_FILE_LOAD, deferred_push_cheat_file_load},
{MENU_ENUM_LABEL_CHEAT_FILE_LOAD_APPEND, deferred_push_cheat_file_load_append},
{MENU_ENUM_LABEL_REMAP_FILE_LOAD, deferred_push_remap_file_load},
@ -1253,6 +1255,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
case MENU_ENUM_LABEL_XMB_FONT:
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_xmb_font_path);
break;
case MENU_ENUM_LABEL_OZONE_FONT:
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_ozone_font_path);
break;
case MENU_ENUM_LABEL_CONTENT_HISTORY_PATH:
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_content_history_path);
break;

View File

@ -9721,6 +9721,8 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_FONT_PATH))
|| string_is_equal(menu_label,
msg_hash_to_str(MENU_ENUM_LABEL_XMB_FONT))
|| string_is_equal(menu_label,
msg_hash_to_str(MENU_ENUM_LABEL_OZONE_FONT))
|| string_is_equal(menu_label,
msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN))
|| string_is_equal(menu_label,

View File

@ -243,6 +243,19 @@ static int action_scan_video_xmb_font(const char *path,
}
#endif
#ifdef HAVE_OZONE
static int action_scan_video_ozone_font(const char *path,
const char *label, unsigned type, size_t idx)
{
settings_t *settings = config_get_ptr();
strlcpy(settings->paths.path_menu_ozone_font, "null", sizeof(settings->paths.path_menu_ozone_font));
command_event(CMD_EVENT_REINIT, NULL);
return 0;
}
#endif
static int menu_cbs_init_bind_scan_compare_type(menu_file_list_cbs_t *cbs,
unsigned type)
{
@ -307,6 +320,13 @@ int menu_cbs_init_bind_scan(menu_file_list_cbs_t *cbs,
BIND_ACTION_SCAN(cbs, action_scan_video_xmb_font);
return 0;
}
#endif
#ifdef HAVE_OZONE
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_OZONE_FONT)))
{
BIND_ACTION_SCAN(cbs, action_scan_video_ozone_font);
return 0;
}
#endif
break;
default:

View File

@ -1115,7 +1115,8 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_wallpaper_opacity,
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_framebuffer_opacity, MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_horizontal_animation, MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_ribbon_enable, MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_font, MENU_ENUM_SUBLABEL_XMB_FONT)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_xmb_font, MENU_ENUM_SUBLABEL_XMB_FONT)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_ozone_font, MENU_ENUM_SUBLABEL_OZONE_FONT)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_settings_show_drivers, MENU_ENUM_SUBLABEL_SETTINGS_SHOW_DRIVERS)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_settings_show_video, MENU_ENUM_SUBLABEL_SETTINGS_SHOW_VIDEO)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_settings_show_audio, MENU_ENUM_SUBLABEL_SETTINGS_SHOW_AUDIO)
@ -3160,7 +3161,10 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_video_tab);
break;
case MENU_ENUM_LABEL_XMB_FONT:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_font);
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_xmb_font);
break;
case MENU_ENUM_LABEL_OZONE_FONT:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_ozone_font);
break;
case MENU_ENUM_LABEL_XMB_RIBBON_ENABLE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_ribbon_enable);

View File

@ -771,6 +771,7 @@ DEFAULT_FILL_TITLE_MACRO(action_get_title_extraction_directory, MENU_ENUM_LABE
DEFAULT_FILL_TITLE_MACRO(action_get_title_menu, MENU_ENUM_LABEL_VALUE_MENU_SETTINGS)
DEFAULT_FILL_TITLE_MACRO(action_get_title_video_font_path, MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH)
DEFAULT_FILL_TITLE_MACRO(action_get_title_xmb_font, MENU_ENUM_LABEL_VALUE_XMB_FONT)
DEFAULT_FILL_TITLE_MACRO(action_get_title_ozone_font, MENU_ENUM_LABEL_VALUE_OZONE_FONT)
DEFAULT_FILL_TITLE_MACRO(action_get_title_log_dir, MENU_ENUM_LABEL_VALUE_LOG_DIR)
DEFAULT_FILL_TITLE_MACRO(action_get_title_manual_content_scan_dir, MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_DIR)
@ -1296,6 +1297,8 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
action_get_title_video_font_path},
{MENU_ENUM_LABEL_XMB_FONT,
action_get_title_xmb_font},
{MENU_ENUM_LABEL_OZONE_FONT,
action_get_title_ozone_font},
{MENU_ENUM_LABEL_VIDEO_FILTER,
action_get_title_video_filter},
{MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN,
@ -1737,6 +1740,9 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_XMB_FONT:
BIND_ACTION_GET_TITLE(cbs, action_get_title_xmb_font);
break;
case MENU_ENUM_LABEL_OZONE_FONT:
BIND_ACTION_GET_TITLE(cbs, action_get_title_ozone_font);
break;
case MENU_ENUM_LABEL_VIDEO_FILTER:
BIND_ACTION_GET_TITLE(cbs, action_get_title_video_filter);
break;

View File

@ -7136,7 +7136,7 @@ static void ozone_draw_messagebox(
return;
scale_factor = ozone->last_scale_factor;
usable_width = (int)width - (100 * 8 * scale_factor);
usable_width = (int)width - (150 * 8 * scale_factor) / ((float)width / (float)height * 2.0f);
line_height = font_data.line_height * 1.10f;
if (usable_width < 1)
@ -9275,6 +9275,10 @@ static bool ozone_init_font(
font_data->font = NULL;
}
/* Enforce minimum readable font size for small screens */
if (font_size < 9)
font_size = 9;
/* Cache approximate dimensions */
font_data->line_height = (int)(font_size + 0.5f);
font_data->glyph_width = (int)((font_size * (3.0f / 4.0f)) + 0.5f);
@ -9394,6 +9398,7 @@ static void ozone_set_layout(
bool is_threaded)
{
settings_t *settings = config_get_ptr();
const char *path_menu_font = settings->paths.path_menu_ozone_font;
char tmp_dir[DIR_MAX_LENGTH];
char font_path[PATH_MAX_LENGTH];
bool font_inited = false;
@ -9474,6 +9479,9 @@ static void ozone_set_layout(
break;
}
if (!string_is_empty(path_menu_font))
strlcpy(font_path, path_menu_font, sizeof(font_path));
font_inited = ozone_init_font(&ozone->fonts.title,
is_threaded, font_path, FONT_SIZE_TITLE * scale_factor);
if (!(((ozone->flags & OZONE_FLAG_HAS_ALL_ASSETS) > 0) && font_inited))
@ -9500,6 +9508,9 @@ static void ozone_set_layout(
break;
}
if (!string_is_empty(path_menu_font))
strlcpy(font_path, path_menu_font, sizeof(font_path));
/* Sidebar */
font_inited = ozone_init_font(&ozone->fonts.sidebar,
is_threaded, font_path, FONT_SIZE_SIDEBAR * scale_factor);

View File

@ -11794,6 +11794,7 @@ unsigned menu_displaylist_build_list(
{MENU_ENUM_LABEL_MENU_RGUI_THUMBNAIL_DELAY, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_MENU_THUMBNAIL_BACKGROUND_ENABLE, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_XMB_FONT, PARSE_ONLY_PATH, true},
{MENU_ENUM_LABEL_OZONE_FONT, PARSE_ONLY_PATH, true},
{MENU_ENUM_LABEL_MENU_FONT_COLOR_RED, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_MENU_FONT_COLOR_GREEN, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_MENU_FONT_COLOR_BLUE, PARSE_ONLY_UINT, true},

View File

@ -19718,6 +19718,24 @@ static bool setting_append_list(
general_read_handler,
SD_FLAG_NONE);
CONFIG_PATH(
list, list_info,
settings->paths.path_menu_ozone_font,
sizeof(settings->paths.path_menu_ozone_font),
MENU_ENUM_LABEL_OZONE_FONT,
MENU_ENUM_LABEL_VALUE_OZONE_FONT,
settings->paths.directory_assets,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
(*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_video_font_path;
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_FONT_SELECTOR;
MENU_SETTINGS_LIST_CURRENT_ADD_VALUES(list, list_info, "ttf");
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT);
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
CONFIG_BOOL(
list, list_info,
&settings->bools.ozone_scroll_content_metadata,

View File

@ -1642,6 +1642,7 @@ enum msg_hash_enums
MENU_LABEL(OZONE_PADDING_FACTOR),
MENU_LABEL(OZONE_HEADER_SEPARATOR),
MENU_LABEL(OZONE_COLLAPSE_SIDEBAR),
MENU_LABEL(OZONE_FONT),
MENU_LABEL(OZONE_TRUNCATE_PLAYLIST_NAME),
MENU_LABEL(OZONE_SORT_AFTER_TRUNCATE_PLAYLIST_NAME),
MENU_LABEL(OZONE_SCROLL_CONTENT_METADATA),