Bug 28491

Summary: Allow matching on FC_FILE
Product: fontconfig Reporter: Behdad Esfahbod <freedesktop>
Component: libraryAssignee: Akira TAGOH <akira>
Status: RESOLVED FIXED QA Contact: Behdad Esfahbod <freedesktop>
Severity: enhancement    
Priority: medium CC: akira, fontconfig-bugs, freedesktop, mpsuzuki
Version: 2.7   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Behdad Esfahbod 2010-06-10 10:31:05 UTC
Sometimes that's all you want...
Comment 1 Akira TAGOH 2012-04-08 20:52:50 UTC
the proposed fix:
http://cgit.freedesktop.org/~tagoh/fontconfig/commit/?h=bz28491

would be nice to match in regexp maybe.
Comment 2 Akira TAGOH 2012-04-08 23:43:11 UTC
done for regexp
Comment 3 Akira TAGOH 2012-04-09 03:02:40 UTC
this may be redundancy but may be good to check the filename strictly and give different score for them?

The idea looks like:
static double
FcCompareFilename (FcValue *v1, FcValue *v2)
{
	const FcChar8 *s1 = FcValueString (v1), *s2 = FcValueString (v2);
	if (FcStrCmp (s1, s2) == 0)
	    return 0.0;
	else if (FcStrCmpIgnoreCase (s1, s2) == 0)
	    return 1.0;
	else if (FcStrRegexCmp (s2, s1))
	    return 2.0;
	else if (FcStrRegexCmpIgnoreCase (s2, s1))
	    return 3.0;
	else
	    return 4.0;
}
Comment 4 Behdad Esfahbod 2012-04-09 16:58:07 UTC
Humm.  Thinking back, to be honest I'm not quite as sure about the usefulness of this.  But probably not harmful to add.  Would help adding API to Pango to request a specific font.  More interesting perhaps would be if FC_FACE is set, and just return that before anything else.
Comment 5 Akira TAGOH 2012-04-09 19:08:02 UTC
(In reply to comment #4)
> Humm.  Thinking back, to be honest I'm not quite as sure about the usefulness
> of this.  But probably not harmful to add.  Would help adding API to Pango to
> request a specific font.  More interesting perhaps would be if FC_FACE is set,
> and just return that before anything else.

Yes, specifying FC_FILE would be reliable to request a specific font. and though I had a comment on Bug#25670, this would ensure the consistent result of FcFontMatch() too because the filename is unique.
Comment 6 Akira TAGOH 2012-04-11 00:57:57 UTC
fixed in 9231d79a

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.