Add the ruleset description support

Trying to address what these configuration files really do.
This change allows to see the short description that mention
the purpose of the content in the config file and obtain
them through API.

This change also encourage one who want to make some UI for
the user-specific configuration management. it is the main
purpose of this change for me though.

Aside from that, I've also made programs translatable. so
we see more dependencies on the build time for gettext,
and itstool to generate PO from xml.
This commit is contained in:
Akira TAGOH 2014-03-27 15:10:44 +09:00
parent 0c149259e4
commit 9a0fcb948f
69 changed files with 1916 additions and 449 deletions

View File

@ -22,8 +22,9 @@
# PERFORMANCE OF THIS SOFTWARE.
SUBDIRS=fontconfig fc-case fc-lang src \
fc-cache fc-cat fc-list fc-match fc-pattern fc-query fc-scan \
fc-validate conf.d test
fc-cache fc-cat fc-conflist fc-list fc-match \
fc-pattern fc-query fc-scan fc-validate conf.d \
po po-conf test
if ENABLE_DOCS
SUBDIRS += doc
endif
@ -31,6 +32,7 @@ endif
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = \
config.rpath \
fontconfig.pc.in \
fonts.conf.in \
fonts.dtd \

View File

@ -49,6 +49,8 @@ AUTOCONF=${AUTOCONF-autoconf}
GPERF=${GPERF-gperf}
PYTHON=${PYTHON-python}
LIBTOOLIZE_FLAGS="--copy --force"
GETTEXTIZE=${GETTEXTIZE-gettextize}
GETTEXTIZE_FLAGS="--force"
DIE=0
@ -84,7 +86,13 @@ if $have_libtool ; then : ; else
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
fi
($GETTEXTIZE --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have gettext installed to compile $PROJECT."
echo "Install the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $PROJECT."
@ -133,6 +141,9 @@ if test -z "$AUTOGEN_SUBDIR_MODE" -a -z "$NOCONFIGURE"; then
fi
fi
echo Running $GETTEXTIZE $GETTEXTIZE_FLAGS
$GETTEXTIZE $GETTEXTIZE_FLAGS
echo Running $ACLOCAL $ACLOCAL_FLAGS
$ACLOCAL $ACLOCAL_FLAGS

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Enable autohinter</description>
<!-- Use the Autohinter -->
<match target="pattern">
<!--

View File

@ -1,6 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Set hintfull to hintstyle</description>
<match target="pattern">
<!--
This configuration is available on the major desktop environments.

View File

@ -1,6 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Set hintmedium to hintstyle</description>
<match target="pattern">
<!--
This configuration is available on the major desktop environments.

View File

@ -1,6 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Set hintnone to hintstyle</description>
<match target="pattern">
<!--
This configuration is available on the major desktop environments.

View File

@ -1,6 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Set hintslight to hintstyle</description>
<match target="pattern">
<!--
This configuration is available on the major desktop environments.

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Disable sub-pixel rendering</description>
<!-- Disable sub-pixel rendering -->
<match target="pattern">
<!--

View File

@ -1,7 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Bitmap scaling</description>
<!--
If font is bitmap, calculate scale factor.
Note that color bitmap fonts have scalable=true, while

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Enable sub-pixel rendering with the BGR stripes layout</description>
<!-- Enable sub-pixel rendering -->
<match target="pattern">
<!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Enable sub-pixel rendering with the RGB stripes layout</description>
<!-- Enable sub-pixel rendering -->
<match target="pattern">
<!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Enable sub-pixel rendering with the vertical BGR stripes layout</description>
<!-- Enable sub-pixel rendering -->
<match target="pattern">
<!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Enable sub-pixel rendering with the vertical RGB stripes layout</description>
<!-- Enable sub-pixel rendering -->
<match target="pattern">
<!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Disable hinting</description>
<!-- Disable hinting -->
<match target="pattern">
<!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Use lcddefault as default for LCD filter</description>
<!-- Use lcddefault as default for LCD filter -->
<match target="pattern">
<!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Use lcdlegacy as default for LCD filter</description>
<!-- Use lcdlegacy as default for LCD filter -->
<match target="pattern">
<!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Use lcdlight as default for LCD filter</description>
<!-- Use lcdlight as default for LCD filter -->
<match target="pattern">
<!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Disable hinting for Bitstream Vera fonts when the size is less than 8ppem</description>
<!--
The Bitstream Vera fonts have GASP entries suggesting that hinting be
disabled below 8 ppem, but FreeType ignores those, preferring to use

View File

@ -1,7 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Disable hinting for CJK fonts</description>
<!-- We can't hint CJK fonts well, so turn off hinting for CJK fonts. -->
<match target="font">

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Set substitutions for similar/metric-compatible families</description>
<!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Set substitutions for non-Latin fonts</description>
<!--
Mark common families with their generics so we'll get
something reasonable

View File

@ -1,6 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Set substitutions for emoji/math fonts</description>
<!-- Keep in sync with 60-generic.conf -->
<!-- Emoji -->

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Set substitutions for Latin fonts</description>
<!--
Mark common families with their generics so we'll get
something reasonable

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Add sans-serif to the family when no generic name</description>
<!--
If the font still has no generic name, add sans-serif
-->

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Load per-user customization files</description>
<!--
Load per-user customization files where stored on XDG Base Directory
specification compliant places. it should be usually:

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Load local customization file</description>
<!-- Load local system customization file -->
<include ignore_missing="yes">local.conf</include>
</fontconfig>

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Set preferable fonts for emoji/math fonts</description>
<!-- Keep in sync with 45-generic.conf -->
<!-- Emoji -->

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Set preferable fonts for Latin</description>
<alias>
<family>serif</family>
<prefer>

View File

@ -31,6 +31,10 @@
2008 Behdad Esfahbod: Cleanup. Add fantasy and cursive.
-->
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<!-- Deprecated fonts are discouraged -->

View File

@ -1,6 +1,10 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<alias>
<family>serif</family>
<prefer>

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Set preferable fonts for non-Latin</description>
<alias>
<family>serif</family>
<prefer>

View File

@ -1,6 +1,10 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<alias>
<family>serif</family>
<prefer>

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Reject bitmap fonts</description>
<!-- Reject bitmap fonts -->
<selectfont>
<rejectfont>

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Accept bitmap fonts</description>
<!-- Accept bitmap fonts -->
<selectfont>
<acceptfont>

View File

@ -1,6 +1,10 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<!-- Fix-ups for Delicious family -->
<!-- Delicious 'heavy' variant says its Medium weight -->

View File

@ -1,6 +1,10 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<!--
Artificial oblique for fonts without an italic or oblique version
-->

View File

@ -89,6 +89,20 @@ AC_SUBST(LIBT_CURRENT_MINUS_AGE)
PKGCONFIG_REQUIRES=
PKGCONFIG_REQUIRES_PRIVATELY=
dnl ==========================================================================
dnl gettext stuff
dnl ==========================================================================
GETTEXT_PACKAGE=$PACKAGE
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext package])
AM_GNU_GETTEXT([external])
AC_PATH_PROG(ITSTOOL, [itstool])
if test -z "$ITSTOOL"; then
AC_MSG_ERROR([The itstool were not found. Please install itstool.])
fi
dnl ==========================================================================
case "$host" in
@ -732,6 +746,7 @@ src/Makefile
conf.d/Makefile
fc-cache/Makefile
fc-cat/Makefile
fc-conflist/Makefile
fc-list/Makefile
fc-match/Makefile
fc-pattern/Makefile
@ -740,6 +755,8 @@ fc-scan/Makefile
fc-validate/Makefile
doc/Makefile
doc/version.sgml
po/Makefile.in
po-conf/Makefile.in
test/Makefile
fontconfig.spec
fontconfig.pc

View File

@ -410,3 +410,38 @@ this function calls FcConfigSetCurrent() internally.
@SINCE@ 2.10.92
@@
@RET@ void
@FUNC@ FcConfigFileInfoIterInit
@TYPE1@ FcConfig * @ARG1@ config
@TYPE2@ FcConfigFileInfoIter * @ARG2@ iter
@PURPOSE@ Initialize the iterator
@DESC@
Initialize 'iter' with the first iterator in the config file information list.
@SINCE@ 2.12.91
@@
@RET@ FcBool
@FUNC@ FcConfigFileInfoIterNext
@TYPE1@ FcConfig * @ARG1@ config
@TYPE2@ FcConfigFileInfoIter * @ARG2@ iter
@PURPOSE@ Set the iterator to point to the next list
@DESC@
Set 'iter' to point to the next node in the config file information list.
If there is no next node, FcFalse is returned.
@SINCE@ 2.12.91
@@
@RET@ FcBool
@FUNC@ FcConfigFileInfoIterGet
@TYPE1@ FcConfig * @ARG1@ config
@TYPE2@ FcConfigFileInfoIter * @ARG2@ iter
@TYPE3@ FcChar8 ** @ARG3@ name
@TYPE4@ FcChar8 ** @ARG4@ description
@TYPE5@ FcBool * @ARG5@ enabled
@PURPOSE@ Obtain the configuration file information
@DESC@
Obtain the filename, the description and the flag whether it is enabled or not
for 'iter' where points to current configuration file information.
If the iterator is invalid, FcFalse is returned.
@SINCE@ 2.12.91
@@

View File

