jlabel: default line spacing to new font_t.line_distance property

This commit is contained in:
Lephenixnoir 2024-09-14 07:19:39 +02:00
parent 57a460894f
commit 33e9962209
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495
2 changed files with 4 additions and 4 deletions

View file

@ -67,7 +67,7 @@ typedef struct {
jalign block_valign; jalign block_valign;
/* Text alignment */ /* Text alignment */
jalign text_align; jalign text_align;
/* Pixels of spacing between each line, in addition to font->height */ /* Pixels of spacing between lines, in addition to font->line_distance */
int8_t line_spacing; int8_t line_spacing;
/* Text to display */ /* Text to display */

View file

@ -24,7 +24,7 @@ jlabel *jlabel_create(char const *text, void *parent)
l->block_valign = J_ALIGN_MIDDLE; l->block_valign = J_ALIGN_MIDDLE;
l->text_align = J_ALIGN_LEFT; l->text_align = J_ALIGN_LEFT;
l->line_spacing = 1; l->line_spacing = 0;
l->color = C_BLACK; l->color = C_BLACK;
l->font = NULL; l->font = NULL;
@ -295,7 +295,7 @@ static void jlabel_poly_render(void *l0, int x, int y)
/* Position the block vertically */ /* Position the block vertically */
int lines = l->breaks_vec.size / 2; int lines = l->breaks_vec.size / 2;
int block_height = lines * (f->line_height + l->line_spacing) - int block_height = lines * (f->line_distance + l->line_spacing) -
l->line_spacing; l->line_spacing;
if(l->block_valign == J_ALIGN_MIDDLE) if(l->block_valign == J_ALIGN_MIDDLE)
@ -331,7 +331,7 @@ static void jlabel_poly_render(void *l0, int x, int y)
dtext_opt(x + dx, y, l->color, C_NONE, DTEXT_LEFT, DTEXT_TOP, dtext_opt(x + dx, y, l->color, C_NONE, DTEXT_LEFT, DTEXT_TOP,
str, line_length); str, line_length);
y += f->line_height + l->line_spacing; y += f->line_distance + l->line_spacing;
str = l->text + l->breaks[i]; str = l->text + l->breaks[i];
} }