Change default set of fonts to include all of /usr/X11R6/lib/X11/fonts (or
wherever the X fonts are located). Document new <include>directory-name</include> semantics add <include ignore_missing="yes">conf.d</include> Add selectfont to ignore bitmap fonts, add comment for selectfont which accepts bitmap fonts. Allow <include> configuration elements to reference directories. Parse and load all files of the form [0-9]* in sorted order.
This commit is contained in:
parent
38e528e776
commit
2d9c79c049
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
||||||
|
2004-12-04 Keith Packard <keithp@keithp.com>
|
||||||
|
|
||||||
|
* configure.in:
|
||||||
|
Change default set of fonts to include all of
|
||||||
|
/usr/X11R6/lib/X11/fonts (or wherever the X fonts are located).
|
||||||
|
* doc/fontconfig-user.sgml:
|
||||||
|
Document new <include>directory-name</include> semantics
|
||||||
|
* fonts.conf.in:
|
||||||
|
add <include ignore_missing="yes">conf.d</include>
|
||||||
|
* local.conf:
|
||||||
|
Add selectfont to ignore bitmap fonts, add comment for
|
||||||
|
selectfont which accepts bitmap fonts.
|
||||||
|
* src/fcdir.c:
|
||||||
|
* src/fcint.h:
|
||||||
|
* src/fcxml.c: (FcConfigParseAndLoadDir), (FcConfigParseAndLoad):
|
||||||
|
Allow <include> configuration elements to reference directories.
|
||||||
|
Parse and load all files of the form [0-9]* in sorted order.
|
||||||
|
|
||||||
2004-12-04 Keith Packard <keithp@keithp.com>
|
2004-12-04 Keith Packard <keithp@keithp.com>
|
||||||
|
|
||||||
* autogen.sh:
|
* autogen.sh:
|
||||||
|
|
|
@ -281,9 +281,8 @@ yes)
|
||||||
for dir in /usr/X11R6/lib/X11 /usr/X11/lib/X11 /usr/lib/X11; do
|
for dir in /usr/X11R6/lib/X11 /usr/X11/lib/X11 /usr/lib/X11; do
|
||||||
case x"$FC_ADD_FONTS" in
|
case x"$FC_ADD_FONTS" in
|
||||||
x)
|
x)
|
||||||
if test -d "$dir/fonts"; then
|
sub="$dir/fonts"
|
||||||
for sub in "$dir"/fonts/*; do
|
if test -d "$sub"; then
|
||||||
if ls "$sub" | grep -q -i '\.pf\|\.tt\|\.ot'; then
|
|
||||||
case x$FC_ADD_FONTS in
|
case x$FC_ADD_FONTS in
|
||||||
x)
|
x)
|
||||||
FC_ADD_FONTS="$sub"
|
FC_ADD_FONTS="$sub"
|
||||||
|
@ -293,8 +292,6 @@ yes)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
|
@ -264,11 +264,14 @@ is ``~/.fonts.cache-<sgmltag>version</>'', where <sgmltag>version</> is the font
|
||||||
file version number (currently 1).
|
file version number (currently 1).
|
||||||
</para></refsect2>
|
</para></refsect2>
|
||||||
<refsect2><title><sgmltag>include ignore_missing="no"</></title><para>
|
<refsect2><title><sgmltag>include ignore_missing="no"</></title><para>
|
||||||
This element contains the name of an additional configuration file. When
|
This element contains the name of an additional configuration file or
|
||||||
the XML datatype is traversed by FcConfigParse, the contents of the file
|
directory. If a directory, every file within that directory starting with a
|
||||||
will also be incorporated into the configuration by passing the filename to
|
number will be processed in sorted order. When
|
||||||
|
the XML datatype is traversed by FcConfigParse, the contents of the file(s)
|
||||||
|
will also be incorporated into the configuration by passing the filename(s) to
|
||||||
FcConfigLoadAndParse. If 'ignore_missing' is set to "yes" instead of the
|
FcConfigLoadAndParse. If 'ignore_missing' is set to "yes" instead of the
|
||||||
default "no", a missing file will elicit no warning message from the library.
|
default "no", a missing file or directory will elicit no warning message from
|
||||||
|
the library.
|
||||||
</para></refsect2>
|
</para></refsect2>
|
||||||
<refsect2><title><sgmltag>config</></title><para>
|
<refsect2><title><sgmltag>config</></title><para>
|
||||||
This element provides a place to consolodate additional configuration
|
This element provides a place to consolodate additional configuration
|
||||||
|
@ -453,8 +456,8 @@ This is an example of a system-wide configuration file
|
||||||
<!--
|
<!--
|
||||||
Find fonts in these directories
|
Find fonts in these directories
|
||||||
-->
|
-->
|
||||||
<dir>/usr/X11R6/lib/X11/fonts/truetype</dir>
|
<dir>/usr/share/fonts</dir>
|
||||||
<dir>/usr/X11R6/lib/X11/fonts/Type1</dir>
|
<dir>/usr/X11R6/lib/X11/fonts</dir>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Accept deprecated 'mono' alias, replacing it with 'monospace'
|
Accept deprecated 'mono' alias, replacing it with 'monospace'
|
||||||
|
@ -535,7 +538,7 @@ This is an example of a per-user configuration file that lives in
|
||||||
<!--
|
<!--
|
||||||
Private font directory
|
Private font directory
|
||||||
-->
|
-->
|
||||||
<dir>~/misc/fonts</dir>
|
<dir>~/.fonts</dir>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
use rgb sub-pixel ordering to improve glyph appearance on
|
use rgb sub-pixel ordering to improve glyph appearance on
|
||||||
|
|
|
@ -211,6 +211,7 @@
|
||||||
<!--
|
<!--
|
||||||
Load local system customization file
|
Load local system customization file
|
||||||
-->
|
-->
|
||||||
|
<include ignore_missing="yes">conf.d</include>
|
||||||
<include ignore_missing="yes">local.conf</include>
|
<include ignore_missing="yes">local.conf</include>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
23
local.conf
23
local.conf
|
@ -11,4 +11,27 @@
|
||||||
<edit name="rgba" mode="assign"><const>rgb</const></edit>
|
<edit name="rgba" mode="assign"><const>rgb</const></edit>
|
||||||
</match>
|
</match>
|
||||||
-->
|
-->
|
||||||
|
<!--
|
||||||
|
Reject bitmap fonts
|
||||||
|
-->
|
||||||
|
|
||||||
|
<selectfont>
|
||||||
|
<rejectfont>
|
||||||
|
<pattern>
|
||||||
|
<patelt name="scalable"><bool>false</bool></patelt>
|
||||||
|
</pattern>
|
||||||
|
</rejectfont>
|
||||||
|
</selectfont>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Accept bitmap fonts. This overrides any rejectfont which matches
|
||||||
|
|
||||||
|
<selectfont>
|
||||||
|
<acceptfont>
|
||||||
|
<pattern>
|
||||||
|
<patelt name="scalable"><bool>false</bool></patelt>
|
||||||
|
</pattern>
|
||||||
|
</acceptfont>
|
||||||
|
</selectfont>
|
||||||
|
-->
|
||||||
</fontconfig>
|
</fontconfig>
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "fcint.h"
|
#include "fcint.h"
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
static FcBool
|
FcBool
|
||||||
FcFileIsDir (const FcChar8 *file)
|
FcFileIsDir (const FcChar8 *file)
|
||||||
{
|
{
|
||||||
struct stat statb;
|
struct stat statb;
|
||||||
|
@ -166,8 +166,6 @@ FcFileScan (FcFontSet *set,
|
||||||
return FcFileScanConfig (set, dirs, cache, blanks, file, force, 0);
|
return FcFileScanConfig (set, dirs, cache, blanks, file, force, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FC_MAX_FILE_LEN 4096
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan 'dir', adding font files to 'set' and
|
* Scan 'dir', adding font files to 'set' and
|
||||||
* subdirectories to 'dirs'
|
* subdirectories to 'dirs'
|
||||||
|
|
|
@ -69,6 +69,7 @@ typedef struct _FcSymbolic {
|
||||||
#define FC_DBG_SCAN 128
|
#define FC_DBG_SCAN 128
|
||||||
#define FC_DBG_SCANV 256
|
#define FC_DBG_SCANV 256
|
||||||
#define FC_DBG_MEMORY 512
|
#define FC_DBG_MEMORY 512
|
||||||
|
#define FC_DBG_CONFIG 1024
|
||||||
|
|
||||||
#define FC_MEM_CHARSET 0
|
#define FC_MEM_CHARSET 0
|
||||||
#define FC_MEM_CHARLEAF 1
|
#define FC_MEM_CHARLEAF 1
|
||||||
|
@ -229,6 +230,8 @@ typedef struct _FcGlyphName {
|
||||||
FcChar8 name[1]; /* name extends beyond struct */
|
FcChar8 name[1]; /* name extends beyond struct */
|
||||||
} FcGlyphName;
|
} FcGlyphName;
|
||||||
|
|
||||||
|
#define FC_MAX_FILE_LEN 4096
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The per-user ~/.fonts.cache-<version> file is loaded into
|
* The per-user ~/.fonts.cache-<version> file is loaded into
|
||||||
* this data structure. Each directory gets a substructure
|
* this data structure. Each directory gets a substructure
|
||||||
|
@ -519,6 +522,9 @@ FcDebug (void);
|
||||||
|
|
||||||
/* fcdir.c */
|
/* fcdir.c */
|
||||||
|
|
||||||
|
FcBool
|
||||||
|
FcFileIsDir (const FcChar8 *file);
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcFileScanConfig (FcFontSet *set,
|
FcFileScanConfig (FcFontSet *set,
|
||||||
FcStrSet *dirs,
|
FcStrSet *dirs,
|
||||||
|
|
89
src/fcxml.c
89
src/fcxml.c
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "fcint.h"
|
#include "fcint.h"
|
||||||
|
#include <dirent.h>
|
||||||
|
|
||||||
#ifndef HAVE_XMLPARSE_H
|
#ifndef HAVE_XMLPARSE_H
|
||||||
#define HAVE_XMLPARSE_H 0
|
#define HAVE_XMLPARSE_H 0
|
||||||
|
@ -2077,6 +2078,84 @@ FcEndDoctypeDecl (void *userData)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FcBool
|
||||||
|
FcConfigParseAndLoadDir (FcConfig *config,
|
||||||
|
const FcChar8 *name,
|
||||||
|
const FcChar8 *dir,
|
||||||
|
FcBool complain)
|
||||||
|
{
|
||||||
|
DIR *d;
|
||||||
|
struct dirent *e;
|
||||||
|
FcBool ret = FcTrue;
|
||||||
|
FcChar8 *file;
|
||||||
|
FcChar8 *base;
|
||||||
|
FcStrSet *files;
|
||||||
|
|
||||||
|
d = opendir ((char *) dir);
|
||||||
|
if (!d)
|
||||||
|
{
|
||||||
|
if (complain)
|
||||||
|
FcConfigMessage (0, FcSevereError, "Cannot open config dir \"%s\"",
|
||||||
|
name);
|
||||||
|
ret = FcFalse;
|
||||||
|
goto bail0;
|
||||||
|
}
|
||||||
|
/* freed below */
|
||||||
|
file = (FcChar8 *) malloc (strlen ((char *) dir) + 1 + FC_MAX_FILE_LEN + 1);
|
||||||
|
if (!file)
|
||||||
|
{
|
||||||
|
ret = FcFalse;
|
||||||
|
goto bail1;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy ((char *) file, (char *) dir);
|
||||||
|
strcat ((char *) file, "/");
|
||||||
|
base = file + strlen ((char *) file);
|
||||||
|
|
||||||
|
files = FcStrSetCreate ();
|
||||||
|
if (!files)
|
||||||
|
{
|
||||||
|
ret = FcFalse;
|
||||||
|
goto bail2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FcDebug () & FC_DBG_CONFIG)
|
||||||
|
printf ("\tScanning config dir %s\n", dir);
|
||||||
|
|
||||||
|
while (ret && (e = readdir (d)))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Add all files of the form [0-9]*
|
||||||
|
*/
|
||||||
|
if ('0' <= e->d_name[0] && e->d_name[0] <= '9' &&
|
||||||
|
strlen (e->d_name) < FC_MAX_FILE_LEN)
|
||||||
|
{
|
||||||
|
strcpy ((char *) base, (char *) e->d_name);
|
||||||
|
if (!FcStrSetAdd (files, file))
|
||||||
|
{
|
||||||
|
ret = FcFalse;
|
||||||
|
goto bail3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
qsort (files->strs, files->num, sizeof (FcChar8 *),
|
||||||
|
(int (*)(const void *, const void *)) FcStrCmp);
|
||||||
|
for (i = 0; ret && i < files->num; i++)
|
||||||
|
ret = FcConfigParseAndLoad (config, files->strs[i], complain);
|
||||||
|
}
|
||||||
|
bail3:
|
||||||
|
FcStrSetDestroy (files);
|
||||||
|
bail2:
|
||||||
|
free (file);
|
||||||
|
bail1:
|
||||||
|
closedir (d);
|
||||||
|
bail0:
|
||||||
|
return ret || !complain;
|
||||||
|
}
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigParseAndLoad (FcConfig *config,
|
FcConfigParseAndLoad (FcConfig *config,
|
||||||
const FcChar8 *name,
|
const FcChar8 *name,
|
||||||
|
@ -2101,6 +2180,16 @@ FcConfigParseAndLoad (FcConfig *config,
|
||||||
goto bail0;
|
goto bail0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (FcFileIsDir (filename))
|
||||||
|
{
|
||||||
|
FcBool ret = FcConfigParseAndLoadDir (config, name, filename, complain);
|
||||||
|
FcStrFree (filename);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FcDebug () & FC_DBG_CONFIG)
|
||||||
|
printf ("\tLoading config file %s\n", filename);
|
||||||
|
|
||||||
f = fopen ((char *) filename, "r");
|
f = fopen ((char *) filename, "r");
|
||||||
FcStrFree (filename);
|
FcStrFree (filename);
|
||||||
if (!f)
|
if (!f)
|
||||||
|
|
Loading…
Reference in New Issue