Improve text width calculation precision (#1408)
In some extreme cases (~30000 chars) text width precision takes a hit. Using double instead of float fixes that.
This commit is contained in:
+2
-2
@@ -191,9 +191,9 @@ void rencache_draw_rect(RenRect rect, RenColor color) {
|
||||
}
|
||||
}
|
||||
|
||||
float rencache_draw_text(RenWindow *window_renderer, RenFont **fonts, const char *text, size_t len, float x, int y, RenColor color)
|
||||
double rencache_draw_text(RenWindow *window_renderer, RenFont **fonts, const char *text, size_t len, double x, int y, RenColor color)
|
||||
{
|
||||
float width = ren_font_group_get_width(window_renderer, fonts, text, len);
|
||||
double width = ren_font_group_get_width(window_renderer, fonts, text, len);
|
||||
RenRect rect = { x, y, (int)width, ren_font_group_get_height(fonts) };
|
||||
if (rects_overlap(last_clip_rect, rect)) {
|
||||
int sz = len + 1;
|
||||
|
||||
Reference in New Issue
Block a user