<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Improve size unparse?"
href="https://bugs.freedesktop.org/show_bug.cgi?id=80873#c8">Comment # 8</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Improve size unparse?"
href="https://bugs.freedesktop.org/show_bug.cgi?id=80873">bug 80873</a>
from <span class="vcard"><a class="email" href="mailto:freedesktop@behdad.org" title="Behdad Esfahbod <freedesktop@behdad.org>"> <span class="fn">Behdad Esfahbod</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=80873#c7">comment #7</a>)
<span class="quote">> (In reply to <a href="show_bug.cgi?id=80873#c6">comment #6</a>)
> > Are you sure?! My understanding is that if either the pattern or font
> > doesn't an element, that counts as a perfect match, ie. score 0:
>
> Yes, I am...:
>
> static FcBool
> FcCompareValueList (FcObject object,
> const FcMatcher *match,
> FcValueListPtr v1orig, /* pattern */
> FcValueListPtr v2orig, /* target */
> FcValue *bestValue,
> double *value,
> int *n,
> FcResult *result)
> {
> ...
> best = 1e99;
> bestStrong = 1e99;
> bestWeak = 1e99;
> j = 1;
> for (v1 = v1orig; v1; v1 = FcValueListNext(v1))
> {
> for (v2 = v2orig, k = 0; v2; v2 = FcValueListNext(v2), k++)
> {
> v = (match->compare) (&v1->value, &v2->value);
> if (v < 0)
> {
> *result = FcResultTypeMismatch;
> return FcFalse;
> }
> v = v * 1000 + j;
> if (v < best)
> {
> if (bestValue)
> *bestValue = FcValueCanonicalize(&v2->value);
> best = v;
> pos = k;
> }
> if (v1->binding == FcValueBindingStrong)
> {
> if (v < bestStrong)
> bestStrong = v;
> }
> else
> {
> if (v < bestWeak)
> bestWeak = v;
> }
> }
> j++;
> }
> ...
> }
>
> The above code assumes the cache (at least and the pattern as optional)
> always contains a certain value for elements which has a matcher. i.e.
> FC_SIZE is expected to match on FcCompareSizeRange() if we don't set any
> value, the default becomes 1e99 then.
> that was a pitfall for me when I broke the cache in development and saw
> weird behavior on match.</span >
Really? How about this: the FcCompareValueList is *only* called from FcCompare
if both patterns have the element in question. Please check. I'm sure a
missing item gets a score of zero and double-checked and triple-checked
yesterday.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>