From 5206d30000081bdaed89ca24e8e73d985ab22e5d Mon Sep 17 00:00:00 2001
From: Andrew Murray <radarhere@users.noreply.github.com>
Date: Wed, 11 Mar 2026 23:02:37 +1100
Subject: [PATCH] Use long for glyph position

---
 src/_imagingft.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: Pillow-7.2.0/src/_imagingft.c
===================================================================
--- Pillow-7.2.0.orig/src/_imagingft.c
+++ Pillow-7.2.0/src/_imagingft.c
@@ -609,7 +609,8 @@ text_layout(PyObject* string, FontObject
 static PyObject*
 font_getsize(FontObject* self, PyObject* args)
 {
-    int x_position, x_max, x_min, y_max, y_min;
+    long x_position;
+    int x_max, x_min, y_max, y_min;
     FT_Face face;
     int xoffset, yoffset;
     int horizontal_dir;
@@ -639,7 +640,8 @@ font_getsize(FontObject* self, PyObject*
 
     horizontal_dir = dir && strcmp(dir, "ttb") == 0 ? 0 : 1;
     for (i = 0; i < count; i++) {
-        int index, error, offset, x_advanced;
+        long x_advanced;
+        int index, error, offset;
         FT_BBox bbox;
         FT_Glyph glyph;
         face = self->face;
