[Fontconfig] fontconfig: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon Dec 9 18:23:05 PST 2013


 src/fcmatch.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit fee834a9c9e1089a9ae29b1d8e8b6a4cc710204b
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Dec 9 21:21:57 2013 -0500

    Bug 72380 - Never drop first font when trimming
    
    Let me show it with an example.
    
    Currently:
    
    $ fc-match symbol
    symbol.ttf: "Symbol" "Regular"
    
    $ fc-match symbol --sort | head -n 1
    Symbol.pfb: "Symbol" "Regular"
    
    $ fc-match symbol --sort --all | head -n 1
    symbol.ttf: "Symbol" "Regular"
    
    I want to make sure the above three commands all return the same font.
    Ie.  I want to make sure FcFontMatch() always returns the first font
    from FcFontSort().  As such, never trim first font.

diff --git a/src/fcmatch.c b/src/fcmatch.c
index 627aa1a..93e013f 100644
--- a/src/fcmatch.c
+++ b/src/fcmatch.c
@@ -743,6 +743,7 @@ FcSortWalk (FcSortNode **n, int nnode, FcFontSet *fs, FcCharSet **csp, FcBool tr
 {
     FcBool ret = FcFalse;
     FcCharSet *cs;
+    int i;
 
     cs = 0;
     if (trim || csp)
@@ -752,7 +753,7 @@ FcSortWalk (FcSortNode **n, int nnode, FcFontSet *fs, FcCharSet **csp, FcBool tr
 	    goto bail;
     }
 
-    while (nnode--)
+    for (i = 0; i < nnode; i++)
     {
 	FcSortNode	*node = *n++;
 	FcBool		adds_chars = FcFalse;
@@ -776,7 +777,7 @@ FcSortWalk (FcSortNode **n, int nnode, FcFontSet *fs, FcCharSet **csp, FcBool tr
 	 * If this font isn't a subset of the previous fonts,
 	 * add it to the list
 	 */
-	if (!trim || adds_chars)
+	if (!i || !trim || adds_chars)
 	{
 	    FcPatternReference (node->pattern);
 	    if (FcDebug () & FC_DBG_MATCHV)


More information about the Fontconfig mailing list