From 33e99622096b892ae8406b160d19908e82f854cb Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Sat, 14 Sep 2024 07:19:39 +0200 Subject: [PATCH] jlabel: default line spacing to new font_t.line_distance property --- include/justui/jlabel.h | 2 +- src/jlabel.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/justui/jlabel.h b/include/justui/jlabel.h index d98a136..d21b4fd 100644 --- a/include/justui/jlabel.h +++ b/include/justui/jlabel.h @@ -67,7 +67,7 @@ typedef struct { jalign block_valign; /* Text alignment */ 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; /* Text to display */ diff --git a/src/jlabel.c b/src/jlabel.c index f8133af..5f3c0a6 100644 --- a/src/jlabel.c +++ b/src/jlabel.c @@ -24,7 +24,7 @@ jlabel *jlabel_create(char const *text, void *parent) l->block_valign = J_ALIGN_MIDDLE; l->text_align = J_ALIGN_LEFT; - l->line_spacing = 1; + l->line_spacing = 0; l->color = C_BLACK; l->font = NULL; @@ -295,7 +295,7 @@ static void jlabel_poly_render(void *l0, int x, int y) /* Position the block vertically */ 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; 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, str, line_length); - y += f->line_height + l->line_spacing; + y += f->line_distance + l->line_spacing; str = l->text + l->breaks[i]; }