mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-27 06:19:42 +03:00
Round to nearest point between chars in nsfont_position_in_string, instead of rounding down.
This commit is contained in:
parent
941a48dabd
commit
2e4bb2d020
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user