Switched the engine to use SDL2_ttf UTF-8 text capabilities

This commit is contained in:
abdelrahman committed 2023-01-31 23:10:53 +00:00
1 parent 0339db22dd
commit e04effec37
1 file changed
+3 -3
+3 -3
View File
@@ -366,7 +366,7 @@ TextSize get_text_size_from_font_asset(AssetID id, const char *text) {
return output; return output;
} }
TTF_SizeText(font, text, &(output.width), &(output.height)); TTF_SizeUTF8(font, text, &(output.width), &(output.height));
return output; return output;
} }
@@ -382,7 +382,7 @@ void render_text_with_font_asset(AssetID id, const char *text, f32 x, f32 y,
return; return;
} }
SDL_Surface *surface = TTF_RenderText_Solid(font, text, color); SDL_Surface *surface = TTF_RenderUTF8_Solid(font, text, color);
if (!surface) { if (!surface) {
return; return;
} }
@@ -390,7 +390,7 @@ void render_text_with_font_asset(AssetID id, const char *text, f32 x, f32 y,
// Get the width and height, in pixels, of the text rendered using the font // Get the width and height, in pixels, of the text rendered using the font
i32 w = 0; i32 w = 0;
i32 h = 0; i32 h = 0;
TTF_SizeText(font, text, &w, &h); TTF_SizeUTF8(font, text, &w, &h);
RenderRect rect = {x, y, w, h}; RenderRect rect = {x, y, w, h};