https://bugs.gentoo.org/938014
https://github.com/scummvm/scummvm/pull/6046

From 391aa847c20bae4827fd8e868267a0cf4fc72df4 Mon Sep 17 00:00:00 2001
From: antoniou79 <a.antoniou79@gmail.com>
Date: Wed, 14 Aug 2024 22:50:32 +0300
Subject: [PATCH] AGS: Support for FreeType 2.13.3 changes to FT_Outline struct

FreeType 2.13.3 changed a few types of the struct members for FT_Outline struct to unsigned

This is the relevant commit from the FreeType source (github):
https://github.com/freetype/freetype/commit/2a7bb4596f566a34fd53932af0ef53b956459d25
--- a/engines/ags/lib/freetype-2.1.3/autohint/ahglyph.cpp
+++ b/engines/ags/lib/freetype-2.1.3/autohint/ahglyph.cpp
@@ -296,7 +296,11 @@ void ah_outline_save(AH_Outline outline, AH_Loader gloader) {
 	AH_Point point = outline->points;
 	AH_Point point_limit = point + outline->num_points;
 	FT_Vector *vec = gloader->current.outline.points;
+#if (FREETYPE_MAJOR * 1000 + FREETYPE_MINOR) * 1000 + FREETYPE_PATCH < 2013003
 	char *tag = gloader->current.outline.tags;
+#else
+	unsigned char *tag = gloader->current.outline.tags;
+#endif
 
 	/* we assume that the glyph loader has already been checked for storage */
 	for (; point < point_limit; point++, vec++, tag++) {
@@ -408,8 +412,11 @@ FT_Error ah_outline_load(AH_Outline outline, FT_Face face) {
 
 		/* compute Bezier flags */
 		{
+#if (FREETYPE_MAJOR * 1000 + FREETYPE_MINOR) * 1000 + FREETYPE_PATCH < 2013003
 			char *tag = source->tags;
-
+#else
+			unsigned char *tag = source->tags;
+#endif
 			for (point = points; point < point_limit; point++, tag++) {
 				switch (FT_CURVE_TAG(*tag)) {
 				case FT_CURVE_TAG_CONIC:
@@ -457,12 +464,17 @@ FT_Error ah_outline_load(AH_Outline outline, FT_Face face) {
 		{
 			AH_Point *contour = outline->contours;
 			AH_Point *contour_limit = contour + outline->num_contours;
+#if (FREETYPE_MAJOR * 1000 + FREETYPE_MINOR) * 1000 + FREETYPE_PATCH < 2013003
 			short *end = source->contours;
 			short idx = 0;
+#else
+			unsigned short *end = source->contours;
+			unsigned short idx = 0;
+#endif
 
 			for (; contour < contour_limit; contour++, end++) {
 				contour[0] = points + idx;
-				idx = (short)(end[0] + 1);
+				idx = end[0] + 1;
 			}
 		}
 

