1193N/AChanges were originally part of Solaris bug fix for:
1193N/A5099951 Fonts (in particular Lucida Sans Typewriter) look terrible in JDS.
1193N/A
1193N/AAllows fontconfig to use bitmap fonts (which may be hand-tuned for the
1193N/Aspecific size) instead of scalable fonts when a close match is found and
1193N/Aanti-aliasing is not requested.
1193N/A
1193N/Adiff -urp -x '*~' -x '*.orig' src/fcmatch.c src/fcmatch.c
1193N/A--- src/fcmatch.c 2010-05-10 15:00:04.208294425 -0700
1193N/A+++ src/fcmatch.c 2010-05-10 15:00:04.449154429 -0700
1193N/A@@ -168,6 +168,15 @@ FcCompareSize (FcValue *value1, FcValue
1193N/A if (v2 == 0)
1193N/A return 0;
1193N/A v = v2 - v1;
1193N/A+
1193N/A+ /*
1193N/A+ * Hack to allow bitmap fonts to equal requested font if it is close
1193N/A+ */
1193N/A+ if ( v > -.5 && v <= .5 )
1193N/A+ {
1193N/A+ v = 0;
1193N/A+ }
1193N/A+
1193N/A if (v < 0)
1193N/A v = -v;
1193N/A return v;
1193N/A@@ -430,6 +439,47 @@ FcFontRenderPrepare (FcConfig *confi
1193N/A return new;
1193N/A }
1193N/A
1195N/A+static void
1193N/A+FcChangeFormat ( FcPattern *p )
1193N/A+{
1193N/A+ int i;
1193N/A+ FcPatternElt *pe = FcPatternElts(p);
1193N/A+
1193N/A+ /*
1193N/A+ * Hack. If user want monochrome mode, then try to pick bitmaps over
1193N/A+ * outlines.
1193N/A+ */
1193N/A+ 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 (FcConfig *config,
FcFontSet **sets,
@@ -444,6 +494,8 @@ FcFontSetMatchInternal (FcConfig *con
int i;
int set;
+ FcChangeFormat ( p );
+
for (i = 0; i < NUM_MATCH_VALUES; i++)
bestscore[i] = 0;
best = 0;
@@ -672,6 +724,8 @@ FcFontSetSort (FcConfig *config,
FcBool *patternLangSat;
FcValue patternLang;
+ FcChangeFormat ( p );
+
if (FcDebug () & FC_DBG_MATCH)
{
printf ("Sort ");