mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-31 07:11:09 -04:00
render: draw_styled_underline(): respect main.underline-thickness
Also refactor a bit, and break out early to draw_underline() for legacy underlines.
This commit is contained in:
parent
19bf558e6c
commit
0c7725217a
1 changed files with 19 additions and 4 deletions
23
render.c
23
render.c
|
|
@ -392,7 +392,15 @@ draw_styled_underline(const struct terminal *term, pixman_image_t *pix,
|
||||||
{
|
{
|
||||||
xassert(style != CURLY_NONE);
|
xassert(style != CURLY_NONE);
|
||||||
|
|
||||||
const int thickness = font->underline.thickness;
|
if (style == CURLY_SINGLE) {
|
||||||
|
draw_underline(term, pix, font, color, x, y, cols);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int thickness = term->conf->underline_thickness.px >= 0
|
||||||
|
? term_pt_or_px_as_pixels(
|
||||||
|
term, &term->conf->underline_thickness)
|
||||||
|
: font->underline.thickness;
|
||||||
|
|
||||||
int y_ofs;
|
int y_ofs;
|
||||||
|
|
||||||
|
|
@ -404,10 +412,16 @@ draw_styled_underline(const struct terminal *term, pixman_image_t *pix,
|
||||||
term->cell_height - thickness * 3);
|
term->cell_height - thickness * 3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case CURLY_DASHED:
|
||||||
|
case CURLY_DOTTED:
|
||||||
y_ofs = min(underline_offset(term, font),
|
y_ofs = min(underline_offset(term, font),
|
||||||
term->cell_height - thickness);
|
term->cell_height - thickness);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CURLY_NONE:
|
||||||
|
case CURLY_SINGLE:
|
||||||
|
BUG("underline styles not supposed to be handled here");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int ceil_w = cols * term->cell_width;
|
const int ceil_w = cols * term->cell_width;
|
||||||
|
|
@ -518,8 +532,9 @@ draw_styled_underline(const struct terminal *term, pixman_image_t *pix,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
case CURLY_NONE:
|
||||||
draw_underline(term, pix, font, color, x, y, cols);
|
case CURLY_SINGLE:
|
||||||
|
BUG("underline styles not supposed to be handled here");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue