SDL_ttf: Fixed surface height and y offset of SDF rendered text

From c77b52f76cfb58469e56504d45db04876fe8a5b8 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 7 Mar 2025 13:21:53 -0800
Subject: [PATCH] Fixed surface height and y offset of SDF rendered text

Fixes https://github.com/libsdl-org/SDL_ttf/issues/521
---
 src/SDL_ttf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c
index 8239223c..4c0ecab9 100644
--- a/src/SDL_ttf.c
+++ b/src/SDL_ttf.c
@@ -3875,9 +3875,6 @@ static bool TTF_Size_Internal(TTF_Font *font, const char *text, size_t length, T
     if (ystart) {
         *ystart = (miny < 0) ? -miny : 0;
         *ystart += font->outline;
-        if (font->render_sdf && include_spread) {
-            *ystart += DEFAULT_SDF_SPREAD;
-        }
     }
 
     // Fill the bounds rectangle
@@ -3890,6 +3887,9 @@ static bool TTF_Size_Internal(TTF_Font *font, const char *text, size_t length, T
     if (h) {
         *h = (maxy - miny);
         *h += 2 * font->outline;
+        if (font->render_sdf && include_spread) {
+            *h += (2 * DEFAULT_SDF_SPREAD);
+        }
     }
     return true;
 }