[Fontconfig-bugs] [Bug 80873] Improve size unparse?

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Jul 7 10:56:53 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=80873

--- Comment #8 from Behdad Esfahbod <freedesktop at behdad.org> ---
(In reply to comment #7)
> (In reply to comment #6)
> > 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.

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/fontconfig-bugs/attachments/20140707/9ce838cf/attachment.html>


More information about the Fontconfig-bugs mailing list