config: add underline-offset option

This option allows the user to configure a custom underline
offset. That is, use the user provided offset instead of the font
provided one.

Closes #490
This commit is contained in:
Daniel Eklöf 2021-06-17 17:52:38 +02:00
parent 11829931a7
commit cf81fff062
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
6 changed files with 42 additions and 9 deletions

View file

@ -319,7 +319,11 @@ draw_underline_with_thickness(
const pixman_color_t *color, int x, int y, int cols, int thickness)
{
/* Make sure the line isn't positioned below the cell */
int y_ofs = font_baseline(term) - font->underline.position;
int y_ofs = font_baseline(term) -
(term->conf->use_custom_underline_offset
? -term_pt_or_px_as_pixels(term, &term->conf->underline_offset)
: font->underline.position);
y_ofs = min(y_ofs, term->cell_height - thickness);
pixman_image_fill_rectangles(