From 9a0fcb948fe7346f6c68028b2e54ab600a2a2a6f Mon Sep 17 00:00:00 2001 From: Akira TAGOH Date: Thu, 27 Mar 2014 15:10:44 +0900 Subject: 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. --- Makefile.am | 14 +- autogen.sh | 13 +- conf.d/10-autohint.conf | 5 + conf.d/10-hinting-full.conf | 6 + conf.d/10-hinting-medium.conf | 6 + conf.d/10-hinting-none.conf | 6 + conf.d/10-hinting-slight.conf | 6 + conf.d/10-no-sub-pixel.conf | 5 + conf.d/10-scale-bitmap-fonts.conf | 4 + conf.d/10-sub-pixel-bgr.conf | 5 + conf.d/10-sub-pixel-rgb.conf | 5 + conf.d/10-sub-pixel-vbgr.conf | 5 + conf.d/10-sub-pixel-vrgb.conf | 5 + conf.d/10-unhinted.conf | 5 + conf.d/11-lcdfilter-default.conf | 5 + conf.d/11-lcdfilter-legacy.conf | 5 + conf.d/11-lcdfilter-light.conf | 5 + conf.d/20-unhint-small-vera.conf | 5 + conf.d/25-unhint-nonlatin.conf | 4 + conf.d/30-metric-aliases.conf | 5 + conf.d/40-nonlatin.conf | 5 + conf.d/45-generic.conf | 6 + conf.d/45-latin.conf | 5 + conf.d/49-sansserif.conf | 5 + conf.d/50-user.conf | 5 + conf.d/51-local.conf | 5 + conf.d/60-generic.conf | 5 + conf.d/60-latin.conf | 5 + conf.d/65-fonts-persian.conf | 4 + conf.d/65-khmer.conf | 4 + conf.d/65-nonlatin.conf | 5 + conf.d/69-unifont.conf | 4 + conf.d/70-no-bitmaps.conf | 5 + conf.d/70-yes-bitmaps.conf | 5 + conf.d/80-delicious.conf | 4 + conf.d/90-synthetic.conf | 4 + configure.ac | 17 + doc/fcconfig.fncs | 35 ++ fc-cache/fc-cache.c | 80 +++-- fc-cat/fc-cat.c | 46 +-- fc-conflist/Makefile.am | 60 ++++ fc-conflist/fc-conflist.c | 142 ++++++++ fc-conflist/fc-conflist.sgml | 135 ++++++++ fc-list/fc-list.c | 40 ++- fc-match/fc-match.c | 46 +-- fc-pattern/fc-pattern.c | 36 +- fc-query/fc-query.c | 36 +- fc-scan/fc-scan.c | 30 +- fc-validate/Makefile.am | 2 +- fc-validate/fc-validate.c | 42 ++- fontconfig/fontconfig.h | 25 +- fonts.conf.in | 5 + git.mk | 15 + local.conf | 5 + po-conf/ChangeLog | 12 + po-conf/LINGUAS | 1 + po-conf/Makevars | 78 +++++ po-conf/POTFILES.in | 0 po/ChangeLog | 12 + po/LINGUAS | 1 + po/Makevars | 78 +++++ po/POTFILES.in | 11 + src/Makefile.am | 4 +- src/fccfg.c | 675 ++++++++++++++++++++++++-------------- src/fcdbg.c | 10 +- src/fcinit.c | 1 + src/fcint.h | 113 ++++++- src/fcptrlist.c | 198 +++++++++++ src/fcxml.c | 179 +++++++--- 69 files changed, 1916 insertions(+), 449 deletions(-) create mode 100644 fc-conflist/Makefile.am create mode 100644 fc-conflist/fc-conflist.c create mode 100644 fc-conflist/fc-conflist.sgml create mode 100644 po-conf/ChangeLog create mode 100644 po-conf/LINGUAS create mode 100644 po-conf/Makevars create mode 100644 po-conf/POTFILES.in create mode 100644 po/ChangeLog create mode 100644 po/LINGUAS create mode 100644 po/Makevars create mode 100644 po/POTFILES.in create mode 100644 src/fcptrlist.c diff --git a/Makefile.am b/Makefile.am index c081f67..5e00414 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,8 +22,9 @@ # PERFORMANCE OF THIS SOFTWARE. SUBDIRS=fontconfig fc-case fc-lang src \ - fc-cache fc-cat fc-list fc-match fc-pattern fc-query fc-scan \ - fc-validate conf.d test + fc-cache fc-cat fc-conflist fc-list fc-match \ + fc-pattern fc-query fc-scan fc-validate conf.d \ + po po-conf test if ENABLE_DOCS SUBDIRS += doc endif @@ -31,11 +32,12 @@ endif ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = \ - fontconfig.pc.in \ - fonts.conf.in \ + config.rpath \ + fontconfig.pc.in \ + fonts.conf.in \ fonts.dtd \ - fontconfig.spec.in \ - fontconfig.spec \ + fontconfig.spec.in \ + fontconfig.spec \ fontconfig-zip.in \ config-fixups.h CLEANFILES = fonts.conf diff --git a/autogen.sh b/autogen.sh index 07c59a4..e7eff72 100755 --- a/autogen.sh +++ b/autogen.sh @@ -49,6 +49,8 @@ AUTOCONF=${AUTOCONF-autoconf} GPERF=${GPERF-gperf} PYTHON=${PYTHON-python} LIBTOOLIZE_FLAGS="--copy --force" +GETTEXTIZE=${GETTEXTIZE-gettextize} +GETTEXTIZE_FLAGS="--force" DIE=0 @@ -84,7 +86,13 @@ if $have_libtool ; then : ; else echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" DIE=1 fi - +($GETTEXTIZE --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have gettext installed to compile $PROJECT." + echo "Install the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} ($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || { echo echo "You must have autoconf installed to compile $PROJECT." @@ -133,6 +141,9 @@ if test -z "$AUTOGEN_SUBDIR_MODE" -a -z "$NOCONFIGURE"; then fi fi +echo Running $GETTEXTIZE $GETTEXTIZE_FLAGS +$GETTEXTIZE $GETTEXTIZE_FLAGS + echo Running $ACLOCAL $ACLOCAL_FLAGS $ACLOCAL $ACLOCAL_FLAGS diff --git a/conf.d/10-autohint.conf b/conf.d/10-autohint.conf index f9032ba..50ec3b4 100644 --- a/conf.d/10-autohint.conf +++ b/conf.d/10-autohint.conf @@ -1,6 +1,11 @@ + + + + + Enable autohinter diff --git a/conf.d/30-metric-aliases.conf b/conf.d/30-metric-aliases.conf index c755c5e..147fde6 100644 --- a/conf.d/30-metric-aliases.conf +++ b/conf.d/30-metric-aliases.conf @@ -1,6 +1,11 @@ + + + + + Set substitutions for similar/metric-compatible families diff --git a/conf.d/45-latin.conf b/conf.d/45-latin.conf index c6696f8..a9240b9 100644 --- a/conf.d/45-latin.conf +++ b/conf.d/45-latin.conf @@ -1,6 +1,11 @@ + + + + + Set substitutions for Latin fonts diff --git a/conf.d/50-user.conf b/conf.d/50-user.conf index 07c9182..681ed6d 100644 --- a/conf.d/50-user.conf +++ b/conf.d/50-user.conf @@ -1,6 +1,11 @@ + + + + + Load per-user customization files local.conf diff --git a/conf.d/60-generic.conf b/conf.d/60-generic.conf index 7985ce9..be7b52b 100644 --- a/conf.d/60-generic.conf +++ b/conf.d/60-generic.conf @@ -1,6 +1,11 @@ + + + + + Set preferable fonts for emoji/math fonts diff --git a/conf.d/60-latin.conf b/conf.d/60-latin.conf index 23ee91b..5be5d6a 100644 --- a/conf.d/60-latin.conf +++ b/conf.d/60-latin.conf @@ -1,6 +1,11 @@ + + + + + Set preferable fonts for Latin serif diff --git a/conf.d/65-fonts-persian.conf b/conf.d/65-fonts-persian.conf index ea00661..5591486 100644 --- a/conf.d/65-fonts-persian.conf +++ b/conf.d/65-fonts-persian.conf @@ -31,6 +31,10 @@ 2008 Behdad Esfahbod: Cleanup. Add fantasy and cursive. --> + + + + diff --git a/conf.d/65-khmer.conf b/conf.d/65-khmer.conf index f9d06f2..8985c0d 100644 --- a/conf.d/65-khmer.conf +++ b/conf.d/65-khmer.conf @@ -1,6 +1,10 @@ + + + + serif diff --git a/conf.d/65-nonlatin.conf b/conf.d/65-nonlatin.conf index 7cedf3b..dcbb677 100644 --- a/conf.d/65-nonlatin.conf +++ b/conf.d/65-nonlatin.conf @@ -1,6 +1,11 @@ + + + + + Set preferable fonts for non-Latin serif diff --git a/conf.d/69-unifont.conf b/conf.d/69-unifont.conf index 177dec5..a3586f2 100644 --- a/conf.d/69-unifont.conf +++ b/conf.d/69-unifont.conf @@ -1,6 +1,10 @@ + + + + serif diff --git a/conf.d/70-no-bitmaps.conf b/conf.d/70-no-bitmaps.conf index 6b506e8..efb1bc0 100644 --- a/conf.d/70-no-bitmaps.conf +++ b/conf.d/70-no-bitmaps.conf @@ -1,6 +1,11 @@ + + + + + Reject bitmap fonts diff --git a/conf.d/70-yes-bitmaps.conf b/conf.d/70-yes-bitmaps.conf index c153aeb..0c70a53 100644 --- a/conf.d/70-yes-bitmaps.conf +++ b/conf.d/70-yes-bitmaps.conf @@ -1,6 +1,11 @@ + + + + + Accept bitmap fonts diff --git a/conf.d/80-delicious.conf b/conf.d/80-delicious.conf index 845647b..8cd01f9 100644 --- a/conf.d/80-delicious.conf +++ b/conf.d/80-delicious.conf @@ -1,6 +1,10 @@ + + + + diff --git a/conf.d/90-synthetic.conf b/conf.d/90-synthetic.conf index 7cd25cf..e344e4a 100644 --- a/conf.d/90-synthetic.conf +++ b/conf.d/90-synthetic.conf @@ -1,6 +1,10 @@ + + + + diff --git a/configure.ac b/configure.ac index 2b9b036..816cb38 100644 --- a/configure.ac +++ b/configure.ac @@ -89,6 +89,20 @@ AC_SUBST(LIBT_CURRENT_MINUS_AGE) PKGCONFIG_REQUIRES= PKGCONFIG_REQUIRES_PRIVATELY= +dnl ========================================================================== +dnl gettext stuff +dnl ========================================================================== +GETTEXT_PACKAGE=$PACKAGE +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext package]) + +AM_GNU_GETTEXT([external]) + +AC_PATH_PROG(ITSTOOL, [itstool]) +if test -z "$ITSTOOL"; then + AC_MSG_ERROR([The itstool were not found. Please install itstool.]) +fi + dnl ========================================================================== case "$host" in @@ -732,6 +746,7 @@ src/Makefile conf.d/Makefile fc-cache/Makefile fc-cat/Makefile +fc-conflist/Makefile fc-list/Makefile fc-match/Makefile fc-pattern/Makefile @@ -740,6 +755,8 @@ fc-scan/Makefile fc-validate/Makefile doc/Makefile doc/version.sgml +po/Makefile.in +po-conf/Makefile.in test/Makefile fontconfig.spec fontconfig.pc diff --git a/doc/fcconfig.fncs b/doc/fcconfig.fncs index 80f9b58..de7a5d7 100644 --- a/doc/fcconfig.fncs +++ b/doc/fcconfig.fncs @@ -410,3 +410,38 @@ this function calls FcConfigSetCurrent() internally. @SINCE@ 2.10.92 @@ +@RET@ void +@FUNC@ FcConfigFileInfoIterInit +@TYPE1@ FcConfig * @ARG1@ config +@TYPE2@ FcConfigFileInfoIter * @ARG2@ iter +@PURPOSE@ Initialize the iterator +@DESC@ +Initialize 'iter' with the first iterator in the config file information list. +@SINCE@ 2.12.91 +@@ + +@RET@ FcBool +@FUNC@ FcConfigFileInfoIterNext +@TYPE1@ FcConfig * @ARG1@ config +@TYPE2@ FcConfigFileInfoIter * @ARG2@ iter +@PURPOSE@ Set the iterator to point to the next list +@DESC@ +Set 'iter' to point to the next node in the config file information list. +If there is no next node, FcFalse is returned. +@SINCE@ 2.12.91 +@@ + +@RET@ FcBool +@FUNC@ FcConfigFileInfoIterGet +@TYPE1@ FcConfig * @ARG1@ config +@TYPE2@ FcConfigFileInfoIter * @ARG2@ iter +@TYPE3@ FcChar8 ** @ARG3@ name +@TYPE4@ FcChar8 ** @ARG4@ description +@TYPE5@ FcBool * @ARG5@ enabled +@PURPOSE@ Obtain the configuration file information +@DESC@ +Obtain the filename, the description and the flag whether it is enabled or not +for 'iter' where points to current configuration file information. +If the iterator is invalid, FcFalse is returned. +@SINCE@ 2.12.91 +@@ diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c index 0336073..80cc820 100644 --- a/fc-cache/fc-cache.c +++ b/fc-cache/fc-cache.c @@ -49,6 +49,14 @@ #undef STRICT #endif +#ifdef ENABLE_NLS +#include +#define _(x) (dgettext(GETTEXT_PACKAGE, x)) +#else +#define dgettext(d, s) (s) +#define _(x) (x) +#endif + #ifndef O_BINARY #define O_BINARY 0 #endif @@ -87,34 +95,34 @@ usage (char *program, int error) { FILE *file = error ? stderr : stdout; #if HAVE_GETOPT_LONG - fprintf (file, "usage: %s [-EfrsvVh] [-y SYSROOT] [--error-on-no-fonts] [--force|--really-force] [--sysroot=SYSROOT] [--system-only] [--verbose] [--version] [--help] [dirs]\n", + fprintf (file, _("usage: %s [-EfrsvVh] [-y SYSROOT] [--error-on-no-fonts] [--force|--really-force] [--sysroot=SYSROOT] [--system-only] [--verbose] [--version] [--help] [dirs]\n"), program); #else - fprintf (file, "usage: %s [-EfrsvVh] [-y SYSROOT] [dirs]\n", + fprintf (file, _("usage: %s [-EfrsvVh] [-y SYSROOT] [dirs]\n"), program); #endif - fprintf (file, "Build font information caches in [dirs]\n" - "(all directories in font configuration by default).\n"); + fprintf (file, _("Build font information caches in [dirs]\n" + "(all directories in font configuration by default).\n")); fprintf (file, "\n"); #if HAVE_GETOPT_LONG - fprintf (file, " -E, --error-on-no-fonts raise an error if no fonts in a directory\n"); - fprintf (file, " -f, --force scan directories with apparently valid caches\n"); - fprintf (file, " -r, --really-force erase all existing caches, then rescan\n"); - fprintf (file, " -s, --system-only scan system-wide directories only\n"); - fprintf (file, " -y, --sysroot=SYSROOT prepend SYSROOT to all paths for scanning\n"); - fprintf (file, " -v, --verbose display status information while busy\n"); - fprintf (file, " -V, --version display font config version and exit\n"); - fprintf (file, " -h, --help display this help and exit\n"); + fprintf (file, _(" -E, --error-on-no-fonts raise an error if no fonts in a directory\n")); + fprintf (file, _(" -f, --force scan directories with apparently valid caches\n")); + fprintf (file, _(" -r, --really-force erase all existing caches, then rescan\n")); + fprintf (file, _(" -s, --system-only scan system-wide directories only\n")); + fprintf (file, _(" -y, --sysroot=SYSROOT prepend SYSROOT to all paths for scanning\n")); + fprintf (file, _(" -v, --verbose display status information while busy\n")); + fprintf (file, _(" -V, --version display font config version and exit\n")); + fprintf (file, _(" -h, --help display this help and exit\n")); #else - fprintf (file, " -E (error-on-no-fonts)\n"); - fprintf (file, " raise an error if no fonts in a directory\n"); - fprintf (file, " -f (force) scan directories with apparently valid caches\n"); - fprintf (file, " -r, (really force) erase all existing caches, then rescan\n"); - fprintf (file, " -s (system) scan system-wide directories only\n"); - fprintf (file, " -y SYSROOT (sysroot) prepend SYSROOT to all paths for scanning\n"); - fprintf (file, " -v (verbose) display status information while busy\n"); - fprintf (file, " -V (version) display font config version and exit\n"); - fprintf (file, " -h (help) display this help and exit\n"); + fprintf (file, " -E (error-on-no-fonts)\n")); + fprintf (file, _(" raise an error if no fonts in a directory\n")); + fprintf (file, _(" -f (force) scan directories with apparently valid caches\n")); + fprintf (file, _(" -r, (really force) erase all existing caches, then rescan\n")); + fprintf (file, _(" -s (system) scan system-wide directories only\n")); + fprintf (file, _(" -y SYSROOT (sysroot) prepend SYSROOT to all paths for scanning\n")); + fprintf (file, _(" -v (verbose) display status information while busy\n")); + fprintf (file, _(" -V (version) display font config version and exit\n")); + fprintf (file, _(" -h (help) display this help and exit\n")); #endif exit (error); } @@ -151,7 +159,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force, if (FcStrSetMember (processed_dirs, dir)) { if (verbose) - printf ("skipping, looped directory detected\n"); + printf (_("skipping, looped directory detected\n")); continue; } @@ -161,7 +169,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force, case ENOENT: case ENOTDIR: if (verbose) - printf ("skipping, no such directory\n"); + printf (_("skipping, no such directory\n")); break; default: fprintf (stderr, "\"%s\": ", dir); @@ -174,7 +182,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force, if (!S_ISDIR (statb.st_mode)) { - fprintf (stderr, "\"%s\": not a directory, skipping\n", dir); + fprintf (stderr, _("\"%s\": not a directory, skipping\n"), dir); continue; } was_processed = FcTrue; @@ -196,7 +204,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force, cache = FcDirCacheRead (dir, FcTrue, config); if (!cache) { - fprintf (stderr, "%s: error scanning\n", dir); + fprintf (stderr, _("\"%s\": scanning error\n"), dir); ret++; continue; } @@ -205,18 +213,18 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force, if (was_valid) { if (verbose) - printf ("skipping, existing cache is valid: %d fonts, %d dirs\n", + printf (_("skipping, existing cache is valid: %d fonts, %d dirs\n"), FcCacheNumFont (cache), FcCacheNumSubdir (cache)); } else { if (verbose) - printf ("caching, new cache contents: %d fonts, %d dirs\n", + printf (_("caching, new cache contents: %d fonts, %d dirs\n"), FcCacheNumFont (cache), FcCacheNumSubdir (cache)); if (!FcDirCacheValid (dir)) { - fprintf (stderr, "%s: failed to write cache\n", dir); + fprintf (stderr, _("%s: failed to write cache\n"), dir); (void) FcDirCacheUnlink (dir, config); ret++; } @@ -225,7 +233,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force, subdirs = FcStrSetCreate (); if (!subdirs) { - fprintf (stderr, "%s: Can't create subdir set\n", dir); + fprintf (stderr, _("%s: Can't create subdir set\n"), dir); ret++; FcDirCacheUnload (cache); continue; @@ -239,7 +247,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force, FcStrSetDestroy (subdirs); if (!sublist) { - fprintf (stderr, "%s: Can't create subdir list\n", dir); + fprintf (stderr, _("%s: Can't create subdir list\n"), dir); ret++; continue; } @@ -314,7 +322,7 @@ main (int argc, char **argv) sysroot = FcStrCopy ((const FcChar8 *)optarg); break; case 'V': - fprintf (stderr, "fontconfig version %d.%d.%d\n", + fprintf (stderr, "fontconfig version %d.%d.%d\n", FC_MAJOR, FC_MINOR, FC_REVISION); exit (0); case 'v': @@ -345,7 +353,7 @@ main (int argc, char **argv) } if (!config) { - fprintf (stderr, "%s: Can't init font config library\n", argv[0]); + fprintf (stderr, _("%s: Can't initialize font config library\n"), argv[0]); return 1; } FcConfigSetCurrent (config); @@ -355,7 +363,7 @@ main (int argc, char **argv) dirs = FcStrSetCreate (); if (!dirs) { - fprintf (stderr, "%s: Can't create list of directories\n", + fprintf (stderr, _("%s: Can't create list of directories\n"), argv[0]); return 1; } @@ -363,7 +371,7 @@ main (int argc, char **argv) { if (!FcStrSetAddFilename (dirs, (FcChar8 *) argv[i])) { - fprintf (stderr, "%s: Can't add directory\n", argv[0]); + fprintf (stderr, _("%s: Can't add directory\n"), argv[0]); return 1; } i++; @@ -375,7 +383,7 @@ main (int argc, char **argv) list = FcConfigGetConfigDirs (config); if ((processed_dirs = FcStrSetCreate()) == NULL) { - fprintf(stderr, "Cannot malloc\n"); + fprintf(stderr, _("Out of Memory\n")); return 1; } @@ -407,6 +415,6 @@ main (int argc, char **argv) if (changed) sleep (2); if (verbose) - printf ("%s: %s\n", argv[0], ret ? "failed" : "succeeded"); + printf ("%s: %s\n", argv[0], ret ? _("failed") : _("succeeded")); return ret; } diff --git a/fc-cat/fc-cat.c b/fc-cat/fc-cat.c index a1dc848..dfe30d7 100644 --- a/fc-cat/fc-cat.c +++ b/fc-cat/fc-cat.c @@ -41,6 +41,14 @@ #include #include +#ifdef ENABLE_NLS +#include +#define _(x) (dgettext(GETTEXT_PACKAGE, x)) +#else +#define dgettext(d, s) (s) +#define _(x) (x) +#endif + #ifndef HAVE_GETOPT #define HAVE_GETOPT 0 #endif @@ -148,27 +156,27 @@ usage (char *program, int error) { FILE *file = error ? stderr : stdout; #if HAVE_GETOPT_LONG - fprintf (file, "usage: %s [-rv] [--recurse] [--verbose] [*-%s" FC_CACHE_SUFFIX "|directory]...\n", + fprintf (file, _("usage: %s [-rv] [--recurse] [--verbose] [*-%s" FC_CACHE_SUFFIX "|directory]...\n"), program, FC_ARCHITECTURE); fprintf (file, " %s [-Vh] [--version] [--help]\n", program); #else - fprintf (file, "usage: %s [-rvVh] [*-%s" FC_CACHE_SUFFIX "|directory]...\n", + fprintf (file, _("usage: %s [-rvVh] [*-%s" FC_CACHE_SUFFIX "|directory]...\n"), program, FC_ARCHITECTURE); #endif - fprintf (file, "Reads font information cache from:\n"); - fprintf (file, " 1) specified fontconfig cache file\n"); - fprintf (file, " 2) related to a particular font directory\n"); + fprintf (file, _("Reads font information cache from:\n")); + fprintf (file, _(" 1) specified fontconfig cache file\n")); + fprintf (file, _(" 2) related to a particular font directory\n")); fprintf (file, "\n"); #if HAVE_GETOPT_LONG - fprintf (file, " -r, --recurse recurse into subdirectories\n"); - fprintf (file, " -v, --verbose be verbose\n"); - fprintf (file, " -V, --version display font config version and exit\n"); - fprintf (file, " -h, --help display this help and exit\n"); + fprintf (file, _(" -r, --recurse recurse into subdirectories\n")); + fprintf (file, _(" -v, --verbose be verbose\n")); + fprintf (file, _(" -V, --version display font config version and exit\n")); + fprintf (file, _(" -h, --help display this help and exit\n")); #else - fprintf (file, " -r (recurse) recurse into subdirectories\n"); - fprintf (file, " -v (verbose) be verbose\n"); - fprintf (file, " -V (version) display font config version and exit\n"); - fprintf (file, " -h (help) display this help and exit\n"); + fprintf (file, _(" -r (recurse) recurse into subdirectories\n")); + fprintf (file, _(" -v (verbose) be verbose\n")); + fprintf (file, _(" -V (version) display font config version and exit\n")); + fprintf (file, _(" -h (help) display this help and exit\n")); #endif exit (error); } @@ -294,7 +302,7 @@ main (int argc, char **argv) config = FcInitLoadConfig (); if (!config) { - fprintf (stderr, "%s: Can't init font config library\n", argv[0]); + fprintf (stderr, _("%s: Can't initialize font config library\n"), argv[0]); return 1; } FcConfigSetCurrent (config); @@ -303,7 +311,7 @@ main (int argc, char **argv) args = FcStrSetCreate (); if (!args) { - fprintf (stderr, "%s: malloc failure\n", argv[0]); + fprintf (stderr, _("%s: malloc failure\n"), argv[0]); return 1; } if (i < argc) @@ -312,7 +320,7 @@ main (int argc, char **argv) { if (!FcStrSetAddFilename (args, (const FcChar8 *) argv[i])) { - fprintf (stderr, "%s: malloc failure\n", argv[0]); + fprintf (stderr, _("%s: malloc failure\n"), argv[0]); return 1; } } @@ -324,7 +332,7 @@ main (int argc, char **argv) while ((arg = FcStrListNext (arglist))) if (!FcStrSetAdd (args, arg)) { - fprintf (stderr, "%s: malloc failure\n", argv[0]); + fprintf (stderr, _("%s: malloc failure\n"), argv[0]); return 1; } FcStrListDone (arglist); @@ -332,7 +340,7 @@ main (int argc, char **argv) arglist = FcStrListCreate (args); if (!arglist) { - fprintf (stderr, "%s: malloc failure\n", argv[0]); + fprintf (stderr, _("%s: malloc failure\n"), argv[0]); return 1; } FcStrSetDestroy (args); @@ -372,7 +380,7 @@ main (int argc, char **argv) { if (!first) printf ("\n"); - printf ("Directory: %s\nCache: %s\n--------\n", + printf (_("Directory: %s\nCache: %s\n--------\n"), FcCacheDir(cache), cache_file ? cache_file : arg); first = FcFalse; } diff --git a/fc-conflist/Makefile.am b/fc-conflist/Makefile.am new file mode 100644 index 0000000..6938ca7 --- /dev/null +++ b/fc-conflist/Makefile.am @@ -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 diff --git a/fc-conflist/fc-conflist.c b/fc-conflist/fc-conflist.c new file mode 100644 index 0000000..d02273b --- /dev/null +++ b/fc-conflist/fc-conflist.c @@ -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 +#else +#ifdef linux +#define HAVE_GETOPT_LONG 1 +#endif +#define HAVE_GETOPT 1 +#endif + +#include +#include +#include +#include +#include + +#ifdef ENABLE_NLS +#include +#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 +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; +} diff --git a/fc-conflist/fc-conflist.sgml b/fc-conflist/fc-conflist.sgml new file mode 100644 index 0000000..a82dd1c --- /dev/null +++ b/fc-conflist/fc-conflist.sgml @@ -0,0 +1,135 @@ + 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. + + --> + + + Akira"> + TAGOH"> + + Apr 1, 2014"> + + 1"> + akira@tagoh.org"> + + fc-conflist"> + + + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2014 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + Show the ruleset files information on the system + + + + &dhpackage; + + + + + + + + + + DESCRIPTION + + &dhpackage; shows the ruleset files' information + being installed on the system. + + + + OPTIONS + + This program follows the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. + + + + + + + + Show version of the program and exit. + + + + + + + + Show summary of options. + + + + + + + RETURN CODES + fc-conflist returns error code 0 for successful parsing, + or 1 if any errors occured or if at least one font face could not be opened. + + + + AUTHOR + + This manual page was updated by &dhusername; &dhemail;. + + +
+ + diff --git a/fc-list/fc-list.c b/fc-list/fc-list.c index 95963e7..5cded50 100644 --- a/fc-list/fc-list.c +++ b/fc-list/fc-list.c @@ -36,6 +36,14 @@ #define HAVE_GETOPT 1 #endif +#ifdef ENABLE_NLS +#include +#define _(x) (dgettext(GETTEXT_PACKAGE, x)) +#else +#define dgettext(d, s) (s) +#define _(x) (x) +#endif + #ifndef HAVE_GETOPT #define HAVE_GETOPT 0 #endif @@ -68,28 +76,28 @@ usage (char *program, int error) { FILE *file = error ? stderr : stdout; #if HAVE_GETOPT_LONG - fprintf (file, "usage: %s [-vbqVh] [-f FORMAT] [--verbose] [--brief] [--format=FORMAT] [--quiet] [--version] [--help] [pattern] {element ...} \n", + fprintf (file, _("usage: %s [-vbqVh] [-f FORMAT] [--verbose] [--brief] [--format=FORMAT] [--quiet] [--version] [--help] [pattern] {element ...} \n"), program); #else - fprintf (file, "usage: %s [-vbqVh] [-f FORMAT] [pattern] {element ...} \n", + fprintf (file, _("usage: %s [-vbqVh] [-f FORMAT] [pattern] {element ...} \n"), program); #endif - fprintf (file, "List fonts matching [pattern]\n"); + fprintf (file, _("List fonts matching [pattern]\n")); fprintf (file, "\n"); #if HAVE_GETOPT_LONG - fprintf (file, " -v, --verbose display entire font pattern verbosely\n"); - fprintf (file, " -b, --brief display entire font pattern briefly\n"); - fprintf (file, " -f, --format=FORMAT use the given output format\n"); - fprintf (file, " -q, --quiet suppress all normal output, exit 1 if no fonts matched\n"); - fprintf (file, " -V, --version display font config version and exit\n"); - fprintf (file, " -h, --help display this help and exit\n"); + fprintf (file, _(" -v, --verbose display entire font pattern verbosely\n")); + fprintf (file, _(" -b, --brief display entire font pattern briefly\n")); + fprintf (file, _(" -f, --format=FORMAT use the given output format\n")); + fprintf (file, _(" -q, --quiet suppress all normal output, exit 1 if no fonts matched\n")); + fprintf (file, _(" -V, --version display font config version and exit\n")); + fprintf (file, _(" -h, --help display this help and exit\n")); #else - fprintf (file, " -v (verbose) display entire font pattern verbosely\n"); - fprintf (file, " -b (brief) display entire font pattern briefly\n"); - fprintf (file, " -f FORMAT (format) use the given output format\n"); - fprintf (file, " -q, (quiet) suppress all normal output, exit 1 if no fonts matched\n"); - fprintf (file, " -V (version) display font config version and exit\n"); - fprintf (file, " -h (help) display this help and exit\n"); + fprintf (file, _(" -v (verbose) display entire font pattern verbosely\n")); + fprintf (file, _(" -b (brief) display entire font pattern briefly\n")); + fprintf (file, _(" -f FORMAT (format) use the given output format\n")); + fprintf (file, _(" -q, (quiet) suppress all normal output, exit 1 if no fonts matched\n")); + fprintf (file, _(" -V (version) display font config version and exit\n")); + fprintf (file, _(" -h (help) display this help and exit\n")); #endif exit (error); } @@ -148,7 +156,7 @@ main (int argc, char **argv) pat = FcNameParse ((FcChar8 *) argv[i]); if (!pat) { - fputs ("Unable to parse the pattern\n", stderr); + fprintf (stderr, _("Unable to parse the pattern\n")); return 1; } while (argv[++i]) diff --git a/fc-match/fc-match.c b/fc-match/fc-match.c index 88f4ac8..7902707 100644 --- a/fc-match/fc-match.c +++ b/fc-match/fc-match.c @@ -37,6 +37,14 @@ #include #include +#ifdef ENABLE_NLS +#include +#define _(x) (dgettext(GETTEXT_PACKAGE, x)) +#else +#define dgettext(d, s) (s) +#define _(x) (x) +#endif + #ifndef HAVE_GETOPT #define HAVE_GETOPT 0 #endif @@ -70,30 +78,30 @@ usage (char *program, int error) { FILE *file = error ? stderr : stdout; #if HAVE_GETOPT_LONG - fprintf (file, "usage: %s [-savbVh] [-f FORMAT] [--sort] [--all] [--verbose] [--brief] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n", + fprintf (file, _("usage: %s [-savbVh] [-f FORMAT] [--sort] [--all] [--verbose] [--brief] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n"), program); #else - fprintf (file, "usage: %s [-savVh] [-f FORMAT] [pattern] {element...}\n", + fprintf (file, _("usage: %s [-savVh] [-f FORMAT] [pattern] {element...}\n"), program); #endif - fprintf (file, "List best font matching [pattern]\n"); + fprintf (file, _("List best font matching [pattern]\n")); fprintf (file, "\n"); #if HAVE_GETOPT_LONG - fprintf (file, " -s, --sort display sorted list of matches\n"); - fprintf (file, " -a, --all display unpruned sorted list of matches\n"); - fprintf (file, " -v, --verbose display entire font pattern verbosely\n"); - fprintf (file, " -b, --brief display entire font pattern briefly\n"); - fprintf (file, " -f, --format=FORMAT use the given output format\n"); - fprintf (file, " -V, --version display font config version and exit\n"); - fprintf (file, " -h, --help display this help and exit\n"); + fprintf (file, _(" -s, --sort display sorted list of matches\n")); + fprintf (file, _(" -a, --all display unpruned sorted list of matches\n")); + fprintf (file, _(" -v, --verbose display entire font pattern verbosely\n")); + fprintf (file, _(" -b, --brief display entire font pattern briefly\n")); + fprintf (file, _(" -f, --format=FORMAT use the given output format\n")); + fprintf (file, _(" -V, --version display font config version and exit\n")); + fprintf (file, _(" -h, --help display this help and exit\n")); #else - fprintf (file, " -s, (sort) display sorted list of matches\n"); - fprintf (file, " -a (all) display unpruned sorted list of matches\n"); - fprintf (file, " -v (verbose) display entire font pattern verbosely\n"); - fprintf (file, " -b (brief) display entire font pattern briefly\n"); - fprintf (file, " -f FORMAT (format) use the given output format\n"); - fprintf (file, " -V (version) display font config version and exit\n"); - fprintf (file, " -h (help) display this help and exit\n"); + fprintf (file, _(" -s, (sort) display sorted list of matches\n")); + fprintf (file, _(" -a (all) display unpruned sorted list of matches\n")); + fprintf (file, _(" -v (verbose) display entire font pattern verbosely\n")); + fprintf (file, _(" -b (brief) display entire font pattern briefly\n")); + fprintf (file, _(" -f FORMAT (format) use the given output format\n")); + fprintf (file, _(" -V (version) display font config version and exit\n")); + fprintf (file, _(" -h (help) display this help and exit\n")); #endif exit (error); } @@ -155,7 +163,7 @@ main (int argc, char **argv) pat = FcNameParse ((FcChar8 *) argv[i]); if (!pat) { - fputs ("Unable to parse the pattern\n", stderr); + fprintf (stderr, _("Unable to parse the pattern\n")); return 1; } while (argv[++i]) @@ -184,7 +192,7 @@ main (int argc, char **argv) if (!font_patterns || font_patterns->nfont == 0) { - fputs("No fonts installed on the system\n", stderr); + fprintf (stderr, _("No fonts installed on the system\n")); return 1; } for (j = 0; j < font_patterns->nfont; j++) diff --git a/fc-pattern/fc-pattern.c b/fc-pattern/fc-pattern.c index d2279cb..37c5ccf 100644 --- a/fc-pattern/fc-pattern.c +++ b/fc-pattern/fc-pattern.c @@ -37,6 +37,14 @@ #include #include +#ifdef ENABLE_NLS +#include +#define _(x) (dgettext(GETTEXT_PACKAGE, x)) +#else +#define dgettext(d, s) (s) +#define _(x) (x) +#endif + #ifndef HAVE_GETOPT #define HAVE_GETOPT 0 #endif @@ -68,26 +76,26 @@ usage (char *program, int error) { FILE *file = error ? stderr : stdout; #if HAVE_GETOPT_LONG - fprintf (file, "usage: %s [-cdVh] [-f FORMAT] [--config] [--default] [--verbose] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n", + fprintf (file, _("usage: %s [-cdVh] [-f FORMAT] [--config] [--default] [--verbose] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n"), program); #else - fprintf (file, "usage: %s [-cdVh] [-f FORMAT] [pattern] {element...}\n", + fprintf (file, _("usage: %s [-cdVh] [-f FORMAT] [pattern] {element...}\n"), program); #endif - fprintf (file, "List best font matching [pattern]\n"); + fprintf (file, _("List best font matching [pattern]\n")); fprintf (file, "\n"); #if HAVE_GETOPT_LONG - fprintf (file, " -c, --config perform config substitution on pattern\n"); - fprintf (file, " -d, -default perform default substitution on pattern\n"); - fprintf (file, " -f, --format=FORMAT use the given output format\n"); - fprintf (file, " -V, --version display font config version and exit\n"); - fprintf (file, " -h, --help display this help and exit\n"); + fprintf (file, _(" -c, --config perform config substitution on pattern\n")); + fprintf (file, _(" -d, -default perform default substitution on pattern\n")); + fprintf (file, _(" -f, --format=FORMAT use the given output format\n")); + fprintf (file, _(" -V, --version display font config version and exit\n")); + fprintf (file, _(" -h, --help display this help and exit\n")); #else - fprintf (file, " -c, (config) perform config substitution on pattern\n"); - fprintf (file, " -d, (default) perform default substitution on pattern\n"); - fprintf (file, " -f FORMAT (format) use the given output format\n"); - fprintf (file, " -V (version) display font config version and exit\n"); - fprintf (file, " -h (help) display this help and exit\n"); + fprintf (file, _(" -c, (config) perform config substitution on pattern\n")); + fprintf (file, _(" -d, (default) perform default substitution on pattern\n")); + fprintf (file, _(" -f FORMAT (format) use the given output format\n")); + fprintf (file, _(" -V (version) display font config version and exit\n")); + fprintf (file, _(" -h (help) display this help and exit\n")); #endif exit (error); } @@ -139,7 +147,7 @@ main (int argc, char **argv) pat = FcNameParse ((FcChar8 *) argv[i]); if (!pat) { - fputs ("Unable to parse the pattern\n", stderr); + fprintf (stderr, _("Unable to parse the pattern\n")); return 1; } while (argv[++i]) diff --git a/fc-query/fc-query.c b/fc-query/fc-query.c index 8a96da0..9da090d 100644 --- a/fc-query/fc-query.c +++ b/fc-query/fc-query.c @@ -40,6 +40,14 @@ #include #include +#ifdef ENABLE_NLS +#include +#define _(x) (dgettext(GETTEXT_PACKAGE, x)) +#else +#define dgettext(d, s) (s) +#define _(x) (x) +#endif + #ifndef HAVE_GETOPT #define HAVE_GETOPT 0 #endif @@ -71,26 +79,26 @@ usage (char *program, int error) { FILE *file = error ? stderr : stdout; #if HAVE_GETOPT_LONG - fprintf (file, "usage: %s [-bVh] [-i index] [-f FORMAT] [--index index] [--brief] [--format FORMAT] [--version] [--help] font-file...\n", + fprintf (file, _("usage: %s [-bVh] [-i index] [-f FORMAT] [--index index] [--brief] [--format FORMAT] [--version] [--help] font-file...\n"), program); #else - fprintf (file, "usage: %s [-bVh] [-i index] [-f FORMAT] font-file...\n", + fprintf (file, _("usage: %s [-bVh] [-i index] [-f FORMAT] font-file...\n"), program); #endif - fprintf (file, "Query font files and print resulting pattern(s)\n"); + fprintf (file, _("Query font files and print resulting pattern(s)\n")); fprintf (file, "\n"); #if HAVE_GETOPT_LONG - fprintf (file, " -i, --index INDEX display the INDEX face of each font file only\n"); - fprintf (file, " -b, --brief display font pattern briefly\n"); - fprintf (file, " -f, --format=FORMAT use the given output format\n"); - fprintf (file, " -V, --version display font config version and exit\n"); - fprintf (file, " -h, --help display this help and exit\n"); + fprintf (file, _(" -i, --index INDEX display the INDEX face of each font file only\n")); + fprintf (file, _(" -b, --brief display font pattern briefly\n")); + fprintf (file, _(" -f, --format=FORMAT use the given output format\n")); + fprintf (file, _(" -V, --version display font config version and exit\n")); + fprintf (file, _(" -h, --help display this help and exit\n")); #else - fprintf (file, " -i INDEX (index) display the INDEX face of each font file only\n"); - fprintf (file, " -b (brief) display font pattern briefly\n"); - fprintf (file, " -f FORMAT (format) use the given output format\n"); - fprintf (file, " -V (version) display font config version and exit\n"); - fprintf (file, " -h (help) display this help and exit\n"); + fprintf (file, _(" -i INDEX (index) display the INDEX face of each font file only\n")); + fprintf (file, _(" -b (brief) display font pattern briefly\n")); + fprintf (file, _(" -f FORMAT (format) use the given output format\n")); + fprintf (file, _(" -V (version) display font config version and exit\n")); + fprintf (file, _(" -h (help) display this help and exit\n")); #endif exit (error); } @@ -147,7 +155,7 @@ main (int argc, char **argv) { if (!FcFreeTypeQueryAll ((FcChar8*) argv[i], id, NULL, NULL, fs)) { - fprintf (stderr, "Can't query face %u of font file %s\n", id, argv[i]); + fprintf (stderr, _("Can't query face %u of font file %s\n"), id, argv[i]); err = 1; } } diff --git a/fc-scan/fc-scan.c b/fc-scan/fc-scan.c index 41bd260..edb967c 100644 --- a/fc-scan/fc-scan.c +++ b/fc-scan/fc-scan.c @@ -40,6 +40,14 @@ #include #include +#ifdef ENABLE_NLS +#include +#define _(x) (dgettext(GETTEXT_PACKAGE, x)) +#else +#define dgettext(d, s) (s) +#define _(x) (x) +#endif + #ifndef HAVE_GETOPT #define HAVE_GETOPT 0 #endif @@ -70,24 +78,24 @@ usage (char *program, int error) { FILE *file = error ? stderr : stdout; #if HAVE_GETOPT_LONG - fprintf (file, "usage: %s [-bVh] [-f FORMAT] [--brief] [--format FORMAT] [--version] [--help] font-file...\n", + fprintf (file, _("usage: %s [-bVh] [-f FORMAT] [--brief] [--format FORMAT] [--version] [--help] font-file...\n"), program); #else - fprintf (file, "usage: %s [-bVh] [-f FORMAT] font-file...\n", + fprintf (file, _("usage: %s [-bVh] [-f FORMAT] font-file...\n"), program); #endif - fprintf (file, "Scan font files and directories, and print resulting pattern(s)\n"); + fprintf (file, _("Scan font files and directories, and print resulting pattern(s)\n")); fprintf (file, "\n"); #if HAVE_GETOPT_LONG - fprintf (file, " -b, --brief display font pattern briefly\n"); - fprintf (file, " -f, --format=FORMAT use the given output format\n"); - fprintf (file, " -V, --version display font config version and exit\n"); - fprintf (file, " -h, --help display this help and exit\n"); + fprintf (file, _(" -b, --brief display font pattern briefly\n")); + fprintf (file, _(" -f, --format=FORMAT use the given output format\n")); + fprintf (file, _(" -V, --version display font config version and exit\n")); + fprintf (file, _(" -h, --help display this help and exit\n")); #else - fprintf (file, " -b (brief) display font pattern briefly\n"); - fprintf (file, " -f FORMAT (format) use the given output format\n"); - fprintf (file, " -V (version) display font config version and exit\n"); - fprintf (file, " -h (help) display this help and exit\n"); + fprintf (file, _(" -b (brief) display font pattern briefly\n")); + fprintf (file, _(" -f FORMAT (format) use the given output format\n")); + fprintf (file, _(" -V (version) display font config version and exit\n")); + fprintf (file, _(" -h (help) display this help and exit\n")); #endif exit (error); } diff --git a/fc-validate/Makefile.am b/fc-validate/Makefile.am index 782cead..c485aa5 100644 --- a/fc-validate/Makefile.am +++ b/fc-validate/Makefile.am @@ -1,5 +1,5 @@ # -# fontconfig/fc-query/Makefile.am +# fontconfig/fc-validate/Makefile.am # # Copyright © 2003 Keith Packard # diff --git a/fc-validate/fc-validate.c b/fc-validate/fc-validate.c index 6ecff36..2ceee20 100644 --- a/fc-validate/fc-validate.c +++ b/fc-validate/fc-validate.c @@ -41,6 +41,14 @@ #include #include +#ifdef ENABLE_NLS +#include +#define _(x) (dgettext(GETTEXT_PACKAGE, x)) +#else +#define dgettext(d, s) (s) +#define _(x) (x) +#endif + #ifndef HAVE_GETOPT #define HAVE_GETOPT 0 #endif @@ -72,26 +80,26 @@ usage (char *program, int error) { FILE *file = error ? stderr : stdout; #if HAVE_GETOPT_LONG - fprintf (file, "usage: %s [-Vhv] [-i index] [-l LANG] [--index index] [--lang LANG] [--verbose] [--version] [--help] font-file...\n", + fprintf (file, _("usage: %s [-Vhv] [-i index] [-l LANG] [--index index] [--lang LANG] [--verbose] [--version] [--help] font-file...\n"), program); #else - fprintf (file, "usage: %s [-Vhv] [-i index] [-l LANG] font-file...\n", + fprintf (file, _("usage: %s [-Vhv] [-i index] [-l LANG] font-file...\n"), program); #endif - fprintf (file, "Validate font files and print result\n"); + fprintf (file, _("Validate font files and print result\n")); fprintf (file, "\n"); #if HAVE_GETOPT_LONG - fprintf (file, " -i, --index INDEX display the INDEX face of each font file only\n"); - fprintf (file, " -l, --lang=LANG set LANG instead of current locale\n"); - fprintf (file, " -v, --verbose show more detailed information\n"); - fprintf (file, " -V, --version display font config version and exit\n"); - fprintf (file, " -h, --help display this help and exit\n"); + fprintf (file, _(" -i, --index INDEX display the INDEX face of each font file only\n")); + fprintf (file, _(" -l, --lang=LANG set LANG instead of current locale\n")); + fprintf (file, _(" -v, --verbose show more detailed information\n")); + fprintf (file, _(" -V, --version display font config version and exit\n")); + fprintf (file, _(" -h, --help display this help and exit\n")); #else - fprintf (file, " -i INDEX (index) display the INDEX face of each font file only\n"); - fprintf (file, " -l LANG (lang) set LANG instead of current locale\n"); - fprintf (file, " -v (verbose) show more detailed information\n"); - fprintf (file, " -V (version) display font config version and exit\n"); - fprintf (file, " -h (help) display this help and exit\n"); + fprintf (file, _(" -i INDEX (index) display the INDEX face of each font file only\n")); + fprintf (file, _(" -l LANG (lang) set LANG instead of current locale\n")); + fprintf (file, _(" -v (verbose) show more detailed information\n")); + fprintf (file, _(" -V (version) display font config version and exit\n")); + fprintf (file, _(" -h (help) display this help and exit\n")); #endif exit (error); } @@ -156,7 +164,7 @@ main (int argc, char **argv) if (FT_Init_FreeType (&ftlib)) { - fprintf (stderr, "Can't initalize FreeType library\n"); + fprintf (stderr, _("Can't initalize FreeType library\n")); return 1; } @@ -174,7 +182,7 @@ main (int argc, char **argv) { if (!index_set && index > 0) break; - fprintf (stderr, "Unable to open %s\n", argv[i]); + fprintf (stderr, _("Unable to open %s\n"), argv[i]); err = 1; } else @@ -189,7 +197,7 @@ main (int argc, char **argv) { FcChar32 ucs4, pos, map[FC_CHARSET_MAP_SIZE]; - printf ("%s:%d Missing %d glyph(s) to satisfy the coverage for %s language\n", + printf (_("%s:%d Missing %d glyph(s) to satisfy the coverage for %s language\n"), argv[i], index, count, lang); if (verbose) @@ -219,7 +227,7 @@ main (int argc, char **argv) } else { - printf ("%s:%d Satisfy the coverage for %s language\n", argv[i], index, lang); + printf (_("%s:%d Satisfy the coverage for %s language\n"), argv[i], index, lang); } FcCharSetDestroy (fcs); diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h index 4d90279..6ceabc3 100644 --- a/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig.h @@ -280,7 +280,9 @@ typedef struct _FcObjectSet { } FcObjectSet; typedef enum _FcMatchKind { - FcMatchPattern, FcMatchFont, FcMatchScan + FcMatchPattern, FcMatchFont, FcMatchScan, + FcMatchKindEnd, + FcMatchKindBegin = FcMatchPattern } FcMatchKind; typedef enum _FcLangResult { @@ -295,6 +297,12 @@ typedef enum _FcSetName { FcSetApplication = 1 } FcSetName; +typedef struct _FcConfigFileInfoIter { + void *dummy1; + void *dummy2; + void *dummy3; +} FcConfigFileInfoIter; + typedef struct _FcAtomic FcAtomic; #if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */ @@ -451,6 +459,21 @@ FcPublic void FcConfigSetSysRoot (FcConfig *config, const FcChar8 *sysroot); +FcPublic void +FcConfigFileInfoIterInit (FcConfig *config, + FcConfigFileInfoIter *iter); + +FcPublic FcBool +FcConfigFileInfoIterNext (FcConfig *config, + FcConfigFileInfoIter *iter); + +FcPublic FcBool +FcConfigFileInfoIterGet (FcConfig *config, + FcConfigFileInfoIter *iter, + FcChar8 **name, + FcChar8 **description, + FcBool *enabled); + /* fccharset.c */ FcPublic FcCharSet* FcCharSetCreate (void); diff --git a/fonts.conf.in b/fonts.conf.in index 7c16a70..2019923 100644 --- a/fonts.conf.in +++ b/fonts.conf.in @@ -2,6 +2,11 @@ + + + + + Default configuration file + + + + + local customizations