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. # PERFORMANCE OF THIS SOFTWARE.
SUBDIRS=fontconfig fc-case fc-lang src \ SUBDIRS=fontconfig fc-case fc-lang src \
fc-cache fc-cat fc-list fc-match fc-pattern fc-query fc-scan \ fc-cache fc-cat fc-conflist fc-list fc-match \
fc-validate conf.d test fc-pattern fc-query fc-scan fc-validate conf.d \
po po-conf test
if ENABLE_DOCS if ENABLE_DOCS
SUBDIRS += doc SUBDIRS += doc
endif endif
@ -31,11 +32,12 @@ endif
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = \ EXTRA_DIST = \
fontconfig.pc.in \ config.rpath \
fonts.conf.in \ fontconfig.pc.in \
fonts.conf.in \
fonts.dtd \ fonts.dtd \
fontconfig.spec.in \ fontconfig.spec.in \
fontconfig.spec \ fontconfig.spec \
fontconfig-zip.in \ fontconfig-zip.in \
config-fixups.h config-fixups.h
CLEANFILES = fonts.conf CLEANFILES = fonts.conf

View File

@ -49,6 +49,8 @@ AUTOCONF=${AUTOCONF-autoconf}
GPERF=${GPERF-gperf} GPERF=${GPERF-gperf}
PYTHON=${PYTHON-python} PYTHON=${PYTHON-python}
LIBTOOLIZE_FLAGS="--copy --force" LIBTOOLIZE_FLAGS="--copy --force"
GETTEXTIZE=${GETTEXTIZE-gettextize}
GETTEXTIZE_FLAGS="--force"
DIE=0 DIE=0
@ -84,7 +86,13 @@ if $have_libtool ; then : ; else
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1 DIE=1
fi 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 || { ($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || {
echo echo
echo "You must have autoconf installed to compile $PROJECT." 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
fi fi
echo Running $GETTEXTIZE $GETTEXTIZE_FLAGS
$GETTEXTIZE $GETTEXTIZE_FLAGS
echo Running $ACLOCAL $ACLOCAL_FLAGS echo Running $ACLOCAL $ACLOCAL_FLAGS
$ACLOCAL $ACLOCAL_FLAGS $ACLOCAL $ACLOCAL_FLAGS

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Use the Autohinter -->
<match target="pattern"> <match target="pattern">
<!-- <!--

View File

@ -1,6 +1,12 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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"> <match target="pattern">
<!-- <!--
This configuration is available on the major desktop environments. This configuration is available on the major desktop environments.

View File

@ -1,6 +1,12 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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"> <match target="pattern">
<!-- <!--
This configuration is available on the major desktop environments. This configuration is available on the major desktop environments.

View File

@ -1,6 +1,12 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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"> <match target="pattern">
<!-- <!--
This configuration is available on the major desktop environments. This configuration is available on the major desktop environments.

View File

@ -1,6 +1,12 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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"> <match target="pattern">
<!-- <!--
This configuration is available on the major desktop environments. This configuration is available on the major desktop environments.

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Disable sub-pixel rendering -->
<match target="pattern"> <match target="pattern">
<!-- <!--

View File

@ -1,7 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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. If font is bitmap, calculate scale factor.
Note that color bitmap fonts have scalable=true, while Note that color bitmap fonts have scalable=true, while

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Enable sub-pixel rendering -->
<match target="pattern"> <match target="pattern">
<!-- <!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Enable sub-pixel rendering -->
<match target="pattern"> <match target="pattern">
<!-- <!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Enable sub-pixel rendering -->
<match target="pattern"> <match target="pattern">
<!-- <!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Enable sub-pixel rendering -->
<match target="pattern"> <match target="pattern">
<!-- <!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Disable hinting -->
<match target="pattern"> <match target="pattern">
<!-- <!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Use lcddefault as default for LCD filter -->
<match target="pattern"> <match target="pattern">
<!-- <!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Use lcdlegacy as default for LCD filter -->
<match target="pattern"> <match target="pattern">
<!-- <!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Use lcdlight as default for LCD filter -->
<match target="pattern"> <match target="pattern">
<!-- <!--

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 The Bitstream Vera fonts have GASP entries suggesting that hinting be
disabled below 8 ppem, but FreeType ignores those, preferring to use disabled below 8 ppem, but FreeType ignores those, preferring to use

View File

@ -1,7 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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. --> <!-- We can't hint CJK fonts well, so turn off hinting for CJK fonts. -->
<match target="font"> <match target="font">

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 Mark common families with their generics so we'll get
something reasonable something reasonable

View File

@ -1,6 +1,12 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Keep in sync with 60-generic.conf -->
<!-- Emoji --> <!-- Emoji -->

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 Mark common families with their generics so we'll get
something reasonable something reasonable

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 If the font still has no generic name, add sans-serif
--> -->

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 Load per-user customization files where stored on XDG Base Directory
specification compliant places. it should be usually: specification compliant places. it should be usually:

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Load local system customization file -->
<include ignore_missing="yes">local.conf</include> <include ignore_missing="yes">local.conf</include>
</fontconfig> </fontconfig>

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Keep in sync with 45-generic.conf -->
<!-- Emoji --> <!-- Emoji -->

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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> <alias>
<family>serif</family> <family>serif</family>
<prefer> <prefer>

View File

@ -31,6 +31,10 @@
2008 Behdad Esfahbod: Cleanup. Add fantasy and cursive. 2008 Behdad Esfahbod: Cleanup. Add fantasy and cursive.
--> -->
<fontconfig> <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 --> <!-- Deprecated fonts are discouraged -->

View File

@ -1,6 +1,10 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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> <alias>
<family>serif</family> <family>serif</family>
<prefer> <prefer>

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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> <alias>
<family>serif</family> <family>serif</family>
<prefer> <prefer>

View File

@ -1,6 +1,10 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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> <alias>
<family>serif</family> <family>serif</family>
<prefer> <prefer>

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Reject bitmap fonts -->
<selectfont> <selectfont>
<rejectfont> <rejectfont>

View File

@ -1,6 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Accept bitmap fonts -->
<selectfont> <selectfont>
<acceptfont> <acceptfont>

View File

@ -1,6 +1,10 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 --> <!-- Fix-ups for Delicious family -->
<!-- Delicious 'heavy' variant says its Medium weight --> <!-- Delicious 'heavy' variant says its Medium weight -->

View File

@ -1,6 +1,10 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <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 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=
PKGCONFIG_REQUIRES_PRIVATELY= 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 ========================================================================== dnl ==========================================================================
case "$host" in case "$host" in
@ -732,6 +746,7 @@ src/Makefile
conf.d/Makefile conf.d/Makefile
fc-cache/Makefile fc-cache/Makefile
fc-cat/Makefile fc-cat/Makefile
fc-conflist/Makefile
fc-list/Makefile fc-list/Makefile
fc-match/Makefile fc-match/Makefile
fc-pattern/Makefile fc-pattern/Makefile
@ -740,6 +755,8 @@ fc-scan/Makefile
fc-validate/Makefile fc-validate/Makefile
doc/Makefile doc/Makefile
doc/version.sgml doc/version.sgml
po/Makefile.in
po-conf/Makefile.in
test/Makefile test/Makefile
fontconfig.spec fontconfig.spec
fontconfig.pc fontconfig.pc

View File

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

View File

@ -41,6 +41,14 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.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 #ifndef HAVE_GETOPT
#define HAVE_GETOPT 0 #define HAVE_GETOPT 0
#endif #endif
@ -148,27 +156,27 @@ usage (char *program, int error)
{ {
FILE *file = error ? stderr : stdout; FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG #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); program, FC_ARCHITECTURE);
fprintf (file, " %s [-Vh] [--version] [--help]\n", program); fprintf (file, " %s [-Vh] [--version] [--help]\n", program);
#else #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); program, FC_ARCHITECTURE);
#endif #endif
fprintf (file, "Reads font information cache from:\n"); fprintf (file, _("Reads font information cache from:\n"));
fprintf (file, " 1) specified fontconfig cache file\n"); fprintf (file, _(" 1) specified fontconfig cache file\n"));
fprintf (file, " 2) related to a particular font directory\n"); fprintf (file, _(" 2) related to a particular font directory\n"));
fprintf (file, "\n"); fprintf (file, "\n");
#if HAVE_GETOPT_LONG #if HAVE_GETOPT_LONG
fprintf (file, " -r, --recurse recurse into subdirectories\n"); fprintf (file, _(" -r, --recurse recurse into subdirectories\n"));
fprintf (file, " -v, --verbose be verbose\n"); fprintf (file, _(" -v, --verbose be verbose\n"));
fprintf (file, " -V, --version display font config version and exit\n"); fprintf (file, _(" -V, --version display font config version and exit\n"));
fprintf (file, " -h, --help display this help and exit\n"); fprintf (file, _(" -h, --help display this help and exit\n"));
#else #else
fprintf (file, " -r (recurse) recurse into subdirectories\n"); fprintf (file, _(" -r (recurse) recurse into subdirectories\n"));
fprintf (file, " -v (verbose) be verbose\n"); fprintf (file, _(" -v (verbose) be verbose\n"));
fprintf (file, " -V (version) display font config version and exit\n"); fprintf (file, _(" -V (version) display font config version and exit\n"));
fprintf (file, " -h (help) display this help and exit\n"); fprintf (file, _(" -h (help) display this help and exit\n"));
#endif #endif
exit (error); exit (error);
} }
@ -294,7 +302,7 @@ main (int argc, char **argv)
config = FcInitLoadConfig (); config = FcInitLoadConfig ();
if (!config) 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; return 1;
} }
FcConfigSetCurrent (config); FcConfigSetCurrent (config);
@ -303,7 +311,7 @@ main (int argc, char **argv)
args = FcStrSetCreate (); args = FcStrSetCreate ();
if (!args) if (!args)
{ {
fprintf (stderr, "%s: malloc failure\n", argv[0]); fprintf (stderr, _("%s: malloc failure\n"), argv[0]);
return 1; return 1;
} }
if (i < argc) if (i < argc)
@ -312,7 +320,7 @@ main (int argc, char **argv)
{ {
if (!FcStrSetAddFilename (args, (const FcChar8 *) argv[i])) 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; return 1;
} }
} }
@ -324,7 +332,7 @@ main (int argc, char **argv)
while ((arg = FcStrListNext (arglist))) while ((arg = FcStrListNext (arglist)))
if (!FcStrSetAdd (args, arg)) if (!FcStrSetAdd (args, arg))
{ {
fprintf (stderr, "%s: malloc failure\n", argv[0]); fprintf (stderr, _("%s: malloc failure\n"), argv[0]);
return 1; return 1;
} }
FcStrListDone (arglist); FcStrListDone (arglist);
@ -332,7 +340,7 @@ main (int argc, char **argv)
arglist = FcStrListCreate (args); arglist = FcStrListCreate (args);
if (!arglist) if (!arglist)
{ {
fprintf (stderr, "%s: malloc failure\n", argv[0]); fprintf (stderr, _("%s: malloc failure\n"), argv[0]);
return 1; return 1;
} }
FcStrSetDestroy (args); FcStrSetDestroy (args);
@ -372,7 +380,7 @@ main (int argc, char **argv)
{ {
if (!first) if (!first)
printf ("\n"); printf ("\n");
printf ("Directory: %s\nCache: %s\n--------\n", printf (_("Directory: %s\nCache: %s\n--------\n"),
FcCacheDir(cache), cache_file ? cache_file : arg); FcCacheDir(cache), cache_file ? cache_file : arg);
first = FcFalse; 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 #define HAVE_GETOPT 1
#endif #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 #ifndef HAVE_GETOPT
#define HAVE_GETOPT 0 #define HAVE_GETOPT 0
#endif #endif
@ -68,28 +76,28 @@ usage (char *program, int error)
{ {
FILE *file = error ? stderr : stdout; FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG #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); program);
#else #else
fprintf (file, "usage: %s [-vbqVh] [-f FORMAT] [pattern] {element ...} \n", fprintf (file, _("usage: %s [-vbqVh] [-f FORMAT] [pattern] {element ...} \n"),
program); program);
#endif #endif
fprintf (file, "List fonts matching [pattern]\n"); fprintf (file, _("List fonts matching [pattern]\n"));
fprintf (file, "\n"); fprintf (file, "\n");
#if HAVE_GETOPT_LONG #if HAVE_GETOPT_LONG
fprintf (file, " -v, --verbose display entire font pattern verbosely\n"); fprintf (file, _(" -v, --verbose display entire font pattern verbosely\n"));
fprintf (file, " -b, --brief display entire font pattern briefly\n"); fprintf (file, _(" -b, --brief display entire font pattern briefly\n"));
fprintf (file, " -f, --format=FORMAT use the given output format\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, _(" -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, _(" -V, --version display font config version and exit\n"));
fprintf (file, " -h, --help display this help and exit\n"); fprintf (file, _(" -h, --help display this help and exit\n"));
#else #else
fprintf (file, " -v (verbose) display entire font pattern verbosely\n"); fprintf (file, _(" -v (verbose) display entire font pattern verbosely\n"));
fprintf (file, " -b (brief) display entire font pattern briefly\n"); fprintf (file, _(" -b (brief) display entire font pattern briefly\n"));
fprintf (file, " -f FORMAT (format) use the given output format\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, _(" -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, _(" -V (version) display font config version and exit\n"));
fprintf (file, " -h (help) display this help and exit\n"); fprintf (file, _(" -h (help) display this help and exit\n"));
#endif #endif
exit (error); exit (error);
} }
@ -148,7 +156,7 @@ main (int argc, char **argv)
pat = FcNameParse ((FcChar8 *) argv[i]); pat = FcNameParse ((FcChar8 *) argv[i]);
if (!pat) if (!pat)
{ {
fputs ("Unable to parse the pattern\n", stderr); fprintf (stderr, _("Unable to parse the pattern\n"));
return 1; return 1;
} }
while (argv[++i]) while (argv[++i])

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,6 +2,11 @@
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/fonts.conf file to configure system font access --> <!-- /etc/fonts/fonts.conf file to configure system font access -->
<fontconfig> <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. 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/Makefile \
po/POTFILES \ po/POTFILES \
po/stamp-it \ po/stamp-it \
po/stamp-po \
po/.intltool-merge-cache \ po/.intltool-merge-cache \
"po/*.gmo" \ "po/*.gmo" \
"po/*.mo" \ "po/*.mo" \
"po/*.sed" \
po/$(GETTEXT_PACKAGE).pot \ po/$(GETTEXT_PACKAGE).pot \
intltool-extract.in \ intltool-extract.in \
intltool-merge.in \ intltool-merge.in \
intltool-update.in \ intltool-update.in \
; do echo /$$x; done; \ ; do echo /$$x; done; \
fi; \ 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 \ if test -f $(srcdir)/configure; then \
for x in \ for x in \
autom4te.cache \ autom4te.cache \

View File

@ -2,6 +2,11 @@
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file for local customizations --> <!-- /etc/fonts/local.conf file for local customizations -->
<fontconfig> <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 Enable sub-pixel rendering
<match target="font"> <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) \ $(EXPAT_CFLAGS) \
$(WARN_CFLAGS) \ $(WARN_CFLAGS) \
-DFC_CACHEDIR='"$(FC_CACHEDIR)"' \ -DFC_CACHEDIR='"$(FC_CACHEDIR)"' \
-DFONTCONFIG_PATH='"$(BASECONFIGDIR)"' -DFONTCONFIG_PATH='"$(BASECONFIGDIR)"' \
-DFC_TEMPLATEDIR='"$(TEMPLATEDIR)"'
EXTRA_DIST += makealias EXTRA_DIST += makealias
@ -137,6 +138,7 @@ libfontconfig_la_SOURCES = \
fcformat.c \ fcformat.c \
fcfreetype.c \ fcfreetype.c \
fcfs.c \ fcfs.c \
fcptrlist.c \
fcinit.c \ fcinit.c \
fclang.c \ fclang.c \
fclist.c \ fclist.c \

View File

@ -26,6 +26,7 @@
#include "fcint.h" #include "fcint.h"
#include <dirent.h> #include <dirent.h>
#include <locale.h>
#include <sys/types.h> #include <sys/types.h>
#if defined (_WIN32) && !defined (R_OK) #if defined (_WIN32) && !defined (R_OK)
@ -38,7 +39,19 @@ static FcConfig *
FcConfigEnsure (void) FcConfigEnsure (void)
{ {
FcConfig *config; 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); config = fc_atomic_ptr_get (&_fcConfig);
if (!config) if (!config)
{ {
@ -46,7 +59,7 @@ retry:
if (!fc_atomic_ptr_cmpexch (&_fcConfig, NULL, config)) { if (!fc_atomic_ptr_cmpexch (&_fcConfig, NULL, config)) {
FcConfigDestroy (config); FcConfigDestroy (config);
goto retry; goto retry_config;
} }
} }
return config; return config;
@ -72,6 +85,8 @@ FcConfigCreate (void)
{ {
FcSetName set; FcSetName set;
FcConfig *config; FcConfig *config;
FcMatchKind k;
FcBool err = FcFalse;
config = malloc (sizeof (FcConfig)); config = malloc (sizeof (FcConfig));
if (!config) if (!config)
@ -109,9 +124,15 @@ FcConfigCreate (void)
if (!config->cacheDirs) if (!config->cacheDirs)
goto bail8; goto bail8;
config->substPattern = 0; for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
config->substFont = 0; {
config->substScan = 0; config->subst[k] = FcPtrListCreate ((FcDestroyFunc) FcRuleSetDestroy);
if (!config->subst[k])
err = FcTrue;
}
if (err)
goto bail9;
config->maxObjects = 0; config->maxObjects = 0;
for (set = FcSetSystem; set <= FcSetApplication; set++) for (set = FcSetSystem; set <= FcSetApplication; set++)
config->fonts[set] = 0; config->fonts[set] = 0;
@ -123,10 +144,24 @@ FcConfigCreate (void)
config->sysRoot = NULL; 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); FcRefInit (&config->ref, 1);
return config; 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: bail8:
FcFontSetDestroy (config->rejectPatterns); FcFontSetDestroy (config->rejectPatterns);
bail7: bail7:
@ -204,21 +239,6 @@ FcConfigUptoDate (FcConfig *config)
return FcTrue; 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 * FcExpr *
FcConfigAllocExpr (FcConfig *config) FcConfigAllocExpr (FcConfig *config)
{ {
@ -258,6 +278,7 @@ FcConfigDestroy (FcConfig *config)
{ {
FcSetName set; FcSetName set;
FcExprPage *page; FcExprPage *page;
FcMatchKind k;
if (FcRefDec (&config->ref) != 1) if (FcRefDec (&config->ref) != 1)
return; return;
@ -273,9 +294,10 @@ FcConfigDestroy (FcConfig *config)
FcFontSetDestroy (config->acceptPatterns); FcFontSetDestroy (config->acceptPatterns);
FcFontSetDestroy (config->rejectPatterns); FcFontSetDestroy (config->rejectPatterns);
FcSubstDestroy (config->substPattern); for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
FcSubstDestroy (config->substFont); FcPtrListDestroy (config->subst[k]);
FcSubstDestroy (config->substScan); FcPtrListDestroy (config->rulesetList);
FcStrSetDestroy (config->availConfigFiles);
for (set = FcSetSystem; set <= FcSetApplication; set++) for (set = FcSetSystem; set <= FcSetApplication; set++)
if (config->fonts[set]) if (config->fonts[set])
FcFontSetDestroy (config->fonts[set]); FcFontSetDestroy (config->fonts[set]);
@ -652,61 +674,8 @@ FcConfigAddRule (FcConfig *config,
FcRule *rule, FcRule *rule,
FcMatchKind kind) FcMatchKind kind)
{ {
FcSubst *subst, **prev; /* deprecated */
FcRule *r; return FcFalse;
int n = 0;
if (!rule)
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 static FcValue
@ -1536,8 +1505,10 @@ FcConfigSubstituteWithPat (FcConfig *config,
FcMatchKind kind) FcMatchKind kind)
{ {
FcValue v; FcValue v;
FcSubst *s; FcPtrList *s;
FcPtrListIter iter, iter2;
FcRule *r; FcRule *r;
FcRuleSet *rs;
FcValueList *l, **value = NULL, *vl; FcValueList *l, **value = NULL, *vl;
FcPattern *m; FcPattern *m;
FcStrSet *strs; FcStrSet *strs;
@ -1554,9 +1525,11 @@ FcConfigSubstituteWithPat (FcConfig *config,
return FcFalse; return FcFalse;
} }
switch (kind) { if (kind < FcMatchKindBegin || kind >= FcMatchKindEnd)
case FcMatchPattern: return FcFalse;
s = config->substPattern; s = config->subst[kind];
if (kind == FcMatchPattern)
{
strs = FcGetDefaultLangs (); strs = FcGetDefaultLangs ();
if (strs) if (strs)
{ {
@ -1616,15 +1589,6 @@ FcConfigSubstituteWithPat (FcConfig *config,
if (prgname) if (prgname)
FcPatternObjectAddString (p, FC_PRGNAME_OBJECT, 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; nobjs = FC_MAX_BASE_OBJECT + config->maxObjects + 2;
@ -1652,186 +1616,192 @@ FcConfigSubstituteWithPat (FcConfig *config,
printf ("FcConfigSubstitute "); printf ("FcConfigSubstitute ");
FcPatternPrint (p); 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);
for (i = 0; i < nobjs; i++) FcPtrListIterInit (rs->subst[kind], &iter2);
for (; FcPtrListIterIsValid (rs->subst[kind], &iter2); FcPtrListIterNext (rs->subst[kind], &iter2))
{ {
elt[i] = NULL; r = (FcRule *) FcPtrListIterGetValue (rs->subst[kind], &iter2);
value[i] = NULL; for (i = 0; i < nobjs; i++)
tst[i] = NULL; {
} elt[i] = NULL;
for (; r; r = r->next) value[i] = NULL;
{ tst[i] = NULL;
switch (r->type) { }
case FcRuleUnknown: for (; r; r = r->next)
/* shouldn't be reached */ {
break; switch (r->type) {
case FcRuleTest: case FcRuleUnknown:
object = FC_OBJ_ID (r->u.test->object); /* shouldn't be reached */
/* break;
* Check the tests to see if case FcRuleTest:
* they all match the pattern object = FC_OBJ_ID (r->u.test->object);
*/ /*
if (FcDebug () & FC_DBG_EDIT) * Check the tests to see if
{ * they all match the pattern
printf ("FcConfigSubstitute test "); */
FcTestPrint (r->u.test); if (FcDebug () & FC_DBG_EDIT)
}
if (kind == FcMatchFont && r->u.test->kind == FcMatchPattern)
m = p_pat;
else
m = p;
if (m)
e = FcPatternObjectFindElt (m, r->u.test->object);
else
e = NULL;
/* different 'kind' won't be the target of edit */
if (!elt[object] && kind == r->u.test->kind)
{
elt[object] = e;
tst[object] = r->u.test;
}
/*
* If there's no such field in the font,
* then FcQualAll matches while FcQualAny does not
*/
if (!e)
{
if (r->u.test->qual == FcQualAll)
{ {
value[object] = NULL; printf ("FcConfigSubstitute test ");
continue; FcTestPrint (r->u.test);
} }
if (kind == FcMatchFont && r->u.test->kind == FcMatchPattern)
m = p_pat;
else else
m = p;
if (m)
e = FcPatternObjectFindElt (m, r->u.test->object);
else
e = NULL;
/* different 'kind' won't be the target of edit */
if (!elt[object] && kind == r->u.test->kind)
{
elt[object] = e;
tst[object] = r->u.test;
}
/*
* If there's no such field in the font,
* then FcQualAll matches while FcQualAny does not
*/
if (!e)
{
if (r->u.test->qual == FcQualAll)
{
value[object] = NULL;
continue;
}
else
{
if (FcDebug () & FC_DBG_EDIT)
printf ("No match\n");
goto bail;
}
}
/*
* Check to see if there is a match, mark the location
* to apply match-relative edits
*/
vl = FcConfigMatchValueList (m, p_pat, kind, r->u.test, e->values);
/* different 'kind' won't be the target of edit */
if (!value[object] && kind == r->u.test->kind)
value[object] = vl;
if (!vl ||
(r->u.test->qual == FcQualFirst && vl != e->values) ||
(r->u.test->qual == FcQualNotFirst && vl == e->values))
{ {
if (FcDebug () & FC_DBG_EDIT) if (FcDebug () & FC_DBG_EDIT)
printf ("No match\n"); printf ("No match\n");
goto bail; goto bail;
} }
} break;
/* case FcRuleEdit:
* Check to see if there is a match, mark the location object = FC_OBJ_ID (r->u.edit->object);
* to apply match-relative edits
*/
vl = FcConfigMatchValueList (m, p_pat, kind, r->u.test, e->values);
/* different 'kind' won't be the target of edit */
if (!value[object] && kind == r->u.test->kind)
value[object] = vl;
if (!vl ||
(r->u.test->qual == FcQualFirst && vl != e->values) ||
(r->u.test->qual == FcQualNotFirst && vl == e->values))
{
if (FcDebug () & FC_DBG_EDIT) if (FcDebug () & FC_DBG_EDIT)
printf ("No match\n"); {
goto bail; printf ("Substitute ");
} FcEditPrint (r->u.edit);
break; printf ("\n\n");
case FcRuleEdit: }
object = FC_OBJ_ID (r->u.edit->object);
if (FcDebug () & FC_DBG_EDIT)
{
printf ("Substitute ");
FcEditPrint (r->u.edit);
printf ("\n\n");
}
/*
* Evaluate the list of expressions
*/
l = FcConfigValues (p, p_pat,kind, r->u.edit->expr, r->u.edit->binding);
if (tst[object] && (tst[object]->kind == FcMatchFont || kind == FcMatchPattern))
elt[object] = FcPatternObjectFindElt (p, tst[object]->object);
switch (FC_OP_GET_OP (r->u.edit->op)) {
case FcOpAssign:
/* /*
* If there was a test, then replace the matched * Evaluate the list of expressions
* value with the new list of values
*/ */
if (value[object]) l = FcConfigValues (p, p_pat,kind, r->u.edit->expr, r->u.edit->binding);
{ if (tst[object] && (tst[object]->kind == FcMatchFont || kind == FcMatchPattern))
FcValueList *thisValue = value[object]; elt[object] = FcPatternObjectFindElt (p, tst[object]->object);
FcValueList *nextValue = l;
switch (FC_OP_GET_OP (r->u.edit->op)) {
case FcOpAssign:
/* /*
* Append the new list of values after the current value * If there was a test, then replace the matched
* value with the new list of values
*/ */
FcConfigAdd (&elt[object]->values, thisValue, FcTrue, l, r->u.edit->object); if (value[object])
{
FcValueList *thisValue = value[object];
FcValueList *nextValue = l;
/*
* Append the new list of values after the current value
*/
FcConfigAdd (&elt[object]->values, thisValue, FcTrue, l, r->u.edit->object);
/*
* Delete the marked value
*/
if (thisValue)
FcConfigDel (&elt[object]->values, thisValue);
/*
* Adjust a pointer into the value list to ensure
* future edits occur at the same place
*/
value[object] = nextValue;
break;
}
/* fall through ... */
case FcOpAssignReplace:
/* /*
* Delete the marked value * Delete all of the values and insert
* the new set
*/ */
if (thisValue) FcConfigPatternDel (p, r->u.edit->object);
FcConfigDel (&elt[object]->values, thisValue); FcConfigPatternAdd (p, r->u.edit->object, l, FcTrue);
/* /*
* Adjust a pointer into the value list to ensure * Adjust a pointer into the value list as they no
* future edits occur at the same place * longer point to anything valid
*/ */
value[object] = nextValue; value[object] = NULL;
break;
case FcOpPrepend:
if (value[object])
{
FcConfigAdd (&elt[object]->values, value[object], FcFalse, l, r->u.edit->object);
break;
}
/* fall through ... */
case FcOpPrependFirst:
FcConfigPatternAdd (p, r->u.edit->object, l, FcFalse);
break;
case FcOpAppend:
if (value[object])
{
FcConfigAdd (&elt[object]->values, value[object], FcTrue, l, r->u.edit->object);
break;
}
/* fall through ... */
case FcOpAppendLast:
FcConfigPatternAdd (p, r->u.edit->object, l, FcTrue);
break;
case FcOpDelete:
if (value[object])
{
FcConfigDel (&elt[object]->values, value[object]);
break;
}
/* fall through ... */
case FcOpDeleteAll:
FcConfigPatternDel (p, r->u.edit->object);
break;
default:
FcValueListDestroy (l);
break; break;
} }
/* fall through ... */
case FcOpAssignReplace:
/* /*
* Delete all of the values and insert * Now go through the pattern and eliminate
* the new set * any properties without data
*/ */
FcConfigPatternDel (p, r->u.edit->object); FcConfigPatternCanon (p, r->u.edit->object);
FcConfigPatternAdd (p, r->u.edit->object, l, FcTrue);
/* if (FcDebug () & FC_DBG_EDIT)
* Adjust a pointer into the value list as they no
* longer point to anything valid
*/
value[object] = NULL;
break;
case FcOpPrepend:
if (value[object])
{ {
FcConfigAdd (&elt[object]->values, value[object], FcFalse, l, r->u.edit->object); printf ("FcConfigSubstitute edit");
break; FcPatternPrint (p);
} }
/* fall through ... */
case FcOpPrependFirst:
FcConfigPatternAdd (p, r->u.edit->object, l, FcFalse);
break;
case FcOpAppend:
if (value[object])
{
FcConfigAdd (&elt[object]->values, value[object], FcTrue, l, r->u.edit->object);
break;
}
/* fall through ... */
case FcOpAppendLast:
FcConfigPatternAdd (p, r->u.edit->object, l, FcTrue);
break;
case FcOpDelete:
if (value[object])
{
FcConfigDel (&elt[object]->values, value[object]);
break;
}
/* fall through ... */
case FcOpDeleteAll:
FcConfigPatternDel (p, r->u.edit->object);
break;
default:
FcValueListDestroy (l);
break; break;
} }
/*
* Now go through the pattern and eliminate
* any properties without data
*/
FcConfigPatternCanon (p, r->u.edit->object);
if (FcDebug () & FC_DBG_EDIT)
{
printf ("FcConfigSubstitute edit");
FcPatternPrint (p);
}
break;
} }
bail:;
} }
bail:;
} }
if (FcDebug () & FC_DBG_EDIT) if (FcDebug () & FC_DBG_EDIT)
{ {
@ -2204,6 +2174,36 @@ FcConfigFilename (const FcChar8 *url)
return file; 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 * 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__ #define __fccfg__
#include "fcaliastail.h" #include "fcaliastail.h"
#undef __fccfg__ #undef __fccfg__

View File

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

View File

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

View File

@ -113,6 +113,17 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
#define FcPrivate #define FcPrivate
#endif #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)); FC_ASSERT_STATIC (sizeof (FcRef) == sizeof (int));
#define FcStrdup(s) ((FcChar8 *) strdup ((const char *) (s))) #define FcStrdup(s) ((FcChar8 *) strdup ((const char *) (s)))
@ -303,6 +314,16 @@ typedef struct _FcEdit {
FcValueBinding binding; FcValueBinding binding;
} FcEdit; } 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 { typedef enum _FcRuleType {
FcRuleUnknown, FcRuleTest, FcRuleEdit FcRuleUnknown, FcRuleTest, FcRuleEdit
} FcRuleType; } FcRuleType;
@ -316,10 +337,14 @@ typedef struct _FcRule {
} u; } u;
} FcRule; } FcRule;
typedef struct _FcSubst { typedef struct _FcRuleSet {
struct _FcSubst *next; FcRef ref;
FcRule *rule; FcChar8 *name;
} FcSubst; FcChar8 *description;
FcChar8 *domain;
FcBool enabled;
FcPtrList *subst[FcMatchKindEnd];
} FcRuleSet;
typedef struct _FcCharLeaf { typedef struct _FcCharLeaf {
FcChar32 map[256/32]; FcChar32 map[256/32];
@ -496,10 +521,12 @@ struct _FcConfig {
* Substitution instructions for patterns and fonts; * Substitution instructions for patterns and fonts;
* maxObjects is used to allocate appropriate intermediate storage * maxObjects is used to allocate appropriate intermediate storage
* while performing a whole set of substitutions * 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 */ FcPtrList *subst[FcMatchKindEnd];
FcSubst *substFont; /* substitutions for fonts */
FcSubst *substScan; /* substitutions for scanned fonts */
int maxObjects; /* maximum number of tests in all substs */ int maxObjects; /* maximum number of tests in all substs */
/* /*
* List of patterns used to control font file selection * List of patterns used to control font file selection
@ -529,6 +556,8 @@ struct _FcConfig {
FcExprPage *expr_pool; /* pool of FcExpr's */ FcExprPage *expr_pool; /* pool of FcExpr's */
FcChar8 *sysRoot; /* override the system root directory */ FcChar8 *sysRoot; /* override the system root directory */
FcStrSet *availConfigFiles; /* config files available */
FcPtrList *rulesetList; /* List of rulesets being installed */
}; };
typedef struct _FcFileTime { typedef struct _FcFileTime {
@ -676,6 +705,29 @@ FcPrivate FcBool
FcConfigAddCache (FcConfig *config, FcCache *cache, FcConfigAddCache (FcConfig *config, FcCache *cache,
FcSetName set, FcStrSet *dirSet); 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 */ /* fcserialize.c */
FcPrivate intptr_t FcPrivate intptr_t
FcAlignSize (intptr_t size); FcAlignSize (intptr_t size);
@ -791,7 +843,7 @@ FcPrivate void
FcEditPrint (const FcEdit *edit); FcEditPrint (const FcEdit *edit);
FcPrivate void FcPrivate void
FcSubstPrint (const FcSubst *subst); FcRulePrint (const FcRule *rule);
FcPrivate void FcPrivate void
FcCharSetPrint (const FcCharSet *c); FcCharSetPrint (const FcCharSet *c);
@ -852,6 +904,42 @@ FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s);
FcPrivate FcFontSet * FcPrivate FcFontSet *
FcFontSetDeserialize (const FcFontSet *set); 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 */ /* fcinit.c */
FcPrivate FcConfig * FcPrivate FcConfig *
FcInitLoadOwnConfig (FcConfig *config); FcInitLoadOwnConfig (FcConfig *config);
@ -892,6 +980,15 @@ FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);
FcPrivate FcChar8 * FcPrivate FcChar8 *
FcNameUnparseEscaped (FcPattern *pat, FcBool escape); 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 */ /* fclist.c */
FcPrivate FcBool 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, FcElementConfig,
FcElementMatch, FcElementMatch,
FcElementAlias, FcElementAlias,
FcElementDescription,
FcElementRescan, FcElementRescan,
@ -413,6 +414,7 @@ static const struct {
{ "config", FcElementConfig }, { "config", FcElementConfig },
{ "match", FcElementMatch }, { "match", FcElementMatch },
{ "alias", FcElementAlias }, { "alias", FcElementAlias },
{ "description", FcElementDescription },
{ "rescan", FcElementRescan }, { "rescan", FcElementRescan },
@ -463,6 +465,11 @@ static const struct {
}; };
#define NUM_ELEMENT_MAPS (int) (sizeof fcElementMap / sizeof fcElementMap[0]) #define NUM_ELEMENT_MAPS (int) (sizeof fcElementMap / sizeof fcElementMap[0])
static const char *fcElementIgnoreName[16] = {
"its:",
NULL
};
static FcElement static FcElement
FcElementMap (const XML_Char *name) FcElementMap (const XML_Char *name)
{ {
@ -471,6 +478,9 @@ FcElementMap (const XML_Char *name)
for (i = 0; i < NUM_ELEMENT_MAPS; i++) for (i = 0; i < NUM_ELEMENT_MAPS; i++)
if (!strcmp ((char *) name, fcElementMap[i].name)) if (!strcmp ((char *) name, fcElementMap[i].name))
return fcElementMap[i].element; return fcElementMap[i].element;
for (i = 0; fcElementIgnoreName[i] != NULL; i++)
if (!strncmp ((char *) name, fcElementIgnoreName[i], strlen (fcElementIgnoreName[i])))
return FcElementNone;
return FcElementUnknown; return FcElementUnknown;
} }
@ -541,6 +551,7 @@ typedef struct _FcConfigParse {
FcBool error; FcBool error;
const FcChar8 *name; const FcChar8 *name;
FcConfig *config; FcConfig *config;
FcRuleSet *ruleset;
XML_Parser parser; XML_Parser parser;
unsigned int pstack_static_used; unsigned int pstack_static_used;
FcPStack pstack_static[8]; FcPStack pstack_static[8];
@ -1163,7 +1174,9 @@ FcPStackPop (FcConfigParse *parse)
return FcFalse; 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. */ /* Warn about unused attrs. */
FcChar8 **attrs = parse->pstack->attr; FcChar8 **attrs = parse->pstack->attr;
@ -1193,7 +1206,11 @@ FcPStackPop (FcConfigParse *parse)
} }
static FcBool 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 = 0;
parse->pstack_static_used = 0; parse->pstack_static_used = 0;
@ -1202,7 +1219,10 @@ FcConfigParseInit (FcConfigParse *parse, const FcChar8 *name, FcConfig *config,
parse->error = FcFalse; parse->error = FcFalse;
parse->name = name; parse->name = name;
parse->config = config; parse->config = config;
parse->ruleset = FcRuleSetCreate (name);
parse->parser = parser; parse->parser = parser;
FcRuleSetEnable (parse->ruleset, enabled);
return FcTrue; return FcTrue;
} }
@ -1211,6 +1231,8 @@ FcConfigCleanup (FcConfigParse *parse)
{ {
while (parse->pstack) while (parse->pstack)
FcPStackPop (parse); FcPStackPop (parse);
FcRuleSetDestroy (parse->ruleset);
parse->ruleset = NULL;
} }
static const FcChar8 * static const FcChar8 *
@ -1727,6 +1749,7 @@ FcParseAlias (FcConfigParse *parse)
FcVStack *vstack; FcVStack *vstack;
FcRule *rule = NULL, *r; FcRule *rule = NULL, *r;
FcValueBinding binding; FcValueBinding binding;
int n;
if (!FcConfigLexBinding (parse, FcConfigGetAttribute (parse, "binding"), &binding)) if (!FcConfigLexBinding (parse, FcConfigGetAttribute (parse, "binding"), &binding))
return; return;
@ -1869,8 +1892,29 @@ FcParseAlias (FcConfigParse *parse)
r = r->next; r = r->next;
} }
} }
if (!FcConfigAddRule (parse->config, rule, FcMatchPattern)) if ((n = FcRuleSetAdd (parse->ruleset, rule, FcMatchPattern)) == -1)
FcRuleDestroy (rule); 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 * static FcExpr *
@ -2621,6 +2665,7 @@ FcParseMatch (FcConfigParse *parse)
FcMatchKind kind; FcMatchKind kind;
FcVStack *vstack; FcVStack *vstack;
FcRule *rule = NULL, *r; FcRule *rule = NULL, *r;
int n;
kind_name = FcConfigGetAttribute (parse, "target"); kind_name = FcConfigGetAttribute (parse, "target");
if (!kind_name) if (!kind_name)
@ -2676,8 +2721,14 @@ FcParseMatch (FcConfigParse *parse)
FcConfigMessage (parse, FcSevereWarning, "No <test> nor <edit> elements in <match>"); FcConfigMessage (parse, FcSevereWarning, "No <test> nor <edit> elements in <match>");
return; return;
} }
if (!FcConfigAddRule (parse->config, rule, kind)) if ((n = FcRuleSetAdd (parse->ruleset, rule, kind)) == -1)
{
FcConfigMessage (parse, FcSevereError, "out of memory"); FcConfigMessage (parse, FcSevereError, "out of memory");
FcRuleDestroy (rule);
}
else
if (parse->config->maxObjects < n)
parse->config->maxObjects = n;
} }
static void static void
@ -2884,6 +2935,9 @@ FcEndElement(void *userData, const XML_Char *name FC_UNUSED)
case FcElementAlias: case FcElementAlias:
FcParseAlias (parse); FcParseAlias (parse);
break; break;
case FcElementDescription:
FcParseDescription (parse);
break;
case FcElementRescan: case FcElementRescan:
FcParseRescan (parse); FcParseRescan (parse);
@ -3085,7 +3139,8 @@ static FcBool
FcConfigParseAndLoadDir (FcConfig *config, FcConfigParseAndLoadDir (FcConfig *config,
const FcChar8 *name, const FcChar8 *name,
const FcChar8 *dir, const FcChar8 *dir,
FcBool complain) FcBool complain,
FcBool load)
{ {
DIR *d; DIR *d;
struct dirent *e; struct dirent *e;
@ -3152,7 +3207,10 @@ FcConfigParseAndLoadDir (FcConfig *config,
qsort (files->strs, files->num, sizeof (FcChar8 *), qsort (files->strs, files->num, sizeof (FcChar8 *),
(int (*)(const void *, const void *)) FcSortCmpStr); (int (*)(const void *, const void *)) FcSortCmpStr);
for (i = 0; ret && i < files->num; i++) for (i = 0; ret && i < files->num; i++)
ret = FcConfigParseAndLoad (config, files->strs[i], complain); if (load)
ret = FcConfigParseAndLoad (config, files->strs[i], complain);
else
ret = FcConfigParseOnly (config, files->strs[i], complain);
} }
bail3: bail3:
FcStrSetDestroy (files); FcStrSetDestroy (files);
@ -3173,13 +3231,16 @@ static FcBool
FcConfigParseAndLoadFromMemoryInternal (FcConfig *config, FcConfigParseAndLoadFromMemoryInternal (FcConfig *config,
const FcChar8 *filename, const FcChar8 *filename,
const FcChar8 *buffer, const FcChar8 *buffer,
FcBool complain) FcBool complain,
FcBool load)
{ {
XML_Parser p; XML_Parser p;
size_t len; size_t len;
FcConfigParse parse; FcConfigParse parse;
FcBool error = FcTrue; FcBool error = FcTrue;
FcMatchKind k;
FcPtrListIter liter;
#ifdef ENABLE_LIBXML2 #ifdef ENABLE_LIBXML2
xmlSAXHandler sax; xmlSAXHandler sax;
@ -3212,7 +3273,7 @@ FcConfigParseAndLoadFromMemoryInternal (FcConfig *config,
if (!p) if (!p)
goto bail1; goto bail1;
if (!FcConfigParseInit (&parse, filename, config, p)) if (!FcConfigParseInit (&parse, filename, config, p, load))
goto bail2; goto bail2;
#ifndef ENABLE_LIBXML2 #ifndef ENABLE_LIBXML2
@ -3262,6 +3323,24 @@ FcConfigParseAndLoadFromMemoryInternal (FcConfig *config,
} while (buflen != 0); } while (buflen != 0);
#endif #endif
error = parse.error; 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: bail3:
FcConfigCleanup (&parse); FcConfigCleanup (&parse);
bail2: bail2:
@ -3275,23 +3354,15 @@ bail1:
return FcTrue; return FcTrue;
} }
FcBool static FcBool
FcConfigParseAndLoadFromMemory (FcConfig *config, _FcConfigParse (FcConfig *config,
const FcChar8 *buffer, const FcChar8 *name,
FcBool complain) FcBool complain,
FcBool load)
{ {
return FcConfigParseAndLoadFromMemoryInternal (config, (const FcChar8 *)"memory", buffer, complain); FcChar8 *filename = NULL, *realfilename = NULL;
}
FcBool
FcConfigParseAndLoad (FcConfig *config,
const FcChar8 *name,
FcBool complain)
{
FcChar8 *filename, *f;
int fd; int fd;
int len; int len;
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
FcStrBuf sbuf; FcStrBuf sbuf;
char buf[BUFSIZ]; char buf[BUFSIZ];
FcBool ret = FcFalse; FcBool ret = FcFalse;
@ -3312,40 +3383,40 @@ FcConfigParseAndLoad (FcConfig *config,
} }
#endif #endif
f = FcConfigFilename (name); filename = FcConfigFilename (name);
if (!f) if (!filename)
goto bail0; goto bail0;
if (sysroot) realfilename = FcConfigRealFilename (config, name);
filename = FcStrBuildFilename (sysroot, f, NULL); if (!realfilename)
else goto bail0;
filename = FcStrdup (f); if (FcStrSetMember (config->availConfigFiles, realfilename))
FcStrFree (f);
if (FcStrSetMember (config->configFiles, filename))
{ {
FcStrFree (filename); FcStrFree (filename);
FcStrFree (realfilename);
return FcTrue; return FcTrue;
} }
if (!FcStrSetAdd (config->configFiles, filename)) if (load)
{ {
FcStrFree (filename); if (!FcStrSetAdd (config->configFiles, filename))
goto bail0; 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 (filename);
FcStrFree (realfilename);
return ret; return ret;
} }
FcStrBufInit (&sbuf, NULL, 0); FcStrBufInit (&sbuf, NULL, 0);
fd = FcOpen ((char *) filename, O_RDONLY); fd = FcOpen ((char *) filename, O_RDONLY);
if (fd == -1) { if (fd == -1)
goto bail1; goto bail1;
}
do { do {
len = read (fd, buf, BUFSIZ); len = read (fd, buf, BUFSIZ);
@ -3359,12 +3430,15 @@ FcConfigParseAndLoad (FcConfig *config,
} while (len != 0); } while (len != 0);
close (fd); close (fd);
ret = FcConfigParseAndLoadFromMemoryInternal (config, filename, FcStrBufDoneStatic (&sbuf), complain); ret = FcConfigParseAndLoadFromMemoryInternal (config, filename, FcStrBufDoneStatic (&sbuf), complain, load);
complain = FcFalse; /* no need to reclaim here */ complain = FcFalse; /* no need to reclaim here */
bail1: bail1:
FcStrFree (filename);
FcStrBufDestroy (&sbuf); FcStrBufDestroy (&sbuf);
bail0: bail0:
if (filename)
FcStrFree (filename);
if (realfilename)
FcStrFree (realfilename);
if (!ret && complain) if (!ret && complain)
{ {
if (name) if (name)
@ -3375,6 +3449,31 @@ bail0:
} }
return FcTrue; 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__ #define __fcxml__
#include "fcaliastail.h" #include "fcaliastail.h"
#undef __fcxml__ #undef __fcxml__