gnu: gd: Fix test failure with FreeType 2.7.
[jackhill/guix/guix.git] / gnu / packages / patches / gd-freetype-test-failure.patch
1 Fix a test failure with freetype 2.7:
2
3 https://github.com/libgd/libgd/commit/a5570d3ed30ff76c2a8bdd54f4ab1825acca0143
4
5 Patch copied from upstream source repository:
6
7 https://github.com/libgd/libgd/commit/a5570d3ed30ff76c2a8bdd54f4ab1825acca0143
8
9 From a5570d3ed30ff76c2a8bdd54f4ab1825acca0143 Mon Sep 17 00:00:00 2001
10 From: "Christoph M. Becker" <cmbecker69@gmx.de>
11 Date: Sun, 29 Jan 2017 17:07:50 +0100
12 Subject: [PATCH] Fix #302: Test suite fails with freetype 2.7
13
14 Actually, the test failures are not necessarily related to freetype
15 2.7, but rather are caused by subpixel hinting which is enabled by
16 default in freetype 2.7. Subpixel hinting is, however, already
17 available in freetype 2.5 and in versions having the "Infinality"
18 patch.
19
20 To get the expected results in all environments, we have to disable
21 subpixel hinting, what is easily done by setting a respective
22 environment variable.
23
24 See also:
25 * https://www.freetype.org/freetype2/docs/subpixel-hinting.html
26 * https://www.freetype.org/freetype2/docs/reference/ft2-tt_driver.html
27 ---
28 tests/freetype/bug00132.c | 3 +++
29 tests/gdimagestringft/gdimagestringft_bbox.c | 3 +++
30 2 files changed, 6 insertions(+)
31
32 diff --git a/tests/freetype/bug00132.c b/tests/freetype/bug00132.c
33 index 713dd2d..42ed5b1 100644
34 --- a/tests/freetype/bug00132.c
35 +++ b/tests/freetype/bug00132.c
36 @@ -11,6 +11,9 @@ int main()
37 char *path;
38 char *ret = NULL;
39
40 + /* disable subpixel hinting */
41 + putenv("FREETYPE_PROPERTIES=truetype:interpreter-version=35");
42 +
43 im = gdImageCreateTrueColor(50, 30);
44
45 if (!im) {
46 diff --git a/tests/gdimagestringft/gdimagestringft_bbox.c b/tests/gdimagestringft/gdimagestringft_bbox.c
47 index 0161ec8..1596a9e 100644
48 --- a/tests/gdimagestringft/gdimagestringft_bbox.c
49 +++ b/tests/gdimagestringft/gdimagestringft_bbox.c
50 @@ -38,6 +38,9 @@ int main()
51 int error = 0;
52 FILE *fp;
53
54 + /* disable subpixel hinting */
55 + putenv("FREETYPE_PROPERTIES=truetype:interpreter-version=35");
56 +
57 path = gdTestFilePath("freetype/DejaVuSans.ttf");
58 im = gdImageCreate(800, 800);
59 gdImageColorAllocate(im, 0xFF, 0xFF, 0xFF); /* allocate white for background color */