summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/TLpatches/patch-01-win32
blob: 14336180010c7a822b42bf2337fcf339cbe2b11f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
diff -ur libgd-2.3.2/src/gd_interpolation.c libgd-src/src/gd_interpolation.c
--- libgd-2.3.2/src/gd_interpolation.c	Wed Mar 03 16:15:02 2021
+++ libgd-src/src/gd_interpolation.c	Fri Aug 27 15:08:28 2021
@@ -1989,9 +1989,9 @@
 	int i;
 
 	b = (unsigned char)tcolor;
-	g = (unsigned char)tcolor >> 8;
-	r = (unsigned char)tcolor >> 16;
-	a = (unsigned char)tcolor >> 24;
+	g = (unsigned char)(tcolor >> 8);
+	r = (unsigned char)(tcolor >> 16);
+	a = (unsigned char)(tcolor >> 24);
 
 	b = CLAMP(b, 0, 255);
 	g = CLAMP(g, 0, 255);
diff -ur libgd-2.3.2/src/gdft.c libgd-src/src/gdft.c
--- libgd-2.3.2/src/gdft.c	Wed Mar 03 16:15:02 2021
+++ libgd-src/src/gdft.c	Fri Aug 27 15:12:43 2021
@@ -446,6 +446,11 @@
 		FT_Face face, gdFTStringExtraPtr strex,
 		glyphInfo **glyph_info)
 {
+#ifndef HAVE_LIBRAQM
+	FT_UInt glyph_index = 0, previous = 0;
+	FT_Vector delta;
+	FT_Error err;
+#endif
 	size_t count;
 	glyphInfo *info;
 
@@ -488,9 +493,6 @@
 
 	raqm_destroy (rq);
 #else
-	FT_UInt glyph_index = 0, previous = 0;
-	FT_Vector delta;
-	FT_Error err;
 	info = (glyphInfo*) gdMalloc (sizeof (glyphInfo) * len);
 	if (!info) {
 		return -1;
@@ -1523,6 +1525,8 @@
 		}
 
 		if (render) {
+			FT_Pos pen_x;
+			FT_Pos pen_y;
 			FT_Activate_Size (platform_specific);
 
 			/* load glyph again into the slot (erase previous one)  - this time with scaling */
@@ -1556,8 +1560,8 @@
 			bm = (FT_BitmapGlyph) image;
 			/* position rounded down to nearest pixel at current dpi
 			(the estimate was rounded up to next 1/METRIC_RES, so this should fit) */
-			FT_Pos pen_x = penf.x + info[i].x_offset;
-			FT_Pos pen_y = penf.y - info[i].y_offset;
+			pen_x = penf.x + info[i].x_offset;
+			pen_y = penf.y - info[i].y_offset;
 			gdft_draw_bitmap (tc_cache, im, fg, bm->bitmap,
 					  (int)(x + (pen_x * cos_a + pen_y * sin_a)*hdpi/(METRIC_RES*64) + bm->left),
 					  (int)(y - (pen_x * sin_a - pen_y * cos_a)*vdpi/(METRIC_RES*64) - bm->top));
@@ -1793,6 +1797,16 @@
 	 */
 	*fontpath = NULL;
 	fontsearchpath = getenv ("GDFONTPATH");
+#ifdef _WIN32
+        if (!fontsearchpath) {
+          char *ffptr = getenv ("WINDIR");
+          if (ffptr) {
+            fontsearchpath = malloc (strlen(ffptr) + strlen("\\Fonts") + 1);
+            strcpy(fontsearchpath, ffptr);
+            strcat(fontsearchpath, "\\Fonts");
+          }
+        }
+#endif
 	if (!fontsearchpath)
 		fontsearchpath = DEFAULT_FONTPATH;
 	path = (char *) gdMalloc(sizeof(char) * strlen(fontsearchpath) + 1);