From 2e4bb2d020a1de1b0c8c8a3d80264243b11b29bc Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 31 Jul 2012 20:41:27 +0100 Subject: Round to nearest point between chars in nsfont_position_in_string, instead of rounding down. --- framebuffer/font_internal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'framebuffer') diff --git a/framebuffer/font_internal.c b/framebuffer/font_internal.c index 6ef13d51a..6535ac4d5 100644 --- a/framebuffer/font_internal.c +++ b/framebuffer/font_internal.c @@ -18,6 +18,7 @@ */ #include +#include #include #include "css/css.h" @@ -112,7 +113,7 @@ static bool nsfont_position_in_string(const plot_font_style_t *fstyle, int x, size_t *char_offset, int *actual_x) { const struct fb_font_desc* fb_font = fb_get_font(fstyle); - *char_offset = x / fb_font->width; + *char_offset = (x + fb_font->width / 2) / fb_font->width; if (*char_offset > length) *char_offset = length; *actual_x = *char_offset * fb_font->width; -- cgit v1.2.3