Skip to content

Commit b774a26

Browse files
committed
Ozone: Add menu font selection
1 parent 0fc847a commit b774a26

13 files changed

Lines changed: 93 additions & 3 deletions

configuration.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,6 +1693,9 @@ static struct config_path_setting *populate_settings_path(
16931693
#ifdef HAVE_XMB
16941694
SETTING_PATH("xmb_font", settings->paths.path_menu_xmb_font, false, NULL, true);
16951695
#endif
1696+
#ifdef HAVE_OZONE
1697+
SETTING_PATH("ozone_font", settings->paths.path_menu_ozone_font, false, NULL, true);
1698+
#endif
16961699
#endif /* HAVE_MENU */
16971700

16981701
#ifdef HAVE_OVERLAY
@@ -2917,6 +2920,9 @@ void config_set_defaults(void *data)
29172920
#ifdef HAVE_XMB
29182921
*settings->paths.path_menu_xmb_font = '\0';
29192922
#endif
2923+
#ifdef HAVE_OZONE
2924+
*settings->paths.path_menu_ozone_font = '\0';
2925+
#endif
29202926

29212927
configuration_set_string(settings,
29222928
settings->arrays.discord_app_id,
@@ -5352,6 +5358,9 @@ bool config_save_file(const char *path)
53525358
config_set_path(conf, "xmb_font",
53535359
!string_is_empty(settings->paths.path_menu_xmb_font)
53545360
? settings->paths.path_menu_xmb_font : "");
5361+
config_set_path(conf, "ozone_font",
5362+
!string_is_empty(settings->paths.path_menu_ozone_font)
5363+
? settings->paths.path_menu_ozone_font : "");
53555364
#endif
53565365

53575366
/* String settings */

configuration.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ typedef struct settings
578578
char bundle_assets_src[PATH_MAX_LENGTH];
579579
char bundle_assets_dst[PATH_MAX_LENGTH];
580580
char path_menu_xmb_font[PATH_MAX_LENGTH];
581+
char path_menu_ozone_font[PATH_MAX_LENGTH];
581582
char path_cheat_database[PATH_MAX_LENGTH];
582583
char path_content_database[PATH_MAX_LENGTH];
583584
char path_overlay[PATH_MAX_LENGTH];

intl/msg_hash_lbl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,6 +2366,10 @@ MSG_HASH(
23662366
MENU_ENUM_LABEL_RGUI_MENU_THEME_PRESET,
23672367
"rgui_menu_theme_preset"
23682368
)
2369+
MSG_HASH(
2370+
MENU_ENUM_LABEL_OZONE_FONT,
2371+
"ozone_font"
2372+
)
23692373
MSG_HASH(
23702374
MENU_ENUM_LABEL_OZONE_MENU_COLOR_THEME,
23712375
"ozone_menu_color_theme"

intl/msg_hash_us.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12330,6 +12330,14 @@ MSG_HASH(
1233012330

1233112331
/* Ozone: Settings > User Interface > Appearance */
1233212332

12333+
MSG_HASH(
12334+
MENU_ENUM_LABEL_VALUE_OZONE_FONT,
12335+
"Font"
12336+
)
12337+
MSG_HASH(
12338+
MENU_ENUM_SUBLABEL_OZONE_FONT,
12339+
"Select a different main font to be used by the menu."
12340+
)
1233312341
MSG_HASH(
1233412342
MENU_ENUM_LABEL_VALUE_OZONE_COLLAPSE_SIDEBAR,
1233512343
"Collapse the Sidebar"

menu/cbs/menu_cbs_deferred_push.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ GENERIC_DEFERRED_PUSH(deferred_push_input_overlay, DISPLAYLIST_
151151
GENERIC_DEFERRED_PUSH(deferred_push_input_osk_overlay, DISPLAYLIST_OSK_OVERLAYS)
152152
GENERIC_DEFERRED_PUSH(deferred_push_video_font_path, DISPLAYLIST_VIDEO_FONTS)
153153
GENERIC_DEFERRED_PUSH(deferred_push_xmb_font_path, DISPLAYLIST_FONTS)
154+
GENERIC_DEFERRED_PUSH(deferred_push_ozone_font_path, DISPLAYLIST_FONTS)
154155
GENERIC_DEFERRED_PUSH(deferred_push_content_history_path, DISPLAYLIST_CONTENT_HISTORY)
155156
GENERIC_DEFERRED_PUSH(deferred_push_disc_information, DISPLAYLIST_DISC_INFO)
156157
GENERIC_DEFERRED_PUSH(deferred_push_system_information, DISPLAYLIST_SYSTEM_INFO)
@@ -887,6 +888,7 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
887888
{MENU_ENUM_LABEL_INPUT_OSK_OVERLAY, deferred_push_input_osk_overlay},
888889
{MENU_ENUM_LABEL_VIDEO_FONT_PATH, deferred_push_video_font_path},
889890
{MENU_ENUM_LABEL_XMB_FONT, deferred_push_xmb_font_path},
891+
{MENU_ENUM_LABEL_OZONE_FONT, deferred_push_ozone_font_path},
890892
{MENU_ENUM_LABEL_CHEAT_FILE_LOAD, deferred_push_cheat_file_load},
891893
{MENU_ENUM_LABEL_CHEAT_FILE_LOAD_APPEND, deferred_push_cheat_file_load_append},
892894
{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(
12531255
case MENU_ENUM_LABEL_XMB_FONT:
12541256
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_xmb_font_path);
12551257
break;
1258+
case MENU_ENUM_LABEL_OZONE_FONT:
1259+
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_ozone_font_path);
1260+
break;
12561261
case MENU_ENUM_LABEL_CONTENT_HISTORY_PATH:
12571262
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_content_history_path);
12581263
break;

menu/cbs/menu_cbs_ok.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9721,6 +9721,8 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
97219721
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_FONT_PATH))
97229722
|| string_is_equal(menu_label,
97239723
msg_hash_to_str(MENU_ENUM_LABEL_XMB_FONT))
9724+
|| string_is_equal(menu_label,
9725+
msg_hash_to_str(MENU_ENUM_LABEL_OZONE_FONT))
97249726
|| string_is_equal(menu_label,
97259727
msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN))
97269728
|| string_is_equal(menu_label,

menu/cbs/menu_cbs_scan.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,19 @@ static int action_scan_video_xmb_font(const char *path,
243243
}
244244
#endif
245245

246+
#ifdef HAVE_OZONE
247+
static int action_scan_video_ozone_font(const char *path,
248+
const char *label, unsigned type, size_t idx)
249+
{
250+
settings_t *settings = config_get_ptr();
251+
252+
strlcpy(settings->paths.path_menu_ozone_font, "null", sizeof(settings->paths.path_menu_ozone_font));
253+
command_event(CMD_EVENT_REINIT, NULL);
254+
255+
return 0;
256+
}
257+
#endif
258+
246259
static int menu_cbs_init_bind_scan_compare_type(menu_file_list_cbs_t *cbs,
247260
unsigned type)
248261
{
@@ -307,6 +320,13 @@ int menu_cbs_init_bind_scan(menu_file_list_cbs_t *cbs,
307320
BIND_ACTION_SCAN(cbs, action_scan_video_xmb_font);
308321
return 0;
309322
}
323+
#endif
324+
#ifdef HAVE_OZONE
325+
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_OZONE_FONT)))
326+
{
327+
BIND_ACTION_SCAN(cbs, action_scan_video_ozone_font);
328+
return 0;
329+
}
310330
#endif
311331
break;
312332
default:

menu/cbs/menu_cbs_sublabel.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,8 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_wallpaper_opacity,
11151115
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_framebuffer_opacity, MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY)
11161116
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_horizontal_animation, MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION)
11171117
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_ribbon_enable, MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE)
1118-
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_font, MENU_ENUM_SUBLABEL_XMB_FONT)
1118+
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_xmb_font, MENU_ENUM_SUBLABEL_XMB_FONT)
1119+
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_ozone_font, MENU_ENUM_SUBLABEL_OZONE_FONT)
11191120
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_settings_show_drivers, MENU_ENUM_SUBLABEL_SETTINGS_SHOW_DRIVERS)
11201121
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_settings_show_video, MENU_ENUM_SUBLABEL_SETTINGS_SHOW_VIDEO)
11211122
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,
31603161
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_video_tab);
31613162
break;
31623163
case MENU_ENUM_LABEL_XMB_FONT:
3163-
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_font);
3164+
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_xmb_font);
3165+
break;
3166+
case MENU_ENUM_LABEL_OZONE_FONT:
3167+
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_ozone_font);
31643168
break;
31653169
case MENU_ENUM_LABEL_XMB_RIBBON_ENABLE:
31663170
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_ribbon_enable);

