fontconfig: Branch 'master' - 2 commits

[email protected] (Akira TAGOH)
Newsgroups gmane.comp.fonts.fontconfig
Message-ID <[email protected]>
 fc-cache/fc-cache.c |    2 +-
 src/fccfg.c         |    8 --------
 src/fcinit.c        |   14 +++++++++++---
 src/fcint.h         |    4 ----
 src/fcxml.c         |    7 +++++--
 5 files changed, 17 insertions(+), 18 deletions(-)

New commits:
commit 0394cb7829d16a902e2eebdcc4f00db3774916b8
Author: Akira TAGOH <[email protected]>
Date:   Mon Feb 5 13:31:00 2018 +0900

    Ensure the user config dir is available in the list of config dirs on the fallback config

diff --git a/src/fcinit.c b/src/fcinit.c
index 30646dc..5831a19 100644
--- a/src/fcinit.c
+++ b/src/fcinit.c
@@ -39,15 +39,23 @@ static FcConfig *
 FcInitFallbackConfig (const FcChar8 *sysroot)
 {
     FcConfig	*config;
+    const FcChar8 *fallback = (const FcChar8 *) ""	\
+	"<fontconfig>" \
+	"  <dir>" FC_DEFAULT_FONTS "</dir>" \
+	"  <dir prefix=\"xdg\">fonts</dir>" \
+	"  <cachedir>" FC_CACHEDIR "</cachedir>" \
+	"  <cachedir prefix=\"xdg\">fontconfig</cachedir>" \
+	"  <include ignore_missing=\"yes\" prefix=\"xdg\">fontconfig/conf.d</include>" \
+	"  <include ignore_missing=\"yes\" prefix=\"xdg\">fontconfig/fonts.conf</include>" \
+	"</fontconfig>";
 
     config = FcConfigCreate ();
     if (!config)
 	goto bail0;
     FcConfigSetSysRoot (config, sysroot);
-    if (!FcConfigAddFontDir (config, (FcChar8 *) FC_DEFAULT_FONTS))
-	goto bail1;
-    if (!FcConfigAddCacheDir (config, (FcChar8 *) FC_CACHEDIR))
+    if (!FcConfigParseAndLoadFromMemory (config, fallback, FcFalse))
 	goto bail1;
+
     return config;
 
 bail1:
commit 34b5c949d51fcc8eafe2301ca8f539f735e31522
Author: Akira TAGOH <[email protected]>
Date:   Mon Feb 5 12:47:01 2018 +0900

    Do not mix up font dirs into the list of config dirs

diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c
index 1cea5c7..dc93c19 100644
--- a/fc-cache/fc-cache.c
+++ b/fc-cache/fc-cache.c
@@ -383,7 +383,7 @@ main (int argc, char **argv)
 	FcStrSetDestroy (dirs);
     }
     else
-	list = FcConfigGetConfigDirs (config);
+	list = FcConfigGetFontDirs (config);
 
     if ((processed_dirs = FcStrSetCreate()) == NULL) {
 	fprintf(stderr, _("Out of Memory\n"));
diff --git a/src/fccfg.c b/src/fccfg.c
index 2351ac2..eb0b76d 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -520,14 +520,6 @@ FcConfigAddFontDir (FcConfig	    *config,
     return FcStrSetAddFilename (config->fontDirs, d);
 }
 
-FcBool
-FcConfigAddDir (FcConfig	    *config,
-		const FcChar8	    *d)
-{
-    return (FcConfigAddConfigDir (config, d) &&
-	    FcConfigAddFontDir (config, d));
-}
-
 FcStrList *
 FcConfigGetFontDirs (FcConfig	*config)
 {
diff --git a/src/fcinit.c b/src/fcinit.c
index 8bb0fd4..30646dc 100644
--- a/src/fcinit.c
+++ b/src/fcinit.c
@@ -44,7 +44,7 @@ FcInitFallbackConfig (const FcChar8 *sysroot)
     if (!config)
 	goto bail0;
     FcConfigSetSysRoot (config, sysroot);
-    if (!FcConfigAddDir (config, (FcChar8 *) FC_DEFAULT_FONTS))
+    if (!FcConfigAddFontDir (config, (FcChar8 *) FC_DEFAULT_FONTS))
 	goto bail1;
     if (!FcConfigAddCacheDir (config, (FcChar8 *) FC_CACHEDIR))
 	goto bail1;
diff --git a/src/fcint.h b/src/fcint.h
index 537023f..5de311f 100644
--- a/src/fcint.h
+++ b/src/fcint.h
@@ -659,10 +659,6 @@ FcConfigAddFontDir (FcConfig	    *config,
 		    const FcChar8   *d);
 
 FcPrivate FcBool
-FcConfigAddDir (FcConfig	*config,
-		const FcChar8	*d);
-
-FcPrivate FcBool
 FcConfigAddCacheDir (FcConfig	    *config,
 		     const FcChar8  *d);
 
diff --git a/src/fcxml.c b/src/fcxml.c
index e6cc6b8..7c8aaac 100644
--- a/src/fcxml.c
+++ b/src/fcxml.c
@@ -2156,7 +2156,7 @@ FcParseDir (FcConfigParse *parse)
 	FcConfigMessage (parse, FcSevereWarning, "empty font directory name ignored");
     else if (!parse->scanOnly && (!FcStrUsesHome (data) || FcConfigHome ()))
     {
-	if (!FcConfigAddDir (parse->config, data))
+	if (!FcConfigAddFontDir (parse->config, data))
 	    FcConfigMessage (parse, FcSevereError, "out of memory; cannot add directory %s", data);
     }
     FcStrBufDestroy (&parse->pstack->str);
@@ -3206,7 +3206,10 @@ FcConfigParseAndLoadDir (FcConfig	*config,
 
     if (FcDebug () & FC_DBG_CONFIG)
 	printf ("\tScanning config dir %s\n", dir);
-	
+
+    if (load)
+	FcConfigAddConfigDir (config, dir);
+
     while (ret && (e = readdir (d)))
     {
 	int d_len;
_______________________________________________
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.