From 546fd54a62931fcf1b9b30406398ba95a46a49b5 Mon Sep 17 00:00:00 2001 From: Alec Murphy Date: Sat, 19 Apr 2025 10:42:26 -0400 Subject: [PATCH] System/Libraries/Graphics2D: Update @get_truetype_text_width() to include advance --- System/Libraries/Graphics2D.HC | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/System/Libraries/Graphics2D.HC b/System/Libraries/Graphics2D.HC index 275f0f8..a61585d 100644 --- a/System/Libraries/Graphics2D.HC +++ b/System/Libraries/Graphics2D.HC @@ -1180,7 +1180,7 @@ I64 Y2Pos(CDC* src) return -1; } -I64 @get_truetype_text_width(U8* font_name, I64 size, U8* text) +I64 @get_truetype_text_width(U8* font_name, I64 size, I32* text, I32* advance = NULL) { stbtt_fontinfo* font = Fonts->@(font_name); if (!font) { @@ -1189,7 +1189,7 @@ I64 @get_truetype_text_width(U8* font_name, I64 size, U8* text) I64 res = 0; CDC* dc = DCNew(Display.Width(), (size * 2)); Free(dc->body); - dc->body = @stbtt_RenderText(font, dc->width_internal, dc->height, ToI64(size * 1.2), text); + dc->body = @stbtt_RenderText(font, dc->width_internal, dc->height, ToI64(size * 1.2), text, advance); dc->width -= 16; res = X2Pos(dc) - X1Pos(dc); DCDel(dc);