aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-12-03 20:00:48 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-12-03 20:03:52 +0000
commit0f15f0ba43dc60d98dc17b77492ccf1089186abb (patch)
tree97fed1501b8a027c83772702da407b4f3557dabd /render.c
parentsearch: match_to_end_of_word: reset end_col when done with a row (diff)
fcft: update to 0.3.0
fcft now calculates the underline and strikeout integer positions, making our rendering code much simpler.
Diffstat (limited to 'render.c')
-rw-r--r--render.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/render.c b/render.c
index 5f11983a..b8d8381c 100644
--- a/render.c
+++ b/render.c
@@ -105,14 +105,11 @@ draw_underline(const struct terminal *term, pixman_image_t *pix,
const struct font *font,
const pixman_color_t *color, int x, int y, int cols)
{
- int baseline = y + font_baseline(term);
- double width = font->underline.thickness;
- int y_under = floor(baseline - font->underline.position + width / 2.);
-
pixman_image_fill_rectangles(
PIXMAN_OP_SRC, pix, color,
1, &(pixman_rectangle16_t){
- x, y_under, cols * term->cell_width, round(max(1., width))});
+ x, y + font_baseline(term) - font->underline.position,
+ cols * term->cell_width, font->underline.thickness});
}
static void
@@ -120,14 +117,11 @@ draw_strikeout(const struct terminal *term, pixman_image_t *pix,
const struct font *font,
const pixman_color_t *color, int x, int y, int cols)
{
- int baseline = y + font_baseline(term);
- double width = font->strikeout.thickness;
- int y_strike = floor(baseline - font->strikeout.position + width / 2.);
-
pixman_image_fill_rectangles(
PIXMAN_OP_SRC, pix, color,
1, &(pixman_rectangle16_t){
- x, y_strike, cols * term->cell_width, round(max(1., width))});
+ x, y + font_baseline(term) - font->strikeout.position,
+ cols * term->cell_width, font->strikeout.thickness});
}
static bool