Made width return a floating point.

This commit is contained in:
Adam Harrison 2021-09-24 23:34:19 -04:00
parent c5fda5237f
commit d07d0e6d22
2 changed files with 3 additions and 3 deletions

View File

@ -206,8 +206,8 @@ int ren_font_get_tab_size(RenFont *font) {
return font_get_glyphset(font, '\t')->metrics['\t'].xadvance / font->space_advance;
}
int ren_font_get_width(RenFont *font, const char *text) {
int width = 0;
float ren_font_get_width(RenFont *font, const char *text) {
float width = 0;
const char* end = text + strlen(text);
while (text < end) {
unsigned int codepoint;

View File

@ -16,7 +16,7 @@ RenFont* ren_font_copy(RenFont* font, float size);
void ren_font_free(RenFont *font);
void ren_font_set_tab_size(RenFont *font, int n);
int ren_font_get_tab_size(RenFont *font);
int ren_font_get_width(RenFont *font, const char *text);
float ren_font_get_width(RenFont *font, const char *text);
int ren_font_get_height(RenFont *font);
float ren_font_get_size(RenFont *font);
int ren_draw_text(RenFont *font, const char *text, float x, int y, RenColor color);