menu/cbs/menu_cbs_title.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,7 @@ DEFAULT_FILL_TITLE_MACRO(action_get_title_extraction_directory, MENU_ENUM_LABE
771771
DEFAULT_FILL_TITLE_MACRO(action_get_title_menu, MENU_ENUM_LABEL_VALUE_MENU_SETTINGS)
772772
DEFAULT_FILL_TITLE_MACRO(action_get_title_video_font_path, MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH)
773773
DEFAULT_FILL_TITLE_MACRO(action_get_title_xmb_font, MENU_ENUM_LABEL_VALUE_XMB_FONT)
774+
DEFAULT_FILL_TITLE_MACRO(action_get_title_ozone_font, MENU_ENUM_LABEL_VALUE_OZONE_FONT)
774775
DEFAULT_FILL_TITLE_MACRO(action_get_title_log_dir, MENU_ENUM_LABEL_VALUE_LOG_DIR)
775776
DEFAULT_FILL_TITLE_MACRO(action_get_title_manual_content_scan_dir, MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_DIR)
776777

@@ -1296,6 +1297,8 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
12961297
action_get_title_video_font_path},
12971298
{MENU_ENUM_LABEL_XMB_FONT,
12981299
action_get_title_xmb_font},
1300+
{MENU_ENUM_LABEL_OZONE_FONT,
1301+
action_get_title_ozone_font},
12991302
{MENU_ENUM_LABEL_VIDEO_FILTER,
13001303
action_get_title_video_filter},
13011304
{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,
17371740
case MENU_ENUM_LABEL_XMB_FONT:
17381741
BIND_ACTION_GET_TITLE(cbs, action_get_title_xmb_font);
17391742
break;
1743+
case MENU_ENUM_LABEL_OZONE_FONT:
1744+
BIND_ACTION_GET_TITLE(cbs, action_get_title_ozone_font);
1745+
break;
17401746
case MENU_ENUM_LABEL_VIDEO_FILTER:
17411747
BIND_ACTION_GET_TITLE(cbs, action_get_title_video_filter);
17421748
break;

menu/drivers/ozone.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7136,7 +7136,7 @@ static void ozone_draw_messagebox(
71367136
return;
71377137

71387138
scale_factor = ozone->last_scale_factor;
7139-
usable_width = (int)width - (100 * 8 * scale_factor);
7139+
usable_width = (int)width - (150 * 8 * scale_factor) / ((float)width / (float)height * 2.0f);
71407140
line_height = font_data.line_height * 1.10f;
71417141

71427142
if (usable_width < 1)
@@ -9275,6 +9275,10 @@ static bool ozone_init_font(
92759275
font_data->font = NULL;
92769276
}
92779277

9278+
/* Enforce minimum readable font size for small screens */
9279+
if (font_size < 9)
9280+
font_size = 9;
9281+
92789282
/* Cache approximate dimensions */
92799283
font_data->line_height = (int)(font_size + 0.5f);
92809284
font_data->glyph_width = (int)((font_size * (3.0f / 4.0f)) + 0.5f);
@@ -9394,6 +9398,7 @@ static void ozone_set_layout(
93949398
bool is_threaded)
93959399
{
93969400
settings_t *settings = config_get_ptr();
9401+
const char *path_menu_font = settings->paths.path_menu_ozone_font;
93979402
char tmp_dir[DIR_MAX_LENGTH];
93989403
char font_path[PATH_MAX_LENGTH];
93999404
bool font_inited = false;
@@ -9474,6 +9479,9 @@ static void ozone_set_layout(
94749479
break;
94759480
}
94769481

9482+
if (!string_is_empty(path_menu_font))
9483+
strlcpy(font_path, path_menu_font, sizeof(font_path));
9484+
94779485
font_inited = ozone_init_font(&ozone->fonts.title,
94789486
is_threaded, font_path, FONT_SIZE_TITLE * scale_factor);
94799487
if (!(((ozone->flags & OZONE_FLAG_HAS_ALL_ASSETS) > 0) && font_inited))
@@ -9500,6 +9508,9 @@ static void ozone_set_layout(
95009508
break;
95019509
}
95029510

9511+
if (!string_is_empty(path_menu_font))
9512+
strlcpy(font_path, path_menu_font, sizeof(font_path));
9513+
95039514
/* Sidebar */
95049515
font_inited = ozone_init_font(&ozone->fonts.sidebar,
95059516
is_threaded, font_path, FONT_SIZE_SIDEBAR * scale_factor);

0 commit comments

Comments
 (0)