Fix issues with new font rendering in libdragon

This commit is contained in:
Mateusz Faderewski 2024-05-21 18:06:33 +02:00
parent 91f2e02d34
commit 7670ffe6ba
5 changed files with 20 additions and 14 deletions

View File

@ -118,7 +118,8 @@ void component_messagebox_draw (char *fmt, ...) {
.height = VISIBLE_AREA_HEIGHT,
.align = ALIGN_CENTER,
.valign = VALIGN_CENTER,
.wrap = WRAP_WORD
.wrap = WRAP_WORD,
.line_spacing = TEXT_LINE_SPACING_ADJUST,
}, FNT_DEFAULT, formatted, &paragraph_nbytes);
if (formatted != buffer) {
@ -151,10 +152,11 @@ void component_main_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *f
.align = align,
.valign = valign,
.wrap = WRAP_ELLIPSES,
.line_spacing = TEXT_LINE_SPACING_ADJUST,
},
FNT_DEFAULT,
VISIBLE_AREA_X0 + TEXT_MARGIN_HORIZONTAL,
VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL,
VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + TEXT_OFFSET_VERTICAL,
formatted,
nbytes
);
@ -180,10 +182,11 @@ void component_actions_bar_text_draw (rdpq_align_t align, rdpq_valign_t valign,
.align = align,
.valign = valign,
.wrap = WRAP_ELLIPSES,
.line_spacing = TEXT_LINE_SPACING_ADJUST,
},
FNT_DEFAULT,
VISIBLE_AREA_X0 + TEXT_MARGIN_HORIZONTAL,
LAYOUT_ACTIONS_SEPARATOR_Y + BORDER_THICKNESS + TEXT_MARGIN_VERTICAL,
LAYOUT_ACTIONS_SEPARATOR_Y + BORDER_THICKNESS + TEXT_MARGIN_VERTICAL + TEXT_OFFSET_VERTICAL,
formatted,
nbytes
);

View File

@ -65,7 +65,9 @@
#define MESSAGEBOX_MARGIN (32)
#define TEXT_MARGIN_HORIZONTAL (10)
#define TEXT_MARGIN_VERTICAL (7)
#define TEXT_MARGIN_VERTICAL (6)
#define TEXT_OFFSET_VERTICAL (1)
#define TEXT_LINE_SPACING_ADJUST (0)
/** @brief The boxart picture width. */
#define BOXART_WIDTH (158)
@ -86,7 +88,7 @@
#define LIST_SCROLLBAR_Y (VISIBLE_AREA_Y0)
/** @brief The maximum amount of file list entries. */
#define LIST_ENTRIES (20)
#define LIST_ENTRIES (19)
/** @brief The maximum width available for a file list entry. */
#define FILE_LIST_MAX_WIDTH (480)
#define FILE_LIST_HIGHLIGHT_WIDTH (VISIBLE_AREA_X1 - VISIBLE_AREA_X0 - LIST_SCROLLBAR_WIDTH)

View File

@ -81,6 +81,7 @@ void component_context_menu_draw (component_context_menu_t *cm) {
.height = VISIBLE_AREA_HEIGHT,
.align = ALIGN_CENTER,
.valign = VALIGN_CENTER,
.line_spacing = TEXT_LINE_SPACING_ADJUST,
},
FNT_DEFAULT,
NULL

View File

@ -71,6 +71,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) {
.width = FILE_LIST_MAX_WIDTH - (TEXT_MARGIN_HORIZONTAL * 2),
.height = LAYOUT_ACTIONS_SEPARATOR_Y - VISIBLE_AREA_Y0 - (TEXT_MARGIN_VERTICAL * 2),
.wrap = WRAP_ELLIPSES,
.line_spacing = TEXT_LINE_SPACING_ADJUST,
},
FNT_DEFAULT,
file_list_layout
@ -114,7 +115,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) {
layout = rdpq_paragraph_builder_end();
int highlight_height = (layout->bbox.y1 - layout->bbox.y0) / layout->nlines;
int highlight_y = VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + ((selected - starting_position) * highlight_height);
int highlight_y = VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + TEXT_OFFSET_VERTICAL + ((selected - starting_position) * highlight_height);
component_box_draw(
FILE_LIST_HIGHLIGHT_X,
@ -127,7 +128,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) {
rdpq_paragraph_render(
layout,
VISIBLE_AREA_X0 + TEXT_MARGIN_HORIZONTAL,
VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL
VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + TEXT_OFFSET_VERTICAL
);
rdpq_paragraph_free(layout);
@ -138,6 +139,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) {
.height = LAYOUT_ACTIONS_SEPARATOR_Y - VISIBLE_AREA_Y0 - (TEXT_MARGIN_VERTICAL * 2),
.align = ALIGN_RIGHT,
.wrap = WRAP_ELLIPSES,
.line_spacing = TEXT_LINE_SPACING_ADJUST,
},
FNT_DEFAULT,
NULL
@ -164,7 +166,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) {
rdpq_paragraph_render(
layout,
VISIBLE_AREA_X0 + TEXT_MARGIN_HORIZONTAL,
VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL
VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + TEXT_OFFSET_VERTICAL
);
rdpq_paragraph_free(layout);

View File

@ -236,8 +236,6 @@ static void draw (menu_t *menu, surface_t *d) {
" Save type: %s\n"
" TV type: %s\n"
" Expansion PAK: %s\n"
"\n"
" Extra information:\n"
" CIC: %s\n"
" Boot address: 0x%08lX\n"
" SDK version: %.1f%c\n"