Changes were originally part of Solaris bug fix for:
5099951 Fonts (in particular Lucida Sans Typewriter) look terrible in JDS.
Allows fontconfig to use bitmap fonts (which may be hand-tuned for the
specific size) instead of scalable fonts when a close match is found and
anti-aliasing is not requested.
--- a/src/fcmatch.c Thu Jun 18 09:03:11 2015
+++ b/src/fcmatch.c Thu Jun 18 09:15:24 2015
@@ -183,6 +183,15 @@
if (v2 == 0)
return 0;
v = v2 - v1;
+
+ /*
+ * Hack to allow bitmap fonts to equal requested font if it is close
+ */
+ if ( v > -.5 && v <= .5 )
+ {
+ v = 0;
+ }
+
if (v < 0)
v = -v;
return v;
@@ -623,6 +632,46 @@
return new;
}
+static void
+FcChangeFormat ( FcPattern *p )
+{
+ int i;
+ FcPatternElt *pe = FcPatternElts(p);
+
+ /*
+ * Hack. If user want monochrome mode, then try to pick bitmaps over
+ * outlines.
+ */
+ for ( i = 0; i < p->num; i++ )
+ {
+ if ( !strcmp(&pe[i].object, "antialias" ))
+ {
+ int aa = (int) &pe[i].values->value.u.b;
+ int j;
+ int done = 0;
+ FcValue v;
+
+ v.type = FcTypeBool;
+ v.u.b = aa;
+
+ for ( j = 0; j < p->num; j++ )
+ {
+ if ( !strcmp(&pe[j].object, "outline" ))
+ {
+ done = 1;
+ break;
+ }
+ }
+ if ( !done )
+ {
+ FcPatternObjectAddWithBinding (p, "outline", v,
+ FcValueBindingStrong, 1);
+ }
+ break;
+ }
+ }
+}
+
static FcPattern *
FcFontSetMatchInternal (FcFontSet **sets,
int nsets,
@@ -636,6 +685,8 @@
int i;
int set;
+ FcChangeFormat ( p );
+
for (i = 0; i < PRI_END; i++)
bestscore[i] = 0;
best = 0;
@@ -876,6 +927,8 @@
FcBool *patternLangSat;
FcValue patternLang;
+ FcChangeFormat ( p );
+
assert (sets != NULL);
assert (p != NULL);
assert (result != NULL);