Stephan Kulow <coolo@suse.de> reviewed by: plam
Don't kill all fonts during match (oops!)
This commit is contained in:
parent
aa472e5f1a
commit
1ed98a0c87
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
|||
2005-11-28 Dirk Mueller <dmueller@suse.com>
|
||||
Stephan Kulow <coolo@suse.de>
|
||||
reviewed by: plam
|
||||
|
||||
* src/fcmatch.c (FcFontSetMatch):
|
||||
|
||||
Don't kill all fonts during match (oops!)
|
||||
|
||||
|
||||
2005-11-25 Dirk Mueller <dmueller@suse.com>
|
||||
Stephan Kulow <coolo@suse.de>
|
||||
Michael Matz <matz@suse.de>
|
||||
reviewed by: plam
|
||||
|
||||
* src/fcmatch.c (FcObjectPtrToMatcher, FcCompareValueList,
|
||||
FcFontSetMatch):
|
||||
|
||||
Rewrite FcFontSetMatch to a path-finding based algorithm, i.e.
|
||||
inline FcCompare into FcFontSetMatch and reorder the
|
||||
loops, adding a boolean array which blocks patterns from future
|
||||
consideration if they're known to not be best on some past
|
||||
criterion.
|
||||
|
||||
2005-11-26 Dirk Mueller <dmueller@suse.com>
|
||||
reviewed by: plam
|
||||
|
||||
|
|
|
@ -534,11 +534,15 @@ FcFontSetMatch (FcConfig *config,
|
|||
}
|
||||
for (set = 0; set < nsets; set++)
|
||||
{
|
||||
FcBool *matchBlocked;
|
||||
int blockStart;
|
||||
|
||||
s = sets[set];
|
||||
if (!s)
|
||||
continue;
|
||||
|
||||
char* matchBlocked = (char*)calloc(s->nfont, sizeof(FcBool));
|
||||
matchBlocked = (FcBool*)calloc(s->nfont, sizeof(FcBool));
|
||||
blockStart = 0;
|
||||
|
||||
/* The old algorithm checked if each font beat 'best',
|
||||
* scanning all of the value lists for all of the pattern elts. */
|
||||
|
@ -575,19 +579,29 @@ FcFontSetMatch (FcConfig *config,
|
|||
if (!match)
|
||||
continue;
|
||||
|
||||
bestscore = 1e99;
|
||||
|
||||
|
||||
for (v1 = pat_elts[pat_elt].values, v1_ptrU = FcValueListPtrU(v1);
|
||||
v1_ptrU;
|
||||
v1 = FcValueListPtrU(v1)->next,
|
||||
v1_ptrU = FcValueListPtrU(v1), v1_offset++)
|
||||
{
|
||||
|
||||
if (v1_ptrU->binding == FcValueBindingWeak
|
||||
if ((v1_ptrU->binding == FcValueBindingWeak
|
||||
&& scoring_index != match->weak)
|
||||
|| (v1_ptrU->binding == FcValueBindingStrong
|
||||
&& scoring_index != match->strong)
|
||||
)
|
||||
continue;
|
||||
|
||||
bestscore = 1e99;
|
||||
|
||||
if (FcDebug () & FC_DBG_MATCHV)
|
||||
{
|
||||
int blocked_fonts = 0;
|
||||
for (f = 0; f < s->nfont; f++)
|
||||
blocked_fonts += matchBlocked[f] ? 1 : 0;
|
||||
printf("Scoring Index %d, Value %d: %d(%d) fonts left\n",
|
||||
scoring_index, v1_offset, s->nfont - blocked_fonts, s->nfont);
|
||||
}
|
||||
|
||||
for (f = 0; f < s->nfont; f++)
|
||||
{
|
||||
int cand_elt;
|
||||
|
@ -644,12 +658,13 @@ FcFontSetMatch (FcConfig *config,
|
|||
if (best)
|
||||
{
|
||||
int b;
|
||||
for (b = 0; b < f; ++b)
|
||||
for (b = blockStart; b < f; ++b)
|
||||
matchBlocked[b] = FcTrue;
|
||||
}
|
||||
|
||||
bestscore = score;
|
||||
best = s->fonts[f];
|
||||
blockStart = f;
|
||||
}
|
||||
|
||||
/* If f loses, then it's out too. */
|
||||
|
@ -659,10 +674,20 @@ FcFontSetMatch (FcConfig *config,
|
|||
/* Otherwise, f is equal to best on this element.
|
||||
* Carry on to next pattern element. */
|
||||
}
|
||||
if ((FcDebug () & FC_DBG_MATCHV) && best)
|
||||
{
|
||||
printf ("Best match (scoring index %d) candidate ", scoring_index);
|
||||
FcPatternPrint (best);
|
||||
}
|
||||
}
|
||||
}
|
||||
free (matchBlocked);
|
||||
}
|
||||
if ((FcDebug () & FC_DBG_MATCH) && best)
|
||||
{
|
||||
printf ("Best match ");
|
||||
FcPatternPrint (best);
|
||||
}
|
||||
if (!best)
|
||||
{
|
||||
*result = FcResultNoMatch;
|
||||
|
|
Loading…
Reference in New Issue