Bug 19375

Summary: RFE: Add an API to get the binding type of values
Product: fontconfig Reporter: Karl Tomlinson <bugs.freedesktop>
Component: libraryAssignee: Akira TAGOH <akira>
Status: RESOLVED FIXED QA Contact: Behdad Esfahbod <freedesktop>
Severity: enhancement    
Priority: medium CC: akira, fontconfig-bugs, freedesktop, mcatanzaro
Version: 2_1   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Karl Tomlinson 2009-01-02 23:40:00 UTC
Add an API to get the binding of values

The bindings of families in a match or sort pattern are important in the
selection of default fonts for each language.

Currently the only way to determine these bindings is to use FcFont(Set)Sort
or FcFont(Set)Match.  Providing an API to get the bindings would help
applications writing their own sort/match functions that may have different
priorities for the properties or have additional information that can be used
to optimize the sort/match.

I guess FcValueGetBinding is not really feasible as FcValue is a public
struct and FcValueGetBinding would seem a bit strange against
FcPatternAdd(,,FcValue,) and FcPatternAddWeak(,,FcValue,).

FcPatternGetBinding(FcPattern *p, const char *object, int id,
                    FcValueBinding *b)
may be an option.

Another option would be
FcPatternGetWithBinding(FcPattern *p, const char *object, int id,
                        FcValue *v, FcValueBinding *b)
which would save the duplicate work of finding the (private) FcValueList
twice.
Comment 1 Behdad Esfahbod 2015-05-06 00:53:25 UTC
Lets go with FcPatternGetWithBinding.
Comment 2 Behdad Esfahbod 2015-05-06 01:59:03 UTC
This API will also be useful to allow detecting fallback fonts.  See bug 90330.
Comment 3 Michael Catanzaro 2015-07-17 23:13:31 UTC
We would love to have this for WebKit as well, since we keep getting font rendering complaints that boil down to not hardcoding font aliases like Chrome does.
Comment 4 Behdad Esfahbod 2015-07-27 10:55:38 UTC
Akira, can you work on this?
Comment 5 Akira TAGOH 2015-07-27 10:57:56 UTC
Sure. let me try to find a time to work on this.
Comment 6 Akira TAGOH 2015-07-28 03:51:52 UTC
Proposed changes for this:
  http://cgit.freedesktop.org/~tagoh/fontconfig/commit/?h=bz19375
Comment 7 Behdad Esfahbod 2016-09-27 12:10:50 UTC
LGTM.  Let's get this in.  Thanks.
Comment 8 Michael Catanzaro 2016-11-05 00:31:33 UTC
Akira, are you planning to commit this?
Comment 9 Akira TAGOH 2016-11-08 06:39:14 UTC
(In reply to Michael Catanzaro from comment #8)
> Akira, are you planning to commit this?

Yes. but not soonish so far. I'm planning to make 2.12.2 shortly so maybe after that.
Comment 10 Michael Catanzaro 2017-07-04 17:04:06 UTC
(In reply to Michael Catanzaro from comment #8)
> Akira, are you planning to commit this?
Comment 11 Akira TAGOH 2017-07-05 09:05:44 UTC
Thanks for ping. will work on it shortly.
Comment 12 Akira TAGOH 2017-07-07 06:48:36 UTC
merged into the main repo.
Comment 13 Michael Catanzaro 2017-07-12 15:54:45 UTC
Yay! Thanks!

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.