[Fontconfig] result in FcFontSetSort

Jjgod Jiang gzjjgod at gmail.com
Wed Mar 21 07:05:16 PDT 2012

Hi Akira,

How is the result parameter of FcFontSetSort or FcFontSort
supposed to be used? And what's the rationale behind a18ca17b
[1] anyway?

In which you have:

+    /* There are some implementation that relying on the result of
+     * "result" to check if the return value of FcFontSetSort
+     * is valid or not.
+     * So we should initialize it to the conservative way since
+     * this function doesn't return NULL anymore.
+     */
+    if (result)
+	*result = FcResultNoMatch;

So result is initialized to be FcResultNoMatch in the beginning,
but it's never set to FcResultMatch later! The only reference to
result is in the FcCompare() call below that, but that wouldn't
change the value to FcResultMatch in any case. As a result we are
stucked with FcResultNoMatch.

In Qt, we do use that result to tell if the return value of
FcFontSort is valid or not. Using fontconfig 2.9.0 (with this
commit) makes Qt having no font fallback list at all:


- Jiang

[1] http://cgit.freedesktop.org/fontconfig/commit/?id=a18ca17b6211f62fbd1d893811b94b8c83db4cc0

More information about the Fontconfig mailing list