[PATCH:font/util] Add several new XORG_FONT* macros to replace code common to many font modules

Peter Hutterer peter.hutterer at who-t.net
Tue Oct 6 02:05:17 PDT 2009


On Mon, Oct 05, 2009 at 07:51:35PM -0700, Alan Coopersmith wrote:
> XORG_FONT_REQUIRED_PROG(VARNAME, progname)
> XORG_FONT_FCCACHE()
> XORG_FONT_COMMON_UTILS()
> XORG_FONT_BDF_UTILS()
> XORG_FONT_SCALED_UTILS()
> XORG_FONT_CHECK_COMPRESSION()
> XORG_FONTDIR(subdir)
> 
> Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
> ---
>  fontutil.m4 |  123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 123 insertions(+), 0 deletions(-)
> 
> diff --git a/fontutil.m4 b/fontutil.m4
> index 3d22990..23f861b 100644
> --- a/fontutil.m4
> +++ b/fontutil.m4
> @@ -225,3 +225,126 @@ AC_DEFUN([XORG_FONT_CHECK_KOI8_R],[
>  	AC_MSG_RESULT([$KOI8_R])
>  	AM_CONDITIONAL(KOI8_R, [test "x$KOI8_R" = xyes])
>  ])
> +
> +# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
> +# ------------------------------------------
> +# Minimum version: 1.1.0

shouldn't you bump configure.ac as well or are you doing it as a separate
commit? Or do you have any other changes queued up?
just those three patches applied would result in failures if configure isn't
bumped, no?

other than that, looks sane enough to me
Acked-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
  Peter

> +#
> +# Simple wrapper around AC_PATH_PROG that errors if not found
> +#
> +
> +AC_DEFUN([XORG_FONT_REQUIRED_PROG],[
> +	AC_PATH_PROG($1, $2)
> +	if test x"$1" = x; then
> +		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
> +	fi
> +])
> +
> +
> +# XORG_FONT_FCCACHE()
> +# ------------------------------------------
> +# Minimum version: 1.1.0
> +#
> +# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
> +# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
> +# to run fc-cache if found and not installing to $DESTDIR
> +#
> +# fc-cache is optional, not required, and should be skipped when making
> +# packages (installing to $DESTDIR).
> +#
> +AC_DEFUN([XORG_FONT_FCCACHE],[
> +	AC_PATH_PROG(FCCACHE, fc-cache)
> +	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
> +	if test x"$FCCACHE" = x ; then
> +		RUN_FCCACHE="${FCCACHE_WARN}"
> +	else
> +		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
> +		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
> +	fi
> +	AC_SUBST([RUN_FCCACHE])
> +])
> +
> +
> +# XORG_FONT_COMMON_UTILS()
> +# ------------------------------------------
> +# Minimum version: 1.1.0
> +#
> +# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
> +
> +AC_DEFUN([XORG_FONT_COMMON_UTILS],[
> +	XORG_FONT_FCCACHE
> +	XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
> +])
> +
> +# XORG_FONT_BDF_UTILS()
> +# ------------------------------------------
> +# Minimum version: 1.1.0
> +#
> +# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
> +# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
> +# PCF output files created by bdftopcf
> +
> +AC_DEFUN([XORG_FONT_BDF_UTILS],[
> +	XORG_FONT_COMMON_UTILS
> +	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
> +	XORG_FONT_CHECK_COMPRESSION
> +])
> +
> +# XORG_FONT_SCALED_UTILS()
> +# ------------------------------------------
> +# Minimum version: 1.1.0
> +#
> +# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
> +# (TrueType, OpenType, Type1)
> +
> +AC_DEFUN([XORG_FONT_SCALED_UTILS],[
> +	XORG_FONT_COMMON_UTILS
> +	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
> +])
> +
> +# XORG_FONT_CHECK_COMPRESSION()
> +# ------------------------------------------
> +# Minimum version: 1.1.0
> +#
> +# Offer a --with-compression flag to control what compression method is
> +# used for pcf font files.   Offers all the methods currently supported
> +# by libXfont, including no compression.
> +
> +AC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
> +	AC_ARG_WITH(compression,
> +	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
> +			 [compression method to use on pcf fonts])],
> +         [compression="$withval"], [compression="yes"])
> +	if test x"$compression" = "xyes" ; then
> +		compression="gzip"
> +	fi
> +	case $compression in
> +	 *compress)	COMPRESS_SUFFIX=".Z" ;;
> +	 *gzip)		COMPRESS_SUFFIX=".gz" ;;
> +	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
> +	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
> +	 *) AC_MSG_ERROR([$compress is not a supported compression method]) ;;
> +	esac
> +	if test x"$COMPRESS_SUFFIX" != "x" ; then
> +	   XORG_FONT_REQUIRED_PROG(COMPRESS, $compression)
> +	fi
> +	AC_SUBST([COMPRESS_SUFFIX])
> +])
> +
> +
> +# XORG_FONTDIR(subdir)
> +# ------------------------------------------
> +# Minimum version: 1.1.0
> +#
> +# Offer a --with-fontdir flag to control directory for font installation
> +# Default is the specified subdir of ${libdir}/X11/fonts
> +
> +AC_DEFUN([XORG_FONTDIR],[
> +	fontdir="${libdir}/X11/fonts/$1"
> +	AC_ARG_WITH(fontdir,
> +		    AS_HELP_STRING([--with-fontdir=<pathname>],
> +				   [Path to install fonts]),
> +		    [fontdir="$withval"])
> +	FONTDIR="$fontdir"
> +	AC_SUBST(FONTDIR)
> +])
> -- 
> 1.5.6.5
 


More information about the xorg-devel mailing list