From 0f15f0ba43dc60d98dc17b77492ccf1089186abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 3 Dec 2019 21:00:48 +0100 Subject: [PATCH] fcft: update to 0.3.0 fcft now calculates the underline and strikeout integer positions, making our rendering code much simpler. --- PKGBUILD | 2 +- meson.build | 2 +- render.c | 14 ++++---------- subprojects/fcft | 2 +- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 31e03210..cd142496 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -5,7 +5,7 @@ arch=('x86_64') url=https://codeberg.org/dnkl/foot license=(mit) makedepends=('meson' 'ninja' 'scdoc' 'python' 'ncurses' 'tllist>=1.0.0') -depends=('libxkbcommon' 'wayland' 'pixman' 'fcft>=0.2.0') +depends=('libxkbcommon' 'wayland' 'pixman' 'fcft>=0.3.0') source=() pkgver() { diff --git a/meson.build b/meson.build index 5c662e9e..8ce8298b 100644 --- a/meson.build +++ b/meson.build @@ -26,7 +26,7 @@ wayland_cursor = dependency('wayland-cursor') xkb = dependency('xkbcommon') tllist = dependency('tllist', version: '>=1.0.0', fallback: ['tllist', 'tllist']) -fcft = dependency('fcft', version: ['>=0.2.0', '<0.3.0'], fallback: ['fcft', 'fcft']) +fcft = dependency('fcft', version: ['>=0.3.0', '<0.4.0'], fallback: ['fcft', 'fcft']) wayland_protocols_datadir = wayland_protocols.get_pkgconfig_variable('pkgdatadir') 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 diff --git a/subprojects/fcft b/subprojects/fcft index e4352f2c..5e131e4f 160000 --- a/subprojects/fcft +++ b/subprojects/fcft @@ -1 +1 @@ -Subproject commit e4352f2c4c6b301b42c15e13ef34f1d734598ce7 +Subproject commit 5e131e4f9be56dc5fba9311c4b75707e6a7c064d