Skip to content

Commit

Permalink
Update nbgl_layoutAddTouchableBar for subtext rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
cedelavergne-ledger committed Feb 26, 2024
1 parent 55680e3 commit e848486
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions lib_nbgl/src/nbgl_layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -1035,14 +1035,35 @@ int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *ba

textArea->textColor = BLACK;
textArea->text = PIC(barLayout->subText);
textArea->textAlignment = MID_LEFT;
textArea->fontId = SMALL_REGULAR_FONT;
textArea->style = NO_STYLE;
textArea->wrapping = true;
textArea->obj.alignment = BOTTOM_LEFT;
textArea->obj.alignmentMarginY = BORDER_MARGIN;
textArea->obj.area.width = container->obj.area.width;
textArea->obj.area.height = nbgl_getTextHeightInWidth(
if (barLayout->text != NULL) {
textArea->obj.alignmentMarginY += 12;
}
textArea->obj.area.width = container->obj.area.width;
if ((barLayout->iconLeft != NULL) && (barLayout->centered != true)) {
textArea->obj.alignmentMarginX = 12;
}
if (barLayout->iconLeft != NULL) {
textArea->obj.area.width -= imageLeft->buffer->width + 12;
textArea->obj.alignTo = (nbgl_obj_t *) imageLeft;
textArea->obj.alignment = MID_RIGHT;
}
else {
textArea->obj.alignment = BOTTOM_LEFT;
}
if (barLayout->iconRight != NULL) {
textArea->obj.area.width -= ((nbgl_icon_details_t *) PIC(barLayout->iconRight))->width;
}
if (barLayout->centered != true) {
textArea->textAlignment = MID_LEFT;
}
else {
textArea->textAlignment = CENTER;
}
textArea->obj.area.height = nbgl_getTextHeightInWidth(
textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
container->children[container->nbChildren] = (nbgl_obj_t *) textArea;
container->nbChildren++;
Expand Down

0 comments on commit e848486

Please sign in to comment.