jenkins-core-weekly: update to 2.491
[oi-userland.git] / components / library / fontconfig / patches / 04.bitmap-hacks.patch
blob7c52d3e040142cc210bfe2bf4239a7fcc64608e6
1 --- fontconfig-2.13.0/src/fcmatch.c.orig 2018-03-08 16:45:52.377939235 +0000
2 +++ fontconfig-2.13.0/src/fcmatch.c 2018-03-08 16:47:13.473464653 +0000
3 @@ -50,6 +50,15 @@
4 return -1.0;
6 v = v2 - v1;
8 + /*
9 + * Hack to allow bitmap fonts to equal requested font if it is close
10 + */
11 + if ( v > -.5 && v <= .5 )
12 + {
13 + v = 0;
14 + }
16 if (v < 0)
17 v = -v;
18 *bestValue = FcValueCanonicalize (value2);
19 @@ -754,6 +763,46 @@
20 return new;
23 +static void
24 +FcChangeFormat ( FcPattern *p )
26 + int i;
27 + FcPatternElt *pe = FcPatternElts(p);
29 + /*
30 + * Hack. If user want monochrome mode, then try to pick bitmaps over
31 + * outlines.
32 + */
33 + for ( i = 0; i < p->num; i++ )
34 + {
35 + if ( !strcmp(&pe[i].object, "antialias" ))
36 + {
37 + int aa = (int) &pe[i].values->value.u.b;
38 + int j;
39 + int done = 0;
40 + FcValue v;
42 + v.type = FcTypeBool;
43 + v.u.b = aa;
45 + for ( j = 0; j < p->num; j++ )
46 + {
47 + if ( !strcmp(&pe[j].object, "outline" ))
48 + {
49 + done = 1;
50 + break;
51 + }
52 + }
53 + if ( !done )
54 + {
55 + FcPatternObjectAddWithBinding (p, "outline", v,
56 + FcValueBindingStrong, 1);
57 + }
58 + break;
59 + }
60 + }
63 static FcPattern *
64 FcFontSetMatchInternal (FcFontSet **sets,
65 int nsets,
66 @@ -767,6 +816,8 @@
67 int i;
68 int set;
70 + FcChangeFormat ( p );
72 for (i = 0; i < PRI_END; i++)
73 bestscore[i] = 0;
74 best = 0;
75 @@ -1048,6 +1099,8 @@
76 FcBool *patternLangSat;
77 FcValue patternLang;
79 + FcChangeFormat ( p );
81 assert (sets != NULL);
82 assert (p != NULL);
83 assert (result != NULL);