[Fontconfig] fontconfig: Branch 'main'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 25 05:35:03 UTC 2023


 doc/fontconfig-user.sgml |    3 ++-
 src/fccfg.c              |    7 ++++++-
 src/fcxml.c              |    5 ++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit da1e3f35e61597fbf58c9c550ceba6d44abb1563
Author: Ondrej Balaz <blami at blami.net>
Date:   Wed Jan 25 05:00:57 2023 +0900

    Expand ~ in glob
    
    Allow ~ home directory expansion in acceptfont and rejectfont globs.
    
    Fixes: #347

diff --git a/doc/fontconfig-user.sgml b/doc/fontconfig-user.sgml
index 16e98aa..0f18fce 100644
--- a/doc/fontconfig-user.sgml
+++ b/doc/fontconfig-user.sgml
@@ -396,7 +396,8 @@ pattern elements which are used to match fonts.
   </para></refsect2>
   <refsect2><title><literal><glob></literal></title><para>
 Glob elements hold shell-style filename matching patterns (including ? and
-*) which match fonts based on their complete pathnames.  This can be used to
+*) which match fonts based on their complete pathnames. If it starts with '~',
+it refers to a directory in the users home directory.  This can be used to
 exclude a set of directories (/usr/share/fonts/uglyfont*), or particular
 font file types (*.pcf.gz), but the latter mechanism relies rather heavily
 on filenaming conventions which can't be relied upon.  Note that globs
diff --git a/src/fccfg.c b/src/fccfg.c
index 29124f5..f62e228 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -2923,8 +2923,13 @@ FcConfigGlobAdd (FcConfig	*config,
 		 FcBool		accept)
 {
     FcStrSet	*set = accept ? config->acceptGlobs : config->rejectGlobs;
+	FcChar8	*realglob = FcStrCopyFilename(glob);
+	if (!realglob)
+		return FcFalse;
 
-    return FcStrSetAdd (set, glob);
+    FcBool	 ret = FcStrSetAdd (set, realglob);
+    FcStrFree(realglob);
+    return ret;
 }
 
 static FcBool
diff --git a/src/fcxml.c b/src/fcxml.c
index 74c892d..c700f64 100644
--- a/src/fcxml.c
+++ b/src/fcxml.c
@@ -2960,7 +2960,10 @@ FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element)
 						      vstack->u.string,
 						      element == FcElementAcceptfont))
 	    {
-		FcConfigMessage (parse, FcSevereError, "out of memory");
+			if (FcStrUsesHome(vstack->u.string) && FcConfigHome() == NULL)
+				FcConfigMessage (parse, FcSevereWarning, "Home is disabled");
+			else
+				FcConfigMessage (parse, FcSevereError, "out of memory");
 	    }
 	    else
 	    {


More information about the Fontconfig mailing list