Skip to content

Commit

Permalink
Changes related to the code review
Browse files Browse the repository at this point in the history
  • Loading branch information
dmorais-ledger committed May 31, 2024
1 parent e756322 commit a92d414
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
5 changes: 4 additions & 1 deletion lib_nbgl/src/nbgl_fonts.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ const unsigned int C_unicode_characters_count
uint16_t last_nb_lines = 0;
uint16_t last_nb_pages = 0;
bool last_bold_state = false;
bool hard_caesura = false;

// Used to detect when a hyphenation (caesura) has been forced.
bool hard_caesura = false;
#endif // BUILD_SCREENSHOTS

/**********************
Expand Down Expand Up @@ -820,6 +822,7 @@ uint16_t nbgl_getTextNbLinesInWidth(nbgl_font_id_e fontId,
}
else {
#ifdef BUILD_SCREENSHOTS
// An hyphenation (caesura) has been forced.
hard_caesura = true;
#endif // BUILD_SCREENSHOTS
width = char_width;
Expand Down
24 changes: 9 additions & 15 deletions lib_nbgl/src/nbgl_layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ typedef struct {
/**********************
* VARIABLES
**********************/
#ifdef BUILD_SCREENSHOTS
extern bool verbose;
#endif // BUILD_SCREENSHOTS

/**
* @brief array of layouts, if used by modal
Expand Down Expand Up @@ -2330,18 +2327,15 @@ int nbgl_layoutAddHeader(nbgl_layout_t *layout, const nbgl_layoutHeader_t *heade
textArea->textAlignment = CENTER;
textArea->wrapping = true;
// ensure that text fits on 2 lines maximum
#ifdef BUILD_SCREENSHOTS
if (verbose)
#endif // BUILD_SCREENSHOTS
if (nbgl_getTextNbLinesInWidth(textArea->fontId,
textArea->text,
textArea->obj.area.width,
textArea->wrapping)
> 2) {
LOG_WARN(LAYOUT_LOGGER,
"nbgl_layoutAddHeader: text [%s] is too long for header\n",
text);
}
if (nbgl_getTextNbLinesInWidth(textArea->fontId,
textArea->text,
textArea->obj.area.width,
textArea->wrapping)
> 2) {
LOG_WARN(LAYOUT_LOGGER,
"nbgl_layoutAddHeader: text [%s] is too long for header\n",
text);
}
layoutInt->headerContainer->children[layoutInt->headerContainer->nbChildren]
= (nbgl_obj_t *) textArea;
layoutInt->headerContainer->nbChildren++;
Expand Down

0 comments on commit a92d414

Please sign in to comment.