Expand ~ in glob
Allow ~ home directory expansion in acceptfont and rejectfont globs. Fixes: #347
This commit is contained in:
parent
f7091cd17b
commit
da1e3f35e6
|
@ -396,7 +396,8 @@ pattern elements which are used to match fonts.
|
||||||
</para></refsect2>
|
</para></refsect2>
|
||||||
<refsect2><title><literal><glob></literal></title><para>
|
<refsect2><title><literal><glob></literal></title><para>
|
||||||
Glob elements hold shell-style filename matching patterns (including ? and
|
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
|
exclude a set of directories (/usr/share/fonts/uglyfont*), or particular
|
||||||
font file types (*.pcf.gz), but the latter mechanism relies rather heavily
|
font file types (*.pcf.gz), but the latter mechanism relies rather heavily
|
||||||
on filenaming conventions which can't be relied upon. Note that globs
|
on filenaming conventions which can't be relied upon. Note that globs
|
||||||
|
|
|
@ -2923,8 +2923,13 @@ FcConfigGlobAdd (FcConfig *config,
|
||||||
FcBool accept)
|
FcBool accept)
|
||||||
{
|
{
|
||||||
FcStrSet *set = accept ? config->acceptGlobs : config->rejectGlobs;
|
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
|
static FcBool
|
||||||
|
|
|
@ -2960,7 +2960,10 @@ FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element)
|
||||||
vstack->u.string,
|
vstack->u.string,
|
||||||
element == FcElementAcceptfont))
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue