-
- 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
- && scoring_index != match->weak)
- continue;
-
- for (f = 0; f < s->nfont; f++)
- {
- int cand_elt;
- FcPatternElt *cand_elts;
-
- if (matchBlocked[f])
- continue;
-
- score = 0.0;
- cand_elts = FcPatternEltU(s->fonts[f]->elts);
-
- /* Look for the appropriate element in this candidate
- * pattern 'f' and evaluate its score wrt 'p'. */
- for (cand_elt = 0; cand_elt < s->fonts[f]->num; cand_elt++)
- {
- if (cand_elts[cand_elt].object ==
- pat_elts[pat_elt].object)
- {
- FcValueListPtr v2;
- FcValueList *v2_ptrU;
- double v2_best_score = 1e99;
-
- for (v2 = cand_elts[cand_elt].values,
- v2_ptrU = FcValueListPtrU(v2);
- FcValueListPtrU(v2);
- v2 = FcValueListPtrU(v2)->next)
- {
- double v = (match->compare)
- (&v1_ptrU->value, &v2_ptrU->value);
-
- if (v < 0)
- {
- *result = FcResultTypeMismatch;
- return 0;
- }
- /* I'm actually kind of surprised that
- * this isn't v + 100 * v1_offset. -PL */
- v = v * 100 + v1_offset;
- if (v < v2_best_score)
- v2_best_score = v;
- }
- score += v2_best_score;
- }
- }
-
- /* If there's a previous champion, and current score
- * beats previous best score, on this element, then
- * knock out the previous champion and anything
- * else that we would have visited previous to f;
- * clearly anything previous to f would have been
- * less than f on this score. */
- if (!best || score < bestscore)
- {
- if (best)
- {
- int b;
- for (b = 0; b < f; ++b)
- matchBlocked[b] = FcTrue;
- }
-
- bestscore = score;
- best = s->fonts[f];
- }
-
- /* If f loses, then it's out too. */
- if (best && score > bestscore)
- matchBlocked[f] = FcTrue;
-
- /* Otherwise, f is equal to best on this element.
- * Carry on to next pattern element. */
+ if (!FcCompare (p, s->fonts[f], score, result))
+ return 0;
+ if (FcDebug () & FC_DBG_MATCHV)
+ {
+ printf ("Score");
+ for (i = 0; i < NUM_MATCH_VALUES; i++)
+ {
+ printf (" %g", score[i]);
+ }
+ printf ("\n");
+ }
+ for (i = 0; i < NUM_MATCH_VALUES; i++)
+ {
+ if (best && bestscore[i] < score[i])
+ break;
+ if (!best || score[i] < bestscore[i])
+ {
+ for (i = 0; i < NUM_MATCH_VALUES; i++)
+ bestscore[i] = score[i];
+ best = s->fonts[f];
+ break;