diff options
Diffstat (limited to 'framebuffer')
-rw-r--r-- | framebuffer/font_internal.c | 3 |
1 files changed, 2 insertions, 1 deletions
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 <inttypes.h> +#include <string.h> #include <assert.h> #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; |