From f50cf8f99cf4451984a1f67ef3ea1135cc1eda9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Schmied?= <[EMAIL REDACTED]>
Date: Wed, 31 Dec 2025 06:36:56 +0100
Subject: [PATCH] Fixed TTF_SetTextString not taking text position into account
when clipping text
(cherry picked from commit 055f4bbcc9882320c9ec9ef5329875ed6a8b98bd)
---
src/SDL_ttf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c
index 85814e68..7d0852f4 100644
--- a/src/SDL_ttf.c
+++ b/src/SDL_ttf.c
@@ -1463,8 +1463,8 @@ static bool Render_Line_TextEngine(TTF_Font *font, TTF_Direction direction, int
if (!glyph_font->render_sdf) {
// Make sure glyph is inside text area
- above_w = x + glyph_width - width;
- above_h = y + glyph_rows - height;
+ above_w = x + glyph_width - (xstart + width);
+ above_h = y + glyph_rows - (ystart + height);
if (x < 0) {
int tmp = -x;