fontconfig: Branch 'master'

[email protected] (Akira TAGOH)
Newsgroups gmane.comp.fonts.fontconfig
Message-ID <[email protected]>
 src/fccfg.c |    8 ++++++--
 src/fcxml.c |   22 ++++++++++++++++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)

New commits:
commit 97898b1158542d3bc5f8a95fe2aa1829512cceb8
Author: Akira TAGOH <[email protected]>
Date:   Wed Jan 3 22:15:11 2018 +0900

    Fix the mis-ordering of ruleset evaluation in a file with include element

diff --git a/src/fccfg.c b/src/fccfg.c
index be2e993..9844017 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -1650,6 +1650,10 @@ FcConfigSubstituteWithPat (FcConfig    *config,
     for (; FcPtrListIterIsValid (s, &iter); FcPtrListIterNext (s, &iter))
     {
 	rs = (FcRuleSet *) FcPtrListIterGetValue (s, &iter);
+	if (FcDebug () & FC_DBG_EDIT)
+	{
+	    printf ("\nRule Set: %s\n", rs->name);
+	}
 	FcPtrListIterInit (rs->subst[kind], &iter2);
 	for (; FcPtrListIterIsValid (rs->subst[kind], &iter2); FcPtrListIterNext (rs->subst[kind], &iter2))
 	{
@@ -2553,7 +2557,7 @@ FcRuleSetAddDescription (FcRuleSet	*rs,
 	FcStrFree (rs->description);
 
     rs->domain = domain ? FcStrdup (domain) : NULL;
-    rs->description = FcStrdup (description);
+    rs->description = description ? FcStrdup (description) : NULL;
 }
 
 int
@@ -2594,7 +2598,7 @@ FcRuleSetAdd (FcRuleSet		*rs,
     }
     if (FcDebug () & FC_DBG_EDIT)
     {
-	printf ("Add Rule ");
+	printf ("Add Rule(kind:%d, name: %s) ", kind, rs->name);
 	FcRulePrint (rule);
     }
     ret = FC_OBJ_ID (n) - FC_MAX_BASE_OBJECT;
diff --git a/src/fcxml.c b/src/fcxml.c
index 6128446..22b3211 100644
--- a/src/fcxml.c
+++ b/src/fcxml.c
@@ -2304,6 +2304,8 @@ FcParseInclude (FcConfigParse *parse)
 #endif
     FcChar8	    *prefix = NULL, *p;
     FcChar8	    *userdir = NULL, *userconf = NULL;
+    FcRuleSet	    *ruleset;
+    FcMatchKind	    k;
 
     s = FcStrBufDoneStatic (&parse->pstack->str);
     if (!s)
@@ -2387,6 +2389,24 @@ FcParseInclude (FcConfigParse *parse)
 		goto userconf;
 	}
     }
+    /* flush the ruleset into the queue */
+    ruleset = parse->ruleset;
+    parse->ruleset = FcRuleSetCreate (ruleset->name);
+    FcRuleSetEnable (parse->ruleset, ruleset->enabled);
+    FcRuleSetAddDescription (parse->ruleset, ruleset->domain, ruleset->description);
+    for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
+    {
+	FcPtrListIter iter;
+
+	FcPtrListIterInit (ruleset->subst[k], &iter);
+	if (FcPtrListIterIsValid (ruleset->subst[k], &iter))
+	{
+	    FcPtrListIterInitAtLast (parse->config->subst[k], &iter);
+	    FcRuleSetReference (ruleset);
+	    FcPtrListIterAdd (parse->config->subst[k], &iter, ruleset);
+	}
+    }
+    FcRuleSetDestroy (ruleset);
     if (!FcConfigParseAndLoad (parse->config, s, !ignore_missing))
 	parse->error = FcTrue;
 #ifndef _WIN32
@@ -3351,6 +3371,8 @@ bail1:
 	FcConfigMessage (0, FcSevereError, "Cannot %s config file from %s", load ? "load" : "scan", filename);
 	return FcFalse;
     }
+    if (FcDebug () & FC_DBG_CONFIG)
+	printf ("\t%s config file from %s done\n", load ? "Loading" : "Scanning", filename);
     return FcTrue;
 }
 
_______________________________________________
Fontconfig mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/fontconfig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.