Mostly fix problem of offset with cursor positioning when using mouse

In order to get right the cursor position on text on mouse clicks it is
needed to take into account text's subpixel positioning.

This fix mostly corrects the problem but cursor positioning is still
somewhat inaccurate for long lines due to repeated commands to draw a text
along a line. Repeated draw text calls make the subpixel information
lost and small errors will add-up.
This commit is contained in:
Francesco Abbate
2021-03-06 16:18:24 +01:00
parent 913549a7b6
commit 9ff6a0325e
6 changed files with 61 additions and 19 deletions
-2
View File
@@ -51,8 +51,6 @@ void FR_Blend_Glyph(FR_Renderer *font_renderer,
const FR_Bitmap_Glyph_Metrics *glyph, FR_Color color);
int FR_Subpixel_Scale(FR_Renderer *);
#define FR_XADVANCE_TO_PIXELS(x, scale) (((x) + (scale) / 2) / (scale))
#ifdef __cplusplus
}
#endif