@ -49,6 +49,14 @@
#undef STRICT
#endif
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(x) (dgettext(GETTEXT_PACKAGE, x))
#else
#define dgettext(d, s) (s)
#define _(x) (x)
#endif
#ifndef O_BINARY
#define O_BINARY 0
#endif
@ -87,34 +95,34 @@ usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
fprintf (file, "usage: %s [-EfrsvVh] [-y SYSROOT] [--error-on-no-fonts] [--force|--really-force] [--sysroot=SYSROOT] [--system-only] [--verbose] [--version] [--help] [dirs]\n",
fprintf (file, _("usage: %s [-EfrsvVh] [-y SYSROOT] [--error-on-no-fonts] [--force|--really-force] [--sysroot=SYSROOT] [--system-only] [--verbose] [--version] [--help] [dirs]\n"),
program);
#else
fprintf (file, "usage: %s [-EfrsvVh] [-y SYSROOT] [dirs]\n",
fprintf (file, _("usage: %s [-EfrsvVh] [-y SYSROOT] [dirs]\n"),
program);
#endif
fprintf (file, "Build font information caches in [dirs]\n"
"(all directories in font configuration by default).\n");
fprintf (file, _("Build font information caches in [dirs]\n"
"(all directories in font configuration by default).\n"));
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
fprintf (file, " -E, --error-on-no-fonts raise an error if no fonts in a directory\n");
fprintf (file, " -f, --force scan directories with apparently valid caches\n");
fprintf (file, " -r, --really-force erase all existing caches, then rescan\n");
fprintf (file, " -s, --system-only scan system-wide directories only\n");
fprintf (file, " -y, --sysroot=SYSROOT prepend SYSROOT to all paths for scanning\n");
fprintf (file, " -v, --verbose display status information while busy\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
fprintf (file, _(" -E, --error-on-no-fonts raise an error if no fonts in a directory\n"));
fprintf (file, _(" -f, --force scan directories with apparently valid caches\n"));
fprintf (file, _(" -r, --really-force erase all existing caches, then rescan\n"));
fprintf (file, _(" -s, --system-only scan system-wide directories only\n"));
fprintf (file, _(" -y, --sysroot=SYSROOT prepend SYSROOT to all paths for scanning\n"));
fprintf (file, _(" -v, --verbose display status information while busy\n"));
fprintf (file, _(" -V, --version display font config version and exit\n"));
fprintf (file, _(" -h, --help display this help and exit\n"));
#else
fprintf (file, " -E (error-on-no-fonts)\n");
fprintf (file, " raise an error if no fonts in a directory\n");
fprintf (file, " -f (force) scan directories with apparently valid caches\n");
fprintf (file, " -r, (really force) erase all existing caches, then rescan\n");
fprintf (file, " -s (system) scan system-wide directories only\n");
fprintf (file, " -y SYSROOT (sysroot) prepend SYSROOT to all paths for scanning\n");
fprintf (file, " -v (verbose) display status information while busy\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
fprintf (file, " -E (error-on-no-fonts)\n"));
fprintf (file, _(" raise an error if no fonts in a directory\n"));
fprintf (file, _(" -f (force) scan directories with apparently valid caches\n"));
fprintf (file, _(" -r, (really force) erase all existing caches, then rescan\n"));
fprintf (file, _(" -s (system) scan system-wide directories only\n"));
fprintf (file, _(" -y SYSROOT (sysroot) prepend SYSROOT to all paths for scanning\n"));
fprintf (file, _(" -v (verbose) display status information while busy\n"));
fprintf (file, _(" -V (version) display font config version and exit\n"));
fprintf (file, _(" -h (help) display this help and exit\n"));
#endif
exit (error);
}
@ -151,7 +159,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
if (FcStrSetMember (processed_dirs, dir))
{
if (verbose)
printf ("skipping, looped directory detected\n");
printf (_("skipping, looped directory detected\n"));
continue;
}
@ -161,7 +169,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
case ENOENT:
case ENOTDIR:
if (verbose)
printf ("skipping, no such directory\n");
printf (_("skipping, no such directory\n"));
break;
default:
fprintf (stderr, "\"%s\": ", dir);
@ -174,7 +182,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
if (!S_ISDIR (statb.st_mode))
{
fprintf (stderr, "\"%s\": not a directory, skipping\n", dir);
fprintf (stderr, _("\"%s\": not a directory, skipping\n"), dir);
continue;
}
was_processed = FcTrue;
@ -196,7 +204,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
cache = FcDirCacheRead (dir, FcTrue, config);
if (!cache)
{
fprintf (stderr, "%s: error scanning\n", dir);
fprintf (stderr, _("\"%s\": scanning error\n"), dir);
ret++;
continue;
}
@ -205,18 +213,18 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
if (was_valid)
{
if (verbose)
printf ("skipping, existing cache is valid: %d fonts, %d dirs\n",
printf (_("skipping, existing cache is valid: %d fonts, %d dirs\n"),
FcCacheNumFont (cache), FcCacheNumSubdir (cache));
}
else
{
if (verbose)
printf ("caching, new cache contents: %d fonts, %d dirs\n",
printf (_("caching, new cache contents: %d fonts, %d dirs\n"),
FcCacheNumFont (cache), FcCacheNumSubdir (cache));
if (!FcDirCacheValid (dir))
{
fprintf (stderr, "%s: failed to write cache\n", dir);
fprintf (stderr, _("%s: failed to write cache\n"), dir);
(void) FcDirCacheUnlink (dir, config);
ret++;
}
@ -225,7 +233,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
subdirs = FcStrSetCreate ();
if (!subdirs)
{
fprintf (stderr, "%s: Can't create subdir set\n", dir);
fprintf (stderr, _("%s: Can't create subdir set\n"), dir);
ret++;
FcDirCacheUnload (cache);
continue;
@ -239,7 +247,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
FcStrSetDestroy (subdirs);
if (!sublist)
{
fprintf (stderr, "%s: Can't create subdir list\n", dir);
fprintf (stderr, _("%s: Can't create subdir list\n"), dir);
ret++;
continue;
}
@ -345,7 +353,7 @@ main (int argc, char **argv)
}
if (!config)
{
fprintf (stderr, "%s: Can't init font config library\n", argv[0]);
fprintf (stderr, _("%s: Can't initialize font config library\n"), argv[0]);
return 1;
}
FcConfigSetCurrent (config);
@ -355,7 +363,7 @@ main (int argc, char **argv)
dirs = FcStrSetCreate ();
if (!dirs)
{
fprintf (stderr, "%s: Can't create list of directories\n",
fprintf (stderr, _("%s: Can't create list of directories\n"),
argv[0]);
return 1;
}
@ -363,7 +371,7 @@ main (int argc, char **argv)
{
if (!FcStrSetAddFilename (dirs, (FcChar8 *) argv[i]))
{
fprintf (stderr, "%s: Can't add directory\n", argv[0]);
fprintf (stderr, _("%s: Can't add directory\n"), argv[0]);
return 1;
}
i++;
@ -375,7 +383,7 @@ main (int argc, char **argv)
list = FcConfigGetConfigDirs (config);
if ((processed_dirs = FcStrSetCreate()) == NULL) {
fprintf(stderr, "Cannot malloc\n");
fprintf(stderr, _("Out of Memory\n"));
return 1;
}
@ -407,6 +415,6 @@ main (int argc, char **argv)
if (changed)
sleep (2);
if (verbose)
printf ("%s: %s\n", argv[0], ret ? "failed" : "succeeded");
printf ("%s: %s\n", argv[0], ret ? _("failed") : _("succeeded"));
return ret;
}

View File

@ -41,6 +41,14 @@
#include <sys/stat.h>
#include <errno.h>
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(x) (dgettext(GETTEXT_PACKAGE, x))
#else
#define dgettext(d, s) (s)
#define _(x) (x)
#endif
#ifndef HAVE_GETOPT
#define HAVE_GETOPT 0
#endif
@ -148,27 +156,27 @@ usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
fprintf (file, "usage: %s [-rv] [--recurse] [--verbose] [*-%s" FC_CACHE_SUFFIX "|directory]...\n",
fprintf (file, _("usage: %s [-rv] [--recurse] [--verbose] [*-%s" FC_CACHE_SUFFIX "|directory]...\n"),
program, FC_ARCHITECTURE);
fprintf (file, " %s [-Vh] [--version] [--help]\n", program);
#else
fprintf (file, "usage: %s [-rvVh] [*-%s" FC_CACHE_SUFFIX "|directory]...\n",
fprintf (file, _("usage: %s [-rvVh] [*-%s" FC_CACHE_SUFFIX "|directory]...\n"),
program, FC_ARCHITECTURE);
#endif
fprintf (file, "Reads font information cache from:\n");
fprintf (file, " 1) specified fontconfig cache file\n");
fprintf (file, " 2) related to a particular font directory\n");
fprintf (file, _("Reads font information cache from:\n"));
fprintf (file, _(" 1) specified fontconfig cache file\n"));
fprintf (file, _(" 2) related to a particular font directory\n"));
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
fprintf (file, " -r, --recurse recurse into subdirectories\n");
fprintf (file, " -v, --verbose be verbose\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
fprintf (file, _(" -r, --recurse recurse into subdirectories\n"));
fprintf (file, _(" -v, --verbose be verbose\n"));
fprintf (file, _(" -V, --version display font config version and exit\n"));
fprintf (file, _(" -h, --help display this help and exit\n"));
#else
fprintf (file, " -r (recurse) recurse into subdirectories\n");
fprintf (file, " -v (verbose) be verbose\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
fprintf (file, _(" -r (recurse) recurse into subdirectories\n"));
fprintf (file, _(" -v (verbose) be verbose\n"));
fprintf (file, _(" -V (version) display font config version and exit\n"));
fprintf (file, _(" -h (help) display this help and exit\n"));
#endif
exit (error);
}
@ -294,7 +302,7 @@ main (int argc, char **argv)
config = FcInitLoadConfig ();
if (!config)
{
fprintf (stderr, "%s: Can't init font config library\n", argv[0]);
fprintf (stderr, _("%s: Can't initialize font config library\n"), argv[0]);
return 1;
}
FcConfigSetCurrent (config);
@ -303,7 +311,7 @@ main (int argc, char **argv)
args = FcStrSetCreate ();
if (!args)
{
fprintf (stderr, "%s: malloc failure\n", argv[0]);
fprintf (stderr, _("%s: malloc failure\n"), argv[0]);
return 1;
}
if (i < argc)
@ -312,7 +320,7 @@ main (int argc, char **argv)
{
if (!FcStrSetAddFilename (args, (const FcChar8 *) argv[i]))
{
fprintf (stderr, "%s: malloc failure\n", argv[0]);
fprintf (stderr, _("%s: malloc failure\n"), argv[0]);
return 1;
}
}
@ -324,7 +332,7 @@ main (int argc, char **argv)
while ((arg = FcStrListNext (arglist)))
if (!FcStrSetAdd (args, arg))
{
fprintf (stderr, "%s: malloc failure\n", argv[0]);
fprintf (stderr, _("%s: malloc failure\n"), argv[0]);
return 1;
}
FcStrListDone (arglist);
@ -332,7 +340,7 @@ main (int argc, char **argv)
arglist = FcStrListCreate (args);
if (!arglist)
{
fprintf (stderr, "%s: malloc failure\n", argv[0]);
fprintf (stderr, _("%s: malloc failure\n"), argv[0]);
return 1;
}
FcStrSetDestroy (args);
@ -372,7 +380,7 @@ main (int argc, char **argv)
{
if (!first)
printf ("\n");
printf ("Directory: %s\nCache: %s\n--------\n",
printf (_("Directory: %s\nCache: %s\n--------\n"),
FcCacheDir(cache), cache_file ? cache_file : arg);
first = FcFalse;
}

60
fc-conflist/Makefile.am Normal file
View File

@ -0,0 +1,60 @@
#
# fontconfig/fc-conflist/Makefile.am
#
# Copyright © 2003 Keith Packard
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of the author(s) not be used in
# advertising or publicity pertaining to distribution of the software without
# specific, written prior permission. The authors make no
# representations about the suitability of this software for any purpose. It
# is provided "as is" without express or implied warranty.
#
# THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
# EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
bin_PROGRAMS=fc-conflist
DOC2MAN = docbook2man
FC_VALIDATE_SRC=${top_srcdir}/fc-conflist
SGML = ${FC_VALIDATE_SRC}/fc-conflist.sgml
AM_CPPFLAGS=-I${top_srcdir} $(FREETYPE_CFLAGS) $(WARN_CFLAGS)
BUILT_MANS=fc-conflist.1
if ENABLE_DOCS
man_MANS=${BUILT_MANS}
endif
EXTRA_DIST=fc-conflist.sgml $(BUILT_MANS)
CLEANFILES =
fc_conflist_LDADD = ${top_builddir}/src/libfontconfig.la $(FREETYPE_LIBS)
if USEDOCBOOK
${man_MANS}: ${SGML}
$(AM_V_GEN) $(RM) $@; \
$(DOC2MAN) ${SGML}; \
$(RM) manpage.*
all-local: $(man_MANS)
CLEANFILES += $(man_MANS)
else
all-local:
endif
-include $(top_srcdir)/git.mk

142
fc-conflist/fc-conflist.c Normal file
View File

@ -0,0 +1,142 @@
/*
* fontconfig/fc-conflist/fc-conflist.c
*
* Copyright © 2003 Keith Packard
* Copyright © 2014 Red Hat, Inc.
* Red Hat Author(s): Akira TAGOH
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of the author(s) not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. The authors make no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#else
#ifdef linux
#define HAVE_GETOPT_LONG 1
#endif
#define HAVE_GETOPT 1
#endif
#include <fontconfig/fontconfig.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(x) (dgettext(GETTEXT_PACKAGE, x))
#else
#define dgettext(d, s) (s)
#define _(x) (x)
#endif
#ifndef HAVE_GETOPT
#define HAVE_GETOPT 0
#endif
#ifndef HAVE_GETOPT_LONG
#define HAVE_GETOPT_LONG 0
#endif
#if HAVE_GETOPT_LONG
#undef _GNU_SOURCE
#define _GNU_SOURCE
#include <getopt.h>
static const struct option longopts[] = {
{"version", 0, 0, 'V'},
{"help", 0, 0, 'h'},
{NULL,0,0,0},
};
#else
#if HAVE_GETOPT
extern char *optarg;
extern int optind, opterr, optopt;
#endif
#endif
static void
usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
fprintf (file, _("usage: %s [-Vh] [--version] [--help]\n"),
program);
#else
fprintf (file, _("usage: %s [-Vh]\n"),
program);
#endif
fprintf (file, _("Show the ruleset files information on the system\n"));
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
fprintf (file, _(" -V, --version display font config version and exit\n"));
fprintf (file, _(" -h, --help display this help and exit\n"));
#else
fprintf (file, _(" -V (version) display font config version and exit\n"));
fprintf (file, _(" -h (help) display this help and exit\n"));
#endif
exit (error);
}
int
main (int argc, char **argv)
{
FcConfig *config;
FcConfigFileInfoIter iter;
#if HAVE_GETOPT_LONG || HAVE_GETOPT
int c;
#if HAVE_GETOPT_LONG
while ((c = getopt_long (argc, argv, "Vh", longopts, NULL)) != -1)
#else
while ((c = getopt (argc, argv, "Vh")) != -1)
#endif
{
switch (c) {
case 'V':
fprintf (stderr, "fontconfig version %d.%d.%d\n",
FC_MAJOR, FC_MINOR, FC_REVISION);
exit (0);
case 'h':
usage (argv[0], 0);
default:
usage (argv[0], 1);
}
}
#endif
config = FcConfigGetCurrent ();
FcConfigFileInfoIterInit (config, &iter);
do
{
FcChar8 *name, *desc;
FcBool enabled;
if (FcConfigFileInfoIterGet (config, &iter, &name, &desc, &enabled))
{
printf ("%c %s: %s\n", enabled ? '+' : '-', name, desc);
FcStrFree (name);
FcStrFree (desc);
}
} while (FcConfigFileInfoIterNext (config, &iter));
FcFini ();
return 0;
}

View File

@ -0,0 +1,135 @@
<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
<!-- Process this file with docbook-to-man to generate an nroff manual
page: `docbook-to-man manpage.sgml > manpage.1'. You may view
the manual page with: `docbook-to-man manpage.sgml | nroff -man |
less'. A typical entry in a Makefile or Makefile.am is:
manpage.1: manpage.sgml
docbook-to-man $< > $@
The docbook-to-man binary is found in the docbook-to-man package.
Please remember that if you create the nroff version in one of the
debian/rules file targets (such as build), you will need to include
docbook-to-man in your Build-Depends control field.
-->
<!-- Fill in your name for FIRSTNAME and SURNAME. -->
<!ENTITY dhfirstname "<firstname>Akira</firstname>">
<!ENTITY dhsurname "<surname>TAGOH</surname>">
<!-- Please adjust the date whenever revising the manpage. -->
<!ENTITY dhdate "<date>Apr 1, 2014</date>">
<!-- SECTION should be 1-8, maybe w/ subsection other parameters are
allowed: see man(7), man(1). -->
<!ENTITY dhsection "<manvolnum>1</manvolnum>">
<!ENTITY dhemail "<email>akira@tagoh.org</email>">
<!ENTITY dhusername "Akira TAGOH">
<!ENTITY dhucpackage "<refentrytitle>fc-conflist</refentrytitle>">
<!ENTITY dhpackage "fc-conflist">
<!ENTITY gnu "<acronym>GNU</acronym>">
<!ENTITY gpl "&gnu; <acronym>GPL</acronym>">
]>
<refentry>
<refentryinfo>
<address>
&dhemail;
</address>
<author>
&dhfirstname;
&dhsurname;
</author>
<copyright>
<year>2014</year>
<holder>&dhusername;</holder>
</copyright>
&dhdate;
</refentryinfo>
<refmeta>
&dhucpackage;
&dhsection;
</refmeta>
<refnamediv>
<refname>&dhpackage;</refname>
<refpurpose>Show the ruleset files information on the system</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>&dhpackage;</command>
<arg><option>-Vh</option></arg>
<sbr>
<arg><option>--version</option></arg>
<arg><option>--help</option></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>DESCRIPTION</title>
<para><command>&dhpackage;</command> shows the ruleset files' information
being installed on the system.</para>
</refsect1>
<refsect1>
<title>OPTIONS</title>
<para>This program follows the usual &gnu; command line syntax,
with long options starting with two dashes (`-'). A summary of
options is included below.</para>
<variablelist>
<varlistentry>
<term><option>-V</option>
<option>--version</option>
</term>
<listitem>
<para>Show version of the program and exit.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option>
<option>--help</option>
</term>
<listitem>
<para>Show summary of options.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>RETURN CODES</title>
<para><command>fc-conflist</command> returns error code 0 for successful parsing,
or 1 if any errors occured or if at least one font face could not be opened.</para>
</refsect1>
<refsect1>
<title>AUTHOR</title>
<para>This manual page was updated by &dhusername; &dhemail;.</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

View File

@ -36,6 +36,14 @@
#define HAVE_GETOPT 1
#endif
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(x) (dgettext(GETTEXT_PACKAGE, x))
#else
#define dgettext(d, s) (s)
#define _(x) (x)
#endif
#ifndef HAVE_GETOPT
#define HAVE_GETOPT 0
#endif
@ -68,28 +76,28 @@ usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
fprintf (file, "usage: %s [-vbqVh] [-f FORMAT] [--verbose] [--brief] [--format=FORMAT] [--quiet] [--version] [--help] [pattern] {element ...} \n",
fprintf (file, _("usage: %s [-vbqVh] [-f FORMAT] [--verbose] [--brief] [--format=FORMAT] [--quiet] [--version] [--help] [pattern] {element ...} \n"),
program);
#else
fprintf (file, "usage: %s [-vbqVh] [-f FORMAT] [pattern] {element ...} \n",
fprintf (file, _("usage: %s [-vbqVh] [-f FORMAT] [pattern] {element ...} \n"),
program);
#endif
fprintf (file, "List fonts matching [pattern]\n");
fprintf (file, _("List fonts matching [pattern]\n"));
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
fprintf (file, " -v, --verbose display entire font pattern verbosely\n");
fprintf (file, " -b, --brief display entire font pattern briefly\n");
fprintf (file, " -f, --format=FORMAT use the given output format\n");
fprintf (file, " -q, --quiet suppress all normal output, exit 1 if no fonts matched\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
fprintf (file, _(" -v, --verbose display entire font pattern verbosely\n"));
fprintf (file, _(" -b, --brief display entire font pattern briefly\n"));
fprintf (file, _(" -f, --format=FORMAT use the given output format\n"));
fprintf (file, _(" -q, --quiet suppress all normal output, exit 1 if no fonts matched\n"));
fprintf (file, _(" -V, --version display font config version and exit\n"));
fprintf (file, _(" -h, --help display this help and exit\n"));
#else
fprintf (file, " -v (verbose) display entire font pattern verbosely\n");
fprintf (file, " -b (brief) display entire font pattern briefly\n");
fprintf (file, " -f FORMAT (format) use the given output format\n");
fprintf (file, " -q, (quiet) suppress all normal output, exit 1 if no fonts matched\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
fprintf (file, _(" -v (verbose) display entire font pattern verbosely\n"));
fprintf (file, _(" -b (brief) display entire font pattern briefly\n"));
fprintf (file, _(" -f FORMAT (format) use the given output format\n"));
fprintf (file, _(" -q, (quiet) suppress all normal output, exit 1 if no fonts matched\n"));
fprintf (file, _(" -V (version) display font config version and exit\n"));
fprintf (file, _(" -h (help) display this help and exit\n"));
#endif
exit (error);
}
@ -148,7 +156,7 @@ main (int argc, char **argv)
pat = FcNameParse ((FcChar8 *) argv[i]);
if (!pat)
{
fputs ("Unable to parse the pattern\n", stderr);
fprintf (stderr, _("Unable to parse the pattern\n"));
return 1;
}
while (argv[++i])

View File

@ -37,6 +37,14 @@
#include <stdlib.h>
#include <string.h>
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(x) (dgettext(GETTEXT_PACKAGE, x))
#else
#define dgettext(d, s) (s)
#define _(x) (x)
#endif
#ifndef HAVE_GETOPT
#define HAVE_GETOPT 0
#endif
@ -70,30 +78,30 @@ usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
fprintf (file, "usage: %s [-savbVh] [-f FORMAT] [--sort] [--all] [--verbose] [--brief] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n",
fprintf (file, _("usage: %s [-savbVh] [-f FORMAT] [--sort] [--all] [--verbose] [--brief] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n"),
program);
#else
fprintf (file, "usage: %s [-savVh] [-f FORMAT] [pattern] {element...}\n",
fprintf (file, _("usage: %s [-savVh] [-f FORMAT] [pattern] {element...}\n"),
program);
#endif
fprintf (file, "List best font matching [pattern]\n");
fprintf (file, _("List best font matching [pattern]\n"));
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
fprintf (file, " -s, --sort display sorted list of matches\n");
fprintf (file, " -a, --all display unpruned sorted list of matches\n");
fprintf (file, " -v, --verbose display entire font pattern verbosely\n");
fprintf (file, " -b, --brief display entire font pattern briefly\n");
fprintf (file, " -f, --format=FORMAT use the given output format\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
fprintf (file, _(" -s, --sort display sorted list of matches\n"));
fprintf (file, _(" -a, --all display unpruned sorted list of matches\n"));
fprintf (file, _(" -v, --verbose display entire font pattern verbosely\n"));
fprintf (file, _(" -b, --brief display entire font pattern briefly\n"));
fprintf (file, _(" -f, --format=FORMAT use the given output format\n"));
fprintf (file, _(" -V, --version display font config version and exit\n"));
fprintf (file, _(" -h, --help display this help and exit\n"));
#else
fprintf (file, " -s, (sort) display sorted list of matches\n");
fprintf (file, " -a (all) display unpruned sorted list of matches\n");
fprintf (file, " -v (verbose) display entire font pattern verbosely\n");
fprintf (file, " -b (brief) display entire font pattern briefly\n");
fprintf (file, " -f FORMAT (format) use the given output format\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
fprintf (file, _(" -s, (sort) display sorted list of matches\n"));
fprintf (file, _(" -a (all) display unpruned sorted list of matches\n"));
fprintf (file, _(" -v (verbose) display entire font pattern verbosely\n"));
fprintf (file, _(" -b (brief) display entire font pattern briefly\n"));
fprintf (file, _(" -f FORMAT (format) use the given output format\n"));
fprintf (file, _(" -V (version) display font config version and exit\n"));
fprintf (file, _(" -h (help) display this help and exit\n"));
#endif
exit (error);
}
@ -155,7 +163,7 @@ main (int argc, char **argv)
pat = FcNameParse ((FcChar8 *) argv[i]);
if (!pat)
{
fputs ("Unable to parse the pattern\n", stderr);
fprintf (stderr, _("Unable to parse the pattern\n"));
return 1;
}
while (argv[++i])
@ -184,7 +192,7 @@ main (int argc, char **argv)
if (!font_patterns || font_patterns->nfont == 0)
{
fputs("No fonts installed on the system\n", stderr);
fprintf (stderr, _("No fonts installed on the system\n"));
return 1;
}
for (j = 0; j < font_patterns->nfont; j++)

View File

@ -37,6 +37,14 @@
#include <stdlib.h>
#include <string.h>
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(x) (dgettext(GETTEXT_PACKAGE, x))
#else
#define dgettext(d, s) (s)
#define _(x) (x)
#endif
#ifndef HAVE_GETOPT
#define HAVE_GETOPT 0
#endif
@ -68,26 +76,26 @@ usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
fprintf (file, "usage: %s [-cdVh] [-f FORMAT] [--config] [--default] [--verbose] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n",
fprintf (file, _("usage: %s [-cdVh] [-f FORMAT] [--config] [--default] [--verbose] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n"),
program);
#else
fprintf (file, "usage: %s [-cdVh] [-f FORMAT] [pattern] {element...}\n",
fprintf (file, _("usage: %s [-cdVh] [-f FORMAT] [pattern] {element...}\n"),
program);
#endif
fprintf (file, "List best font matching [pattern]\n");
fprintf (file, _("List best font matching [pattern]\n"));
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
fprintf (file, " -c, --config perform config substitution on pattern\n");
fprintf (file, " -d, -default perform default substitution on pattern\n");
fprintf (file, " -f, --format=FORMAT use the given output format\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
fprintf (file, _(" -c, --config perform config substitution on pattern\n"));
fprintf (file, _(" -d, -default perform default substitution on pattern\n"));
fprintf (file, _(" -f, --format=FORMAT use the given output format\n"));
fprintf (file, _(" -V, --version display font config version and exit\n"));
fprintf (file, _(" -h, --help display this help and exit\n"));
#else
fprintf (file, " -c, (config) perform config substitution on pattern\n");
fprintf (file, " -d, (default) perform default substitution on pattern\n");
fprintf (file, " -f FORMAT (format) use the given output format\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
fprintf (file, _(" -c, (config) perform config substitution on pattern\n"));
fprintf (file, _(" -d, (default) perform default substitution on pattern\n"));
fprintf (file, _(" -f FORMAT (format) use the given output format\n"));
fprintf (file, _(" -V (version) display font config version and exit\n"));
fprintf (file, _(" -h (help) display this help and exit\n"));
#endif
exit (error);
}
@ -139,7 +147,7 @@ main (int argc, char **argv)
pat = FcNameParse ((FcChar8 *) argv[i]);
if (!pat)
{
fputs ("Unable to parse the pattern\n", stderr);
fprintf (stderr, _("Unable to parse the pattern\n"));
return 1;
}
while (argv[++i])

View File

@ -40,6 +40,14 @@
#include <stdlib.h>
#include <string.h>
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(x) (dgettext(GETTEXT_PACKAGE, x))
#else
#define dgettext(d, s) (s)
#define _(x) (x)
#endif
#ifndef HAVE_GETOPT
#define HAVE_GETOPT 0
#endif
@ -71,26 +79,26 @@ usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
fprintf (file, "usage: %s [-bVh] [-i index] [-f FORMAT] [--index index] [--brief] [--format FORMAT] [--version] [--help] font-file...\n",
fprintf (file, _("usage: %s [-bVh] [-i index] [-f FORMAT] [--index index] [--brief] [--format FORMAT] [--version] [--help] font-file...\n"),
program);
#else
fprintf (file, "usage: %s [-bVh] [-i index] [-f FORMAT] font-file...\n",
fprintf (file, _("usage: %s [-bVh] [-i index] [-f FORMAT] font-file...\n"),
program);
#endif
fprintf (file, "Query font files and print resulting pattern(s)\n");
fprintf (file, _("Query font files and print resulting pattern(s)\n"));
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
fprintf (file, " -i, --index INDEX display the INDEX face of each font file only\n");
fprintf (file, " -b, --brief display font pattern briefly\n");
fprintf (file, " -f, --format=FORMAT use the given output format\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
fprintf (file, _(" -i, --index INDEX display the INDEX face of each font file only\n"));
fprintf (file, _(" -b, --brief display font pattern briefly\n"));
fprintf (file, _(" -f, --format=FORMAT use the given output format\n"));
fprintf (file, _(" -V, --version display font config version and exit\n"));
fprintf (file, _(" -h, --help display this help and exit\n"));
#else
fprintf (file, " -i INDEX (index) display the INDEX face of each font file only\n");
fprintf (file, " -b (brief) display font pattern briefly\n");
fprintf (file, " -f FORMAT (format) use the given output format\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
fprintf (file, _(" -i INDEX (index) display the INDEX face of each font file only\n"));
fprintf (file, _(" -b (brief) display font pattern briefly\n"));
fprintf (file, _(" -f FORMAT (format) use the given output format\n"));
fprintf (file, _(" -V (version) display font config version and exit\n"));
fprintf (file, _(" -h (help) display this help and exit\n"));
#endif
exit (error);
}
@ -147,7 +155,7 @@ main (int argc, char **argv)
{
if (!FcFreeTypeQueryAll ((FcChar8*) argv[i], id, NULL, NULL, fs))
{
fprintf (stderr, "Can't query face %u of font file %s\n", id, argv[i]);
fprintf (stderr, _("Can't query face %u of font file %s\n"), id, argv[i]);
err = 1;
}
}

View File

@ -40,6 +40,14 @@
#include <stdlib.h>
#include <string.h>
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(x) (dgettext(GETTEXT_PACKAGE, x))
#else
#define dgettext(d, s) (s)
#define _(x) (x)
#endif
#ifndef HAVE_GETOPT
#define HAVE_GETOPT 0
#endif
@ -70,24 +78,24 @@ usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
fprintf (file, "usage: %s [-bVh] [-f FORMAT] [--brief] [--format FORMAT] [--version] [--help] font-file...\n",
fprintf (file, _("usage: %s [-bVh] [-f FORMAT] [--brief] [--format FORMAT] [--version] [--help] font-file...\n"),
program);
#else
fprintf (file, "usage: %s [-bVh] [-f FORMAT] font-file...\n",
fprintf (file, _("usage: %s [-bVh] [-f FORMAT] font-file...\n"),
program);
#endif
fprintf (file, "Scan font files and directories, and print resulting pattern(s)\n");
fprintf (file, _("Scan font files and directories, and print resulting pattern(s)\n"));
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
fprintf (file, " -b, --brief display font pattern briefly\n");
fprintf (file, " -f, --format=FORMAT use the given output format\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
fprintf (file, _(" -b, --brief display font pattern briefly\n"));
fprintf (file, _(" -f, --format=FORMAT use the given output format\n"));
fprintf (file, _(" -V, --version display font config version and exit\n"));
fprintf (file, _(" -h, --help display this help and exit\n"));
#else
fprintf (file, " -b (brief) display font pattern briefly\n");
fprintf (file, " -f FORMAT (format) use the given output format\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
fprintf (file, _(" -b (brief) display font pattern briefly\n"));
fprintf (file, _(" -f FORMAT (format) use the given output format\n"));
fprintf (file, _(" -V (version) display font config version and exit\n"));
fprintf (file, _(" -h (help) display this help and exit\n"));
#endif
exit (error);
}

View File

@ -1,5 +1,5 @@
#
# fontconfig/fc-query/Makefile.am
# fontconfig/fc-validate/Makefile.am
#
# Copyright © 2003 Keith Packard
#

View File

@ -41,6 +41,14 @@
#include <string.h>
#include <locale.h>
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(x) (dgettext(GETTEXT_PACKAGE, x))
#else
#define dgettext(d, s) (s)
#define _(x) (x)
#endif
#ifndef HAVE_GETOPT
#define HAVE_GETOPT 0
#endif
@ -72,26 +80,26 @@ usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
fprintf (file, "usage: %s [-Vhv] [-i index] [-l LANG] [--index index] [--lang LANG] [--verbose] [--version] [--help] font-file...\n",
fprintf (file, _("usage: %s [-Vhv] [-i index] [-l LANG] [--index index] [--lang LANG] [--verbose] [--version] [--help] font-file...\n"),
program);
#else
fprintf (file, "usage: %s [-Vhv] [-i index] [-l LANG] font-file...\n",
fprintf (file, _("usage: %s [-Vhv] [-i index] [-l LANG] font-file...\n"),
program);
#endif
fprintf (file, "Validate font files and print result\n");
fprintf (file, _("Validate font files and print result\n"));
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
fprintf (file, " -i, --index INDEX display the INDEX face of each font file only\n");
fprintf (file, " -l, --lang=LANG set LANG instead of current locale\n");
fprintf (file, " -v, --verbose show more detailed information\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
fprintf (file, _(" -i, --index INDEX display the INDEX face of each font file only\n"));
fprintf (file, _(" -l, --lang=LANG set LANG instead of current locale\n"));
fprintf (file, _(" -v, --verbose show more detailed information\n"));
fprintf (file, _(" -V, --version display font config version and exit\n"));
fprintf (file, _(" -h, --help display this help and exit\n"));
#else
fprintf (file, " -i INDEX (index) display the INDEX face of each font file only\n");
fprintf (file, " -l LANG (lang) set LANG instead of current locale\n");
fprintf (file, " -v (verbose) show more detailed information\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
fprintf (file, _(" -i INDEX (index) display the INDEX face of each font file only\n"));
fprintf (file, _(" -l LANG (lang) set LANG instead of current locale\n"));
fprintf (file, _(" -v (verbose) show more detailed information\n"));
fprintf (file, _(" -V (version) display font config version and exit\n"));
fprintf (file, _(" -h (help) display this help and exit\n"));
#endif
exit (error);
}
@ -156,7 +164,7 @@ main (int argc, char **argv)
if (FT_Init_FreeType (&ftlib))
{
fprintf (stderr, "Can't initalize FreeType library\n");
fprintf (stderr, _("Can't initalize FreeType library\n"));
return 1;
}
@ -174,7 +182,7 @@ main (int argc, char **argv)
{
if (!index_set && index > 0)
break;
fprintf (stderr, "Unable to open %s\n", argv[i]);
fprintf (stderr, _("Unable to open %s\n"), argv[i]);
err = 1;
}
else
@ -189,7 +197,7 @@ main (int argc, char **argv)
{
FcChar32 ucs4, pos, map[FC_CHARSET_MAP_SIZE];
printf ("%s:%d Missing %d glyph(s) to satisfy the coverage for %s language\n",
printf (_("%s:%d Missing %d glyph(s) to satisfy the coverage for %s language\n"),
argv[i], index, count, lang);
if (verbose)
@ -219,7 +227,7 @@ main (int argc, char **argv)
}
else
{
printf ("%s:%d Satisfy the coverage for %s language\n", argv[i], index, lang);
printf (_("%s:%d Satisfy the coverage for %s language\n"), argv[i], index, lang);
}
FcCharSetDestroy (fcs);

View File

@ -280,7 +280,9 @@ typedef struct _FcObjectSet {
} FcObjectSet;
typedef enum _FcMatchKind {
FcMatchPattern, FcMatchFont, FcMatchScan
FcMatchPattern, FcMatchFont, FcMatchScan,
FcMatchKindEnd,
FcMatchKindBegin = FcMatchPattern
} FcMatchKind;
typedef enum _FcLangResult {
@ -295,6 +297,12 @@ typedef enum _FcSetName {
FcSetApplication = 1
} FcSetName;
typedef struct _FcConfigFileInfoIter {
void *dummy1;
void *dummy2;
void *dummy3;
} FcConfigFileInfoIter;
typedef struct _FcAtomic FcAtomic;
#if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
@ -451,6 +459,21 @@ FcPublic void
FcConfigSetSysRoot (FcConfig *config,
const FcChar8 *sysroot);
FcPublic void
FcConfigFileInfoIterInit (FcConfig *config,
FcConfigFileInfoIter *iter);
FcPublic FcBool
FcConfigFileInfoIterNext (FcConfig *config,
FcConfigFileInfoIter *iter);
FcPublic FcBool
FcConfigFileInfoIterGet (FcConfig *config,
FcConfigFileInfoIter *iter,
FcChar8 **name,
FcChar8 **description,
FcBool *enabled);
/* fccharset.c */
FcPublic FcCharSet*
FcCharSetCreate (void);

View File

@ -2,6 +2,11 @@
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/fonts.conf file to configure system font access -->
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Default configuration file</description>
<!--
DO NOT EDIT THIS FILE.

15
git.mk
View File

@ -145,15 +145,30 @@ $(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
po/Makefile \
po/POTFILES \
po/stamp-it \
po/stamp-po \
po/.intltool-merge-cache \
"po/*.gmo" \
"po/*.mo" \
"po/*.sed" \
po/$(GETTEXT_PACKAGE).pot \
intltool-extract.in \
intltool-merge.in \
intltool-update.in \
; do echo /$$x; done; \
fi; \
if test -f $(srcdir)/po-conf/Makefile.in.in; then \
for x in \
po-conf/Makefile.in \
po-conf/Makefile \
po-conf/POTFILES \
po-conf/stamp-it \
po-conf/stamp-po \
"po-conf/*.gmo" \
"po-conf/*.mo" \
"po-conf/*.sed" \
po-conf/$(GETTEXT_PACKAGE)-conf.pot \
; do echo /$$x; done; \
fi; \
if test -f $(srcdir)/configure; then \
for x in \
autom4te.cache \

View File

@ -2,6 +2,11 @@
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file for local customizations -->
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>local customizations</description>
<!--
Enable sub-pixel rendering
<match target="font">

12
po-conf/ChangeLog Normal file
View File

@ -0,0 +1,12 @@
2015-01-28 gettextize <bug-gnu-gettext@gnu.org>
* Makefile.in.in: New file, from gettext-0.19.4.
* Rules-quot: New file, from gettext-0.19.4.
* boldquot.sed: New file, from gettext-0.19.4.
* en@boldquot.header: New file, from gettext-0.19.4.
* en@quot.header: New file, from gettext-0.19.4.
* insert-header.sin: New file, from gettext-0.19.4.
* quot.sed: New file, from gettext-0.19.4.
* remove-potcdate.sin: New file, from gettext-0.19.4.
* POTFILES.in: New file.

1
po-conf/LINGUAS Normal file
View File

@ -0,0 +1 @@
# Please keep this list sorted alphabetically.

78
po-conf/Makevars Normal file
View File

@ -0,0 +1,78 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE)-conf
# These two variables depend on the location of this directory.
subdir = po-conf
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = Free Software Foundation, Inc.
# This tells whether or not to prepend "GNU " prefix to the package
# name that gets inserted into the header of the $(DOMAIN).pot file.
# Possible values are "yes", "no", or empty. If it is empty, try to
# detect it automatically by scanning the files in $(top_srcdir) for
# "GNU packagename" string.
PACKAGE_GNU = no
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
# in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
# understood.
# - Strings which make invalid assumptions about notation of date, time or
# money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS = https://bugs.freedesktop.org/enter_bug.cgi?product=fontconfig
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =
# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
# context. Possible values are "yes" and "no". Set this to yes if the
# package uses functions taking also a message context, like pgettext(), or
# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
USE_MSGCTXT = no
# These options get passed to msgmerge.
# Useful options are in particular:
# --previous to keep previous msgids of translated messages,
# --quiet to reduce the verbosity.
MSGMERGE_OPTIONS =
# These options get passed to msginit.
# If you want to disable line wrapping when writing PO files, add
# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
# MSGINIT_OPTIONS.
MSGINIT_OPTIONS =
# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
# has changed. Possible values are "yes" and "no". Set this to no if
# the POT file is checked in the repository and the version control
# program ignores timestamps.
PO_DEPENDS_ON_POT = yes
# This tells whether or not to forcibly update $(DOMAIN).pot and
# regenerate PO files on "make dist". Possible values are "yes" and
# "no". Set this to no if the POT file and PO files are maintained
# externally.
DIST_DEPENDS_ON_UPDATE_PO = yes

0
po-conf/POTFILES.in Normal file
View File

12
po/ChangeLog Normal file
View File

@ -0,0 +1,12 @@
2015-01-28 gettextize <bug-gnu-gettext@gnu.org>
* Makefile.in.in: New file, from gettext-0.19.4.
* Rules-quot: New file, from gettext-0.19.4.
* boldquot.sed: New file, from gettext-0.19.4.
* en@boldquot.header: New file, from gettext-0.19.4.
* en@quot.header: New file, from gettext-0.19.4.
* insert-header.sin: New file, from gettext-0.19.4.
* quot.sed: New file, from gettext-0.19.4.
* remove-potcdate.sin: New file, from gettext-0.19.4.
* POTFILES.in: New file.

1
po/LINGUAS Normal file
View File

@ -0,0 +1 @@
# Please keep this list sorted alphabetically.

78
po/Makevars Normal file
View File

@ -0,0 +1,78 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE)
# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = Free Software Foundation, Inc.
# This tells whether or not to prepend "GNU " prefix to the package
# name that gets inserted into the header of the $(DOMAIN).pot file.
# Possible values are "yes", "no", or empty. If it is empty, try to
# detect it automatically by scanning the files in $(top_srcdir) for
# "GNU packagename" string.
PACKAGE_GNU = no
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
# in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
# understood.
# - Strings which make invalid assumptions about notation of date, time or
# money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS = https://bugs.freedesktop.org/enter_bug.cgi?product=fontconfig
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =
# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
# context. Possible values are "yes" and "no". Set this to yes if the
# package uses functions taking also a message context, like pgettext(), or
# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
USE_MSGCTXT = no
# These options get passed to msgmerge.
# Useful options are in particular:
# --previous to keep previous msgids of translated messages,
# --quiet to reduce the verbosity.
MSGMERGE_OPTIONS =
# These options get passed to msginit.
# If you want to disable line wrapping when writing PO files, add
# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
# MSGINIT_OPTIONS.
MSGINIT_OPTIONS =
# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
# has changed. Possible values are "yes" and "no". Set this to no if
# the POT file is checked in the repository and the version control
# program ignores timestamps.
PO_DEPENDS_ON_POT = yes
# This tells whether or not to forcibly update $(DOMAIN).pot and
# regenerate PO files on "make dist". Possible values are "yes" and
# "no". Set this to no if the POT file and PO files are maintained
# externally.
DIST_DEPENDS_ON_UPDATE_PO = yes

11
po/POTFILES.in Normal file
View File

@ -0,0 +1,11 @@
# List of source files which contain translatable strings.
fc-cache/fc-cache.c
fc-cat/fc-cat.c
fc-conflist/fc-conflist.c
fc-list/fc-list.c
fc-match/fc-match.c
fc-pattern/fc-pattern.c
fc-query/fc-query.c
fc-scan/fc-scan.c
fc-validate/fc-validate.c
src/fccfg.c

View File

@ -79,7 +79,8 @@ AM_CPPFLAGS = \
$(EXPAT_CFLAGS) \
$(WARN_CFLAGS) \
-DFC_CACHEDIR='"$(FC_CACHEDIR)"' \
-DFONTCONFIG_PATH='"$(BASECONFIGDIR)"'
-DFONTCONFIG_PATH='"$(BASECONFIGDIR)"' \
-DFC_TEMPLATEDIR='"$(TEMPLATEDIR)"'
EXTRA_DIST += makealias
@ -137,6 +138,7 @@ libfontconfig_la_SOURCES = \
fcformat.c \
fcfreetype.c \
fcfs.c \
fcptrlist.c \
fcinit.c \
fclang.c \
fclist.c \

View File

@ -26,6 +26,7 @@
#include "fcint.h"
#include <dirent.h>
#include <locale.h>
#include <sys/types.h>
#if defined (_WIN32) && !defined (R_OK)
@ -38,7 +39,19 @@ static FcConfig *
FcConfigEnsure (void)
{
FcConfig *config;
retry:
FcBool is_locale_initialized;
static void *static_is_locale_initialized;
retry_locale:
is_locale_initialized = (intptr_t) fc_atomic_ptr_get (&static_is_locale_initialized);
if (!is_locale_initialized)
{
is_locale_initialized = FcTrue;
if (!fc_atomic_ptr_cmpexch (&static_is_locale_initialized, NULL,
(void *)(long) is_locale_initialized))
goto retry_locale;
setlocale (LC_ALL, "");
}
retry_config:
config = fc_atomic_ptr_get (&_fcConfig);
if (!config)
{
@ -46,7 +59,7 @@ retry:
if (!fc_atomic_ptr_cmpexch (&_fcConfig, NULL, config)) {
FcConfigDestroy (config);
goto retry;
goto retry_config;
}
}
return config;
@ -72,6 +85,8 @@ FcConfigCreate (void)
{
FcSetName set;
FcConfig *config;
FcMatchKind k;
FcBool err = FcFalse;
config = malloc (sizeof (FcConfig));
if (!config)
@ -109,9 +124,15 @@ FcConfigCreate (void)
if (!config->cacheDirs)
goto bail8;
config->substPattern = 0;
config->substFont = 0;
config->substScan = 0;
for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
{
config->subst[k] = FcPtrListCreate ((FcDestroyFunc) FcRuleSetDestroy);
if (!config->subst[k])
err = FcTrue;
}
if (err)
goto bail9;
config->maxObjects = 0;
for (set = FcSetSystem; set <= FcSetApplication; set++)
config->fonts[set] = 0;
@ -123,10 +144,24 @@ FcConfigCreate (void)
config->sysRoot = NULL;
config->rulesetList = FcPtrListCreate ((FcDestroyFunc) FcRuleSetDestroy);
if (!config->rulesetList)
goto bail9;
config->availConfigFiles = FcStrSetCreate ();
if (!config->availConfigFiles)
goto bail10;
FcRefInit (&config->ref, 1);
return config;
bail10:
FcPtrListDestroy (config->rulesetList);
bail9:
for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
if (config->subst[k])
FcPtrListDestroy (config->subst[k]);
FcStrSetDestroy (config->cacheDirs);
bail8:
FcFontSetDestroy (config->rejectPatterns);
bail7:
@ -204,21 +239,6 @@ FcConfigUptoDate (FcConfig *config)
return FcTrue;
}
static void
FcSubstDestroy (FcSubst *s)
{
FcSubst *n;
while (s)
{
n = s->next;
if (s->rule)
FcRuleDestroy (s->rule);
free (s);
s = n;
}
}
FcExpr *
FcConfigAllocExpr (FcConfig *config)
{
@ -258,6 +278,7 @@ FcConfigDestroy (FcConfig *config)
{
FcSetName set;
FcExprPage *page;
FcMatchKind k;
if (FcRefDec (&config->ref) != 1)
return;
@ -273,9 +294,10 @@ FcConfigDestroy (FcConfig *config)
FcFontSetDestroy (config->acceptPatterns);
FcFontSetDestroy (config->rejectPatterns);
FcSubstDestroy (config->substPattern);
FcSubstDestroy (config->substFont);
FcSubstDestroy (config->substScan);
for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
FcPtrListDestroy (config->subst[k]);
FcPtrListDestroy (config->rulesetList);
FcStrSetDestroy (config->availConfigFiles);
for (set = FcSetSystem; set <= FcSetApplication; set++)
if (config->fonts[set])
FcFontSetDestroy (config->fonts[set]);
@ -652,61 +674,8 @@ FcConfigAddRule (FcConfig *config,
FcRule *rule,
FcMatchKind kind)
{
FcSubst *subst, **prev;
FcRule *r;
int n = 0;
if (!rule)
/* deprecated */
return FcFalse;
switch (kind) {
case FcMatchPattern:
prev = &config->substPattern;
break;
case FcMatchFont:
prev = &config->substFont;
break;
case FcMatchScan:
prev = &config->substScan;
break;
default:
return FcFalse;
}
subst = (FcSubst *) malloc (sizeof (FcSubst));
if (!subst)
return FcFalse;
for (; *prev; prev = &(*prev)->next);
*prev = subst;
subst->next = NULL;
subst->rule = rule;
for (r = rule; r; r = r->next)
{
switch (r->type)
{
case FcRuleTest:
if (r->u.test &&
r->u.test->kind == FcMatchDefault)
r->u.test->kind = kind;
if (n < r->u.test->object)
n = r->u.test->object;
break;
case FcRuleEdit:
if (n < r->u.edit->object)
n = r->u.edit->object;
break;
default:
break;
}
}
n = FC_OBJ_ID (n) - FC_MAX_BASE_OBJECT;
if (config->maxObjects < n)
config->maxObjects = n;
if (FcDebug () & FC_DBG_EDIT)
{
printf ("Add Subst ");
FcSubstPrint (subst);
}
return FcTrue;
}
static FcValue
@ -1536,8 +1505,10 @@ FcConfigSubstituteWithPat (FcConfig *config,
FcMatchKind kind)
{
FcValue v;
FcSubst *s;
FcPtrList *s;
FcPtrListIter iter, iter2;
FcRule *r;
FcRuleSet *rs;
FcValueList *l, **value = NULL, *vl;
FcPattern *m;
FcStrSet *strs;
@ -1554,9 +1525,11 @@ FcConfigSubstituteWithPat (FcConfig *config,
return FcFalse;
}
switch (kind) {
case FcMatchPattern:
s = config->substPattern;
if (kind < FcMatchKindBegin || kind >= FcMatchKindEnd)
return FcFalse;
s = config->subst[kind];
if (kind == FcMatchPattern)
{
strs = FcGetDefaultLangs ();
if (strs)
{
@ -1616,15 +1589,6 @@ FcConfigSubstituteWithPat (FcConfig *config,
if (prgname)
FcPatternObjectAddString (p, FC_PRGNAME_OBJECT, prgname);
}
break;
case FcMatchFont:
s = config->substFont;
break;
case FcMatchScan:
s = config->substScan;
break;
default:
return FcFalse;
}
nobjs = FC_MAX_BASE_OBJECT + config->maxObjects + 2;
@ -1652,9 +1616,14 @@ FcConfigSubstituteWithPat (FcConfig *config,
printf ("FcConfigSubstitute ");
FcPatternPrint (p);
}
for (; s; s = s->next)
FcPtrListIterInit (s, &iter);
for (; FcPtrListIterIsValid (s, &iter); FcPtrListIterNext (s, &iter))
{
r = s->rule;
rs = (FcRuleSet *) FcPtrListIterGetValue (s, &iter);
FcPtrListIterInit (rs->subst[kind], &iter2);
for (; FcPtrListIterIsValid (rs->subst[kind], &iter2); FcPtrListIterNext (rs->subst[kind], &iter2))
{
r = (FcRule *) FcPtrListIterGetValue (rs->subst[kind], &iter2);
for (i = 0; i < nobjs; i++)
{
elt[i] = NULL;
@ -1833,6 +1802,7 @@ FcConfigSubstituteWithPat (FcConfig *config,
}
bail:;
}
}
if (FcDebug () & FC_DBG_EDIT)
{
printf ("FcConfigSubstitute done");
@ -2204,6 +2174,36 @@ FcConfigFilename (const FcChar8 *url)
return file;
}
FcChar8 *
FcConfigRealFilename (FcConfig *config,
const FcChar8 *url)
{
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
FcChar8 *n = FcConfigFilename (url);
FcChar8 *nn = NULL;
if (n)
{
char buf[PATH_MAX];
ssize_t len;
if (sysroot)
nn = FcStrBuildFilename (sysroot, n, NULL);
else
nn = FcStrdup (n);
FcStrFree (n);
if ((len = readlink ((const char *) nn, buf, sizeof (buf) - 1)) != -1)
{
buf[len] = 0;
FcStrFree (nn);
nn = FcStrdup (buf);
}
}
return nn;
}
/*
* Manage the application-specific fonts
*/
@ -2444,6 +2444,199 @@ FcConfigSetSysRoot (FcConfig *config,
}
}
FcRuleSet *
FcRuleSetCreate (const FcChar8 *name)
{
FcRuleSet *ret = (FcRuleSet *) malloc (sizeof (FcRuleSet));
FcMatchKind k;
const FcChar8 *p;
if (!name)
p = (const FcChar8 *)"";
else
p = name;
if (ret)
{
ret->name = FcStrdup (p);
ret->description = NULL;
ret->domain = NULL;
for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
ret->subst[k] = FcPtrListCreate ((FcDestroyFunc) FcRuleDestroy);
FcRefInit (&ret->ref, 1);
}
return ret;
}
void
FcRuleSetDestroy (FcRuleSet *rs)
{
FcMatchKind k;
if (!rs)
return;
if (FcRefDec (&rs->ref) != 1)
return;
if (rs->name)
FcStrFree (rs->name);
if (rs->description)
FcStrFree (rs->description);
if (rs->domain)
FcStrFree (rs->domain);
for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
FcPtrListDestroy (rs->subst[k]);
free (rs);
}
void
FcRuleSetReference (FcRuleSet *rs)
{
if (!FcRefIsConst (&rs->ref))
FcRefInc (&rs->ref);
}
void
FcRuleSetEnable (FcRuleSet *rs,
FcBool flag)
{
if (rs)
{
rs->enabled = flag;
/* XXX: we may want to provide a feature
* to enable/disable rulesets through API
* in the future?
*/
}
}
void
FcRuleSetAddDescription (FcRuleSet *rs,
const FcChar8 *domain,
const FcChar8 *description)
{
if (rs->domain)
FcStrFree (rs->domain);
if (rs->description)
FcStrFree (rs->description);
rs->domain = domain ? FcStrdup (domain) : NULL;
rs->description = FcStrdup (description);
}
int
FcRuleSetAdd (FcRuleSet *rs,
FcRule *rule,
FcMatchKind kind)
{
FcPtrListIter iter;
FcRule *r;
int n = 0, ret;
if (!rs ||
kind < FcMatchKindBegin || kind >= FcMatchKindEnd)
return -1;
FcPtrListIterInitAtLast (rs->subst[kind], &iter);
if (!FcPtrListIterAdd (rs->subst[kind], &iter, rule))
return -1;
for (r = rule; r; r = r->next)
{
switch (r->type)
{
case FcRuleTest:
if (r->u.test &&
r->u.test->kind == FcMatchDefault)
r->u.test->kind = kind;
if (n < r->u.test->object)
n = r->u.test->object;
break;
case FcRuleEdit:
if (n < r->u.edit->object)
n = r->u.edit->object;
break;
default:
break;
}
}
if (FcDebug () & FC_DBG_EDIT)
{
printf ("Add Rule ");
FcRulePrint (rule);
}
ret = FC_OBJ_ID (n) - FC_MAX_BASE_OBJECT;
return ret < 0 ? 0 : ret;
}
void
FcConfigFileInfoIterInit (FcConfig *config,
FcConfigFileInfoIter *iter)
{
FcConfig *c;
FcPtrListIter *i = (FcPtrListIter *)iter;
if (!config)
c = FcConfigGetCurrent ();
else
c = config;
FcPtrListIterInit (c->rulesetList, i);
}
FcBool
FcConfigFileInfoIterNext (FcConfig *config,
FcConfigFileInfoIter *iter)
{
FcConfig *c;
FcPtrListIter *i = (FcPtrListIter *)iter;
if (!config)
c = FcConfigGetCurrent ();
else
c = config;
if (FcPtrListIterIsValid (c->rulesetList, i))
{
FcPtrListIterNext (c->rulesetList, i);
}
else
return FcFalse;
return FcTrue;
}
FcBool
FcConfigFileInfoIterGet (FcConfig *config,
FcConfigFileInfoIter *iter,
FcChar8 **name,
FcChar8 **description,
FcBool *enabled)
{
FcConfig *c;
FcRuleSet *r;
FcPtrListIter *i = (FcPtrListIter *)iter;
if (!config)
c = FcConfigGetCurrent ();
else
c = config;
if (!FcPtrListIterIsValid (c->rulesetList, i))
return FcFalse;
r = FcPtrListIterGetValue (c->rulesetList, i);
if (name)
*name = FcStrdup (r->name && r->name[0] ? r->name : (const FcChar8 *) "fonts.conf");
if (description)
*description = FcStrdup (!r->description ? _("No description") :
dgettext (r->domain ? (const char *) r->domain : GETTEXT_PACKAGE "-conf",
(const char *) r->description));
if (enabled)
*enabled = r->enabled;
return FcTrue;
}
#define __fccfg__
#include "fcaliastail.h"
#undef __fccfg__

View File

@ -479,6 +479,9 @@ FcTestPrint (const FcTest *test)
case FcMatchScan:
printf ("scan ");
break;
case FcMatchKindEnd:
/* shouldn't be reached */
return;
}
switch (test->qual) {
case FcQualAny:
@ -511,13 +514,12 @@ FcEditPrint (const FcEdit *edit)
}
void
FcSubstPrint (const FcSubst *subst)
FcRulePrint (const FcRule *rule)
{
FcRule *r;
FcRuleType last_type = FcRuleUnknown;
const FcRule *r;
printf ("match\n");
for (r = subst->rule; r; r = r->next)
for (r = rule; r; r = r->next)
{
if (last_type != r->type)
{

View File

@ -86,6 +86,7 @@ FcInitLoadOwnConfig (FcConfig *config)
return fallback;
}
(void) FcConfigParseOnly (config, (const FcChar8 *)FC_TEMPLATEDIR, FcFalse);
if (config->cacheDirs && config->cacheDirs->num == 0)
{

View File

@ -113,6 +113,17 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
#define FcPrivate
#endif
/* NLS */
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(x) (dgettext(GETTEXT_PACKAGE, x))
#else
#define dgettext(d, s) (s)
#define _(x) (x)
#endif
#define N_(x) x
FC_ASSERT_STATIC (sizeof (FcRef) == sizeof (int));
#define FcStrdup(s) ((FcChar8 *) strdup ((const char *) (s)))
@ -303,6 +314,16 @@ typedef struct _FcEdit {
FcValueBinding binding;
} FcEdit;
typedef void (* FcDestroyFunc) (void *data);
typedef struct _FcPtrList FcPtrList;
/* need to sync with FcConfigFileInfoIter at fontconfig.h */
typedef struct _FcPtrListIter {
void *dummy1;
void *dummy2;
void *dummy3;
} FcPtrListIter;
typedef enum _FcRuleType {
FcRuleUnknown, FcRuleTest, FcRuleEdit
} FcRuleType;
@ -316,10 +337,14 @@ typedef struct _FcRule {
} u;
} FcRule;
typedef struct _FcSubst {
struct _FcSubst *next;
FcRule *rule;
} FcSubst;
typedef struct _FcRuleSet {
FcRef ref;
FcChar8 *name;
FcChar8 *description;
FcChar8 *domain;
FcBool enabled;
FcPtrList *subst[FcMatchKindEnd];
} FcRuleSet;
typedef struct _FcCharLeaf {
FcChar32 map[256/32];
@ -496,10 +521,12 @@ struct _FcConfig {
* Substitution instructions for patterns and fonts;
* maxObjects is used to allocate appropriate intermediate storage
* while performing a whole set of substitutions
*
* 0.. substitutions for patterns
* 1.. substitutions for fonts
* 2.. substitutions for scanned fonts
*/
FcSubst *substPattern; /* substitutions for patterns */
FcSubst *substFont; /* substitutions for fonts */
FcSubst *substScan; /* substitutions for scanned fonts */
FcPtrList *subst[FcMatchKindEnd];
int maxObjects; /* maximum number of tests in all substs */
/*
* List of patterns used to control font file selection
@ -529,6 +556,8 @@ struct _FcConfig {
FcExprPage *expr_pool; /* pool of FcExpr's */
FcChar8 *sysRoot; /* override the system root directory */
FcStrSet *availConfigFiles; /* config files available */
FcPtrList *rulesetList; /* List of rulesets being installed */
};
typedef struct _FcFileTime {
@ -676,6 +705,29 @@ FcPrivate FcBool
FcConfigAddCache (FcConfig *config, FcCache *cache,
FcSetName set, FcStrSet *dirSet);
FcPrivate FcRuleSet *
FcRuleSetCreate (const FcChar8 *name);
FcPrivate void
FcRuleSetDestroy (FcRuleSet *rs);
FcPrivate void
FcRuleSetReference (FcRuleSet *rs);
FcPrivate void
FcRuleSetEnable (FcRuleSet *rs,
FcBool flag);
FcPrivate void
FcRuleSetAddDescription (FcRuleSet *rs,
const FcChar8 *domain,
const FcChar8 *description);
FcPrivate int
FcRuleSetAdd (FcRuleSet *rs,
FcRule *rule,
FcMatchKind kind);
/* fcserialize.c */
FcPrivate intptr_t
FcAlignSize (intptr_t size);
@ -791,7 +843,7 @@ FcPrivate void
FcEditPrint (const FcEdit *edit);
FcPrivate void
FcSubstPrint (const FcSubst *subst);
FcRulePrint (const FcRule *rule);
FcPrivate void
FcCharSetPrint (const FcCharSet *c);
@ -852,6 +904,42 @@ FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s);
FcPrivate FcFontSet *
FcFontSetDeserialize (const FcFontSet *set);
/* fcplist.c */
FcPrivate FcPtrList *
FcPtrListCreate (FcDestroyFunc func);
FcPrivate void
FcPtrListDestroy (FcPtrList *list);
FcPrivate void
FcPtrListIterInit (const FcPtrList *list,
FcPtrListIter *iter);
FcPrivate void
FcPtrListIterInitAtLast (FcPtrList *list,
FcPtrListIter *iter);
FcPrivate FcBool
FcPtrListIterNext (const FcPtrList *list,
FcPtrListIter *iter);
FcPrivate FcBool
FcPtrListIterIsValid (const FcPtrList *list,
const FcPtrListIter *iter);
FcPrivate void *
FcPtrListIterGetValue (const FcPtrList *list,
const FcPtrListIter *iter);
FcPrivate FcBool
FcPtrListIterAdd (FcPtrList *list,
FcPtrListIter *iter,
void *data);
FcPrivate FcBool
FcPtrListIterRemove (FcPtrList *list,
FcPtrListIter *iter);
/* fcinit.c */
FcPrivate FcConfig *
FcInitLoadOwnConfig (FcConfig *config);
@ -892,6 +980,15 @@ FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);
FcPrivate FcChar8 *
FcNameUnparseEscaped (FcPattern *pat, FcBool escape);
FcPrivate FcBool
FcConfigParseOnly (FcConfig *config,
const FcChar8 *name,
FcBool complain);
FcPrivate FcChar8 *
FcConfigRealFilename (FcConfig *config,
const FcChar8 *url);
/* fclist.c */
FcPrivate FcBool

198
src/fcptrlist.c Normal file
View File

@ -0,0 +1,198 @@
/*
* fontconfig/src/fcptrlist.c
*
* Copyright © 2000 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of the author(s) not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. The authors make no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "fcint.h"
typedef struct _FcPtrListEntry {
struct _FcPtrListEntry *next;
void *data;
} FcPtrListEntry;
struct _FcPtrList {
FcDestroyFunc destroy_func;
FcPtrListEntry *list;
};
typedef struct _FcPtrListIterPrivate {
const FcPtrList *list;
FcPtrListEntry *entry;
FcPtrListEntry *prev;
} FcPtrListIterPrivate;
FcPtrList *
FcPtrListCreate (FcDestroyFunc func)
{
FcPtrList *ret = (FcPtrList *) malloc (sizeof (FcPtrList));
if (ret)
{
ret->destroy_func = func;
ret->list = NULL;
}
return ret;
}
void
FcPtrListDestroy (FcPtrList *list)
{
FcPtrListIter iter;
FcPtrListIterInit (list, &iter);
do
{
if (FcPtrListIterGetValue (list, &iter))
list->destroy_func (FcPtrListIterGetValue (list, &iter));
FcPtrListIterRemove (list, &iter);
} while (FcPtrListIterIsValid (list, &iter));
free (list);
}
void
FcPtrListIterInit (const FcPtrList *list,
FcPtrListIter *iter)
{
FcPtrListIterPrivate *priv = (FcPtrListIterPrivate *) iter;
priv->list = list;
priv->entry = list->list;
priv->prev = NULL;
}
void
FcPtrListIterInitAtLast (FcPtrList *list,
FcPtrListIter *iter)
{
FcPtrListIterPrivate *priv = (FcPtrListIterPrivate *) iter;
FcPtrListEntry **e, **p;
e = &list->list;
p = e;
for (; *e; p = e, e = &(*e)->next);
priv->list = list;
priv->entry = *e;
priv->prev = *p;
}
FcBool
FcPtrListIterNext (const FcPtrList *list,
FcPtrListIter *iter)
{
FcPtrListIterPrivate *priv = (FcPtrListIterPrivate *) iter;
if (list != priv->list)
return FcFalse;
priv->prev = priv->entry;
priv->entry = priv->entry->next;
return priv->entry != NULL;
}
FcBool
FcPtrListIterIsValid (const FcPtrList *list,
const FcPtrListIter *iter)
{
FcPtrListIterPrivate *priv = (FcPtrListIterPrivate *) iter;
return list == priv->list && priv->entry;
}
void *
FcPtrListIterGetValue (const FcPtrList *list,
const FcPtrListIter *iter)
{
FcPtrListIterPrivate *priv = (FcPtrListIterPrivate *) iter;
if (list != priv->list ||
!priv->entry)
return NULL;
return priv->entry->data;
}
FcBool
FcPtrListIterAdd (FcPtrList *list,
FcPtrListIter *iter,
void *data)
{
FcPtrListEntry *e;
FcPtrListIterPrivate *priv = (FcPtrListIterPrivate *) iter;
if (list != priv->list)
return FcFalse;
e = (FcPtrListEntry *) malloc (sizeof (FcPtrListEntry));
e->data = data;
if (priv->entry)
{
e->next = priv->entry->next;
priv->entry->next = e;
}
else
{
e->next = NULL;
if (priv->prev)
{
priv->prev->next = e;
priv->entry = priv->prev;
}
else
{
list->list = e;
priv->entry = e;
return FcTrue;
}
}
return FcPtrListIterNext (list, iter);
}
FcBool
FcPtrListIterRemove (FcPtrList *list,
FcPtrListIter *iter)
{
FcPtrListIterPrivate *priv = (FcPtrListIterPrivate *) iter;
FcPtrListEntry *e;
if (list != priv->list)
return FcFalse;
if (!priv->entry)
return FcTrue;
if (list->list == priv->entry)
list->list = list->list->next;
e = priv->entry;
if (priv->prev)
priv->prev->next = priv->entry->next;
priv->entry = priv->entry->next;
free (e);
return FcTrue;
}
#define __fcplist__
#include "fcaliastail.h"
#undef __fcplist__

View File

@ -351,6 +351,7 @@ typedef enum _FcElement {
FcElementConfig,
FcElementMatch,
FcElementAlias,
FcElementDescription,
FcElementRescan,
@ -413,6 +414,7 @@ static const struct {
{ "config", FcElementConfig },
{ "match", FcElementMatch },
{ "alias", FcElementAlias },
{ "description", FcElementDescription },
{ "rescan", FcElementRescan },
@ -463,6 +465,11 @@ static const struct {
};
#define NUM_ELEMENT_MAPS (int) (sizeof fcElementMap / sizeof fcElementMap[0])
static const char *fcElementIgnoreName[16] = {
"its:",
NULL
};
static FcElement
FcElementMap (const XML_Char *name)
{
@ -471,6 +478,9 @@ FcElementMap (const XML_Char *name)
for (i = 0; i < NUM_ELEMENT_MAPS; i++)
if (!strcmp ((char *) name, fcElementMap[i].name))
return fcElementMap[i].element;
for (i = 0; fcElementIgnoreName[i] != NULL; i++)
if (!strncmp ((char *) name, fcElementIgnoreName[i], strlen (fcElementIgnoreName[i])))
return FcElementNone;
return FcElementUnknown;
}
@ -541,6 +551,7 @@ typedef struct _FcConfigParse {
FcBool error;
const FcChar8 *name;
FcConfig *config;
FcRuleSet *ruleset;
XML_Parser parser;
unsigned int pstack_static_used;
FcPStack pstack_static[8];
@ -1163,7 +1174,9 @@ FcPStackPop (FcConfigParse *parse)
return FcFalse;
}
if (parse->pstack->attr)
/* Don't check the attributes for FcElementNone */
if (parse->pstack->element != FcElementNone &&
parse->pstack->attr)
{
/* Warn about unused attrs. */
FcChar8 **attrs = parse->pstack->attr;
@ -1193,7 +1206,11 @@ FcPStackPop (FcConfigParse *parse)
}
static FcBool
FcConfigParseInit (FcConfigParse *parse, const FcChar8 *name, FcConfig *config, XML_Parser parser)
FcConfigParseInit (FcConfigParse *parse,
const FcChar8 *name,
FcConfig *config,
XML_Parser parser,
FcBool enabled)
{
parse->pstack = 0;
parse->pstack_static_used = 0;
@ -1202,7 +1219,10 @@ FcConfigParseInit (FcConfigParse *parse, const FcChar8 *name, FcConfig *config,
parse->error = FcFalse;
parse->name = name;
parse->config = config;
parse->ruleset = FcRuleSetCreate (name);
parse->parser = parser;
FcRuleSetEnable (parse->ruleset, enabled);
return FcTrue;
}
@ -1211,6 +1231,8 @@ FcConfigCleanup (FcConfigParse *parse)
{
while (parse->pstack)
FcPStackPop (parse);
FcRuleSetDestroy (parse->ruleset);
parse->ruleset = NULL;
}
static const FcChar8 *
@ -1727,6 +1749,7 @@ FcParseAlias (FcConfigParse *parse)
FcVStack *vstack;
FcRule *rule = NULL, *r;
FcValueBinding binding;
int n;
if (!FcConfigLexBinding (parse, FcConfigGetAttribute (parse, "binding"), &binding))
return;
@ -1869,8 +1892,29 @@ FcParseAlias (FcConfigParse *parse)
r = r->next;
}
}
if (!FcConfigAddRule (parse->config, rule, FcMatchPattern))
if ((n = FcRuleSetAdd (parse->ruleset, rule, FcMatchPattern)) == -1)
FcRuleDestroy (rule);
else
if (parse->config->maxObjects < n)
parse->config->maxObjects = n;
}
static void
FcParseDescription (FcConfigParse *parse)
{
const FcChar8 *domain;
FcChar8 *desc;
domain = FcConfigGetAttribute (parse, "domain");
desc = FcStrBufDone (&parse->pstack->str);
if (!desc)
{
FcConfigMessage (parse, FcSevereError, "out of memory");
return;
}
FcRuleSetAddDescription (parse->ruleset, domain, desc);
FcStrFree (desc);
}
static FcExpr *
@ -2621,6 +2665,7 @@ FcParseMatch (FcConfigParse *parse)
FcMatchKind kind;
FcVStack *vstack;
FcRule *rule = NULL, *r;
int n;
kind_name = FcConfigGetAttribute (parse, "target");
if (!kind_name)
@ -2676,8 +2721,14 @@ FcParseMatch (FcConfigParse *parse)
FcConfigMessage (parse, FcSevereWarning, "No <test> nor <edit> elements in <match>");
return;
}
if (!FcConfigAddRule (parse->config, rule, kind))
if ((n = FcRuleSetAdd (parse->ruleset, rule, kind)) == -1)
{
FcConfigMessage (parse, FcSevereError, "out of memory");
FcRuleDestroy (rule);
}
else
if (parse->config->maxObjects < n)
parse->config->maxObjects = n;
}
static void
@ -2884,6 +2935,9 @@ FcEndElement(void *userData, const XML_Char *name FC_UNUSED)
case FcElementAlias:
FcParseAlias (parse);
break;
case FcElementDescription:
FcParseDescription (parse);
break;
case FcElementRescan:
FcParseRescan (parse);
@ -3085,7 +3139,8 @@ static FcBool
FcConfigParseAndLoadDir (FcConfig *config,
const FcChar8 *name,
const FcChar8 *dir,
FcBool complain)
FcBool complain,
FcBool load)
{
DIR *d;
struct dirent *e;
@ -3152,7 +3207,10 @@ FcConfigParseAndLoadDir (FcConfig *config,
qsort (files->strs, files->num, sizeof (FcChar8 *),
(int (*)(const void *, const void *)) FcSortCmpStr);
for (i = 0; ret && i < files->num; i++)
if (load)
ret = FcConfigParseAndLoad (config, files->strs[i], complain);
else
ret = FcConfigParseOnly (config, files->strs[i], complain);
}
bail3:
FcStrSetDestroy (files);
@ -3173,13 +3231,16 @@ static FcBool
FcConfigParseAndLoadFromMemoryInternal (FcConfig *config,
const FcChar8 *filename,
const FcChar8 *buffer,
FcBool complain)
FcBool complain,
FcBool load)
{
XML_Parser p;
size_t len;
FcConfigParse parse;
FcBool error = FcTrue;
FcMatchKind k;
FcPtrListIter liter;
#ifdef ENABLE_LIBXML2
xmlSAXHandler sax;
@ -3212,7 +3273,7 @@ FcConfigParseAndLoadFromMemoryInternal (FcConfig *config,
if (!p)
goto bail1;
if (!FcConfigParseInit (&parse, filename, config, p))
if (!FcConfigParseInit (&parse, filename, config, p, load))
goto bail2;
#ifndef ENABLE_LIBXML2
@ -3262,6 +3323,24 @@ FcConfigParseAndLoadFromMemoryInternal (FcConfig *config,
} while (buflen != 0);
#endif
error = parse.error;
if (load)
{
for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
{
FcPtrListIter iter;
FcPtrListIterInit (parse.ruleset->subst[k], &iter);
if (FcPtrListIterIsValid (parse.ruleset->subst[k], &iter))
{
FcPtrListIterInitAtLast (parse.config->subst[k], &iter);
FcRuleSetReference (parse.ruleset);
FcPtrListIterAdd (parse.config->subst[k], &iter, parse.ruleset);
}
}
}
FcPtrListIterInitAtLast (parse.config->rulesetList, &liter);
FcRuleSetReference (parse.ruleset);
FcPtrListIterAdd (parse.config->rulesetList, &liter, parse.ruleset);
bail3:
FcConfigCleanup (&parse);
bail2:
@ -3275,23 +3354,15 @@ bail1:
return FcTrue;
}
FcBool
FcConfigParseAndLoadFromMemory (FcConfig *config,
const FcChar8 *buffer,
FcBool complain)
{
return FcConfigParseAndLoadFromMemoryInternal (config, (const FcChar8 *)"memory", buffer, complain);
}
FcBool
FcConfigParseAndLoad (FcConfig *config,
static FcBool
_FcConfigParse (FcConfig *config,
const FcChar8 *name,
FcBool complain)
FcBool complain,
FcBool load)
{
FcChar8 *filename, *f;
FcChar8 *filename = NULL, *realfilename = NULL;
int fd;
int len;
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
FcStrBuf sbuf;
char buf[BUFSIZ];
FcBool ret = FcFalse;
@ -3312,40 +3383,40 @@ FcConfigParseAndLoad (FcConfig *config,
}
#endif
f = FcConfigFilename (name);
if (!f)
filename = FcConfigFilename (name);
if (!filename)
goto bail0;
if (sysroot)
filename = FcStrBuildFilename (sysroot, f, NULL);
else
filename = FcStrdup (f);
FcStrFree (f);
if (FcStrSetMember (config->configFiles, filename))
realfilename = FcConfigRealFilename (config, name);
if (!realfilename)
goto bail0;
if (FcStrSetMember (config->availConfigFiles, realfilename))
{
FcStrFree (filename);
FcStrFree (realfilename);
return FcTrue;
}
if (!FcStrSetAdd (config->configFiles, filename))
if (load)
{
FcStrFree (filename);
if (!FcStrSetAdd (config->configFiles, filename))
goto bail0;
}
if (!FcStrSetAdd (config->availConfigFiles, realfilename))
goto bail0;
if (FcFileIsDir (filename))
if (FcFileIsDir (realfilename))
{
ret = FcConfigParseAndLoadDir (config, name, filename, complain);
ret = FcConfigParseAndLoadDir (config, name, realfilename, complain, load);
FcStrFree (filename);
FcStrFree (realfilename);
return ret;
}
FcStrBufInit (&sbuf, NULL, 0);
fd = FcOpen ((char *) filename, O_RDONLY);
if (fd == -1) {
if (fd == -1)
goto bail1;
}
do {
len = read (fd, buf, BUFSIZ);
@ -3359,12 +3430,15 @@ FcConfigParseAndLoad (FcConfig *config,
} while (len != 0);
close (fd);
ret = FcConfigParseAndLoadFromMemoryInternal (config, filename, FcStrBufDoneStatic (&sbuf), complain);
ret = FcConfigParseAndLoadFromMemoryInternal (config, filename, FcStrBufDoneStatic (&sbuf), complain, load);
complain = FcFalse; /* no need to reclaim here */
bail1:
FcStrFree (filename);
FcStrBufDestroy (&sbuf);
bail0:
if (filename)
FcStrFree (filename);
if (realfilename)
FcStrFree (realfilename);
if (!ret && complain)
{
if (name)
@ -3375,6 +3449,31 @@ bail0:
}
return FcTrue;
}
FcBool
FcConfigParseOnly (FcConfig *config,
const FcChar8 *name,
FcBool complain)
{
return _FcConfigParse (config, name, complain, FcFalse);
}
FcBool
FcConfigParseAndLoad (FcConfig *config,
const FcChar8 *name,
FcBool complain)
{
return _FcConfigParse (config, name, complain, FcTrue);
}
FcBool
FcConfigParseAndLoadFromMemory (FcConfig *config,
const FcChar8 *buffer,
FcBool complain)
{
return FcConfigParseAndLoadFromMemoryInternal (config, (const FcChar8 *)"memory", buffer, complain, FcTrue);
}
#define __fcxml__
#include "fcaliastail.h"
#undef __fcxml__