Update to mkfontscale 1.1.2

This commit is contained in:
matthieu 2015-01-25 11:31:45 +00:00
parent e0507257d8
commit b83e437bff
11 changed files with 627 additions and 468 deletions

View File

@ -1,3 +1,118 @@
commit 87d628f8eec170ec13bb9feefb1ce05aed07d1d6
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Jan 16 23:40:40 2015 -0800
mkfontscale 1.1.2
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 47908fd7a0d061fdcd21e3498da4e223ca9136d9
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Jun 20 23:23:54 2014 -0700
Remove extraneous duplicate checks for -r & -n options
Flagged by cppcheck 1.65:
[mkfontscale.c:247]: (style) Expression is always false because
'else if' condition matches previous condition at line 224.
[mkfontscale.c:245]: (style) Expression is always false because
'else if' condition matches previous condition at line 227.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
commit 48e541dc2f2fc3f4e99d3e168c28241ff5adff4d
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Mon Jun 2 19:39:49 2014 -0700
autogen.sh: Honor NOCONFIGURE=1
See http://people.gnome.org/~walters/docs/build-api.txt
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit f14019d598c215e09cff88c739bbf7f4d6c6b89f
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Mon Jun 2 19:39:49 2014 -0700
configure: Drop AM_MAINTAINER_MODE
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 399db42a151687f1181ae23d28a76d31125a2853
Author: Thomas Klausner <wiz@NetBSD.org>
Date: Tue Mar 18 23:14:47 2014 +0100
Only include config.h if it exists.
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
commit eac564e0fc9052a39981ea47b271f7f3d2821944
Author: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Thu Jan 2 00:43:14 2014 -0800
Fix possible malloc allocation error found by clang static analysis
list.c:238:23: warning: Call to 'malloc' has an allocation size of 0 bytes
ListPtr *sorted = malloc(l * sizeof(ListPtr));
^~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
commit 423ffbe9c5552dfeffa81bb6e2f2b62ab6b17580
Author: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Thu Jan 2 00:39:25 2014 -0800
Plug a memory leak found by clang static analysis
mkfontscale.c:635:25: warning: Potential leak of memory pointed to by 'notice'
foundry = notice_foundry(notice);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
mkfontscale.c:640:8: warning: Potential leak of memory pointed to by 'notice'
if(strcmp(slant, "i") == 0) {
^~~~~~
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
commit 880a0c4733e62e54e6a0f1238c7430727d23657b
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Nov 8 23:48:28 2013 -0800
Print which option was in error along with usage message
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
commit 26c89de6cdf0a5b7122a630a5df37fd67a4163e2
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Nov 8 23:28:16 2013 -0800
Make usage() always exit(1)
Avoid duplicating exit(1) calls after every single call to usage()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
commit 43ab9b11699acadbf09b8ed050a7a2f7e630dce4
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Nov 8 23:21:32 2013 -0800
Add -v flag to print program version
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
commit e5788db7f179bf89d2e5e3c97c69058027cb93bd
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Nov 8 22:56:02 2013 -0800
Add missing newline to usage output
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
commit f48de13423c7300f4da9f61993b624426b38ddc0
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Tue Jul 16 22:50:54 2013 -0700

View File

@ -75,8 +75,8 @@ bin_PROGRAMS = mkfontscale$(EXEEXT)
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
compile config.guess config.sub depcomp install-sh missing
$(top_srcdir)/configure COPYING ChangeLog INSTALL NEWS compile \
config.guess config.sub depcomp install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -232,7 +232,6 @@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LINT = @LINT@
LINT_FLAGS = @LINT_FLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
@ -336,7 +335,7 @@ all: config.h
.SUFFIXES: .c .o .obj
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -363,9 +362,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
@ -376,7 +375,7 @@ config.h: stamp-h1
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(srcdir)/config.h.in: $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@

View File

@ -799,44 +799,6 @@ fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_MAINTAINER_MODE([DEFAULT-MODE])
# ----------------------------------
# Control maintainer-specific portions of Makefiles.
# Default is to disable them, unless 'enable' is passed literally.
# For symmetry, 'disable' may be passed as well. Anyway, the user
# can override the default with the --enable/--disable switch.
AC_DEFUN([AM_MAINTAINER_MODE],
[m4_case(m4_default([$1], [disable]),
[enable], [m4_define([am_maintainer_other], [disable])],
[disable], [m4_define([am_maintainer_other], [enable])],
[m4_define([am_maintainer_other], [enable])
m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode's default is 'disable' unless 'enable' is passed
AC_ARG_ENABLE([maintainer-mode],
[AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
am_maintainer_other[ make rules and dependencies not useful
(and sometimes confusing) to the casual installer])],
[USE_MAINTAINER_MODE=$enableval],
[USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST([MAINT])dnl
]
)
AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2012 Free Software Foundation, Inc.
@ -1279,7 +1241,7 @@ dnl DEALINGS IN THE SOFTWARE.
# See the "minimum version" comment for each macro you use to see what
# version you require.
m4_defun([XORG_MACROS_VERSION],[
m4_define([vers_have], [1.16.2])
m4_define([vers_have], [1.19.0])
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,,
@ -1329,6 +1291,7 @@ if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
AC_MSG_RESULT([no])
else
if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
TRADITIONALCPPFLAGS="-traditional"
RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
AC_MSG_RESULT([yes])
else
@ -1337,6 +1300,7 @@ else
fi
rm -f conftest.$ac_ext
AC_SUBST(RAWCPPFLAGS)
AC_SUBST(TRADITIONALCPPFLAGS)
]) # XORG_PROG_RAWCPP
# XORG_MANPAGE_SECTIONS()
@ -1861,9 +1825,10 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
]) # XORG_WITH_ASCIIDOC
# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
# --------------------------------
# -------------------------------------------
# Minimum version: 1.5.0
# Minimum version for optional DEFAULT argument: 1.11.0
# Minimum version for optional DOT checking: 1.18.0
#
# Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the
@ -1883,6 +1848,7 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
#
AC_DEFUN([XORG_WITH_DOXYGEN],[
AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
AC_ARG_VAR([DOT], [Path to the dot graphics utility])
m4_define([_defopt], m4_default([$2], [auto]))
AC_ARG_WITH(doxygen,
AS_HELP_STRING([--with-doxygen],
@ -1926,6 +1892,20 @@ m4_ifval([$1],
AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
fi])
fi])
dnl Check for DOT if we have doxygen. The caller decides if it is mandatory
dnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
dnl HAVE_DOT = @HAVE_DOT@
HAVE_DOT=no
if test "x$have_doxygen" = "xyes"; then
AC_PATH_PROG([DOT], [dot])
if test "x$DOT" != "x"; then
HAVE_DOT=yes
fi
fi
AC_SUBST([HAVE_DOT])
AM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
]) # XORG_WITH_DOXYGEN
@ -2108,6 +2088,29 @@ fi])
AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
]) # XORG_WITH_FOP
# XORG_WITH_M4([MIN-VERSION])
# ---------------------------
# Minimum version: 1.19.0
#
# This macro attempts to locate an m4 macro processor which supports
# -I option and is only useful for modules relying on M4 in order to
# expand macros in source code files.
#
# Interface to module:
# M4: returns the path of the m4 program found
# returns the path set by the user in the environment
#
AC_DEFUN([XORG_WITH_M4], [
AC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
[AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
[[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
[AC_MSG_ERROR([could not find m4 that supports -I option])],
[$PATH:/usr/gnu/bin])])
AC_SUBST([M4], [$ac_cv_path_M4])
]) # XORG_WITH_M4
# XORG_WITH_PS2PDF([DEFAULT])
# ----------------
# Minimum version: 1.6.0
@ -2562,7 +2565,8 @@ AC_ARG_ENABLE(malloc0returnsnull,
AC_MSG_CHECKING([whether malloc(0) returns NULL])
if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
AC_RUN_IFELSE([AC_LANG_PROGRAM([
AC_CACHE_VAL([xorg_cv_malloc0_returns_null],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([
#include <stdlib.h>
],[
char *m0, *r0, *c0, *p;
@ -2572,9 +2576,9 @@ if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
c0 = calloc(0,10);
exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
])],
[MALLOC_ZERO_RETURNS_NULL=yes],
[MALLOC_ZERO_RETURNS_NULL=no],
[MALLOC_ZERO_RETURNS_NULL=yes])
[xorg_cv_malloc0_returns_null=yes],
[xorg_cv_malloc0_returns_null=no])])
MALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
fi
AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
@ -2785,18 +2789,18 @@ fi
found="no"
m4_foreach([flag], m4_cdr($@), [
if test $found = "no" ; then
if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
fi
if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
fi
PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
AC_MSG_CHECKING([if ]COMPILER[ supports]flag[])
AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
AC_CACHE_VAL($cacheid,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
@ -2863,7 +2867,7 @@ AC_LANG_CASE(
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
]
)
@ -2872,16 +2876,17 @@ AC_LANG_CASE(
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
# These are currently disabled because they are noisy. They will be enabled
# in the future once the codebase is sufficiently modernized to silence
# them. For now, I don't want them to drown out the other warnings.
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
# Turn some warnings into errors, so we don't accidently get successful builds
# when there are problems that should be fixed.

View File

@ -3,7 +3,7 @@
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@ dnl Process this file with autoconf to create configure.
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([mkfontscale], [1.1.1],
AC_INIT([mkfontscale], [1.1.2],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[mkfontscale])
AC_CONFIG_SRCDIR([Makefile.am])
@ -31,7 +31,6 @@ AC_USE_SYSTEM_EXTENSIONS
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
m4_ifndef([XORG_MACROS_VERSION],
@ -54,7 +53,7 @@ fi
# Checks for pkg-config packages
PKG_CHECK_MODULES(MKFONTSCALE, fontenc freetype2)
PKG_CHECK_MODULES(X11, xproto)
PKG_CHECK_MODULES(X11, [xproto >= 7.0.25])
dnl Allow checking code with lint, sparse, etc.
XORG_WITH_LINT

View File

@ -20,7 +20,9 @@
THE SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>

View File

@ -235,7 +235,12 @@ sortList(ListPtr old)
int i;
int l = listLength(old);
ListPtr n;
ListPtr *sorted = malloc(l * sizeof(ListPtr));
ListPtr *sorted;
if (l <= 0)
return old;
sorted = malloc(l * sizeof(ListPtr));
if (sorted == NULL)
return old;

View File

@ -155,7 +155,6 @@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LINT = @LINT@
LINT_FLAGS = @LINT_FLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
@ -244,7 +243,7 @@ all: all-am
.SUFFIXES:
.SUFFIXES: .$(APP_MAN_SUFFIX) .man
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -269,9 +268,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-appmanDATA: $(appman_DATA)

View File

@ -38,6 +38,8 @@ mkfontscale \- create an index of scalable font files for X
] [
.B \-u | \-U
] [
.B \-v
] [
.B \-\-
] [
.I directory
@ -132,6 +134,9 @@ is useful when generating encoding directories only.
disable (\fI-u\fP) or enable (\fI-U\fP) indexing of ISO 10646:1 font
encodings (default: enabled).
.TP
.B \-v
print program version and exit.
.TP
.B \-\-
end of options.
.SH SEE ALSO

View File

@ -20,7 +20,9 @@
THE SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
@ -34,6 +36,7 @@
#include <ctype.h>
#include <X11/Xos.h>
#include <X11/Xfuncproto.h>
#include <X11/fonts/fontenc.h>
#include <ft2build.h>
#include FT_FREETYPE_H
@ -112,15 +115,24 @@ static ListPtr encodingsToDo;
static int reencodeLegacy;
static char *encodingPrefix;
static char *exclusionSuffix;
static char *ProgramName;
static void
static void _X_NORETURN _X_COLD
usage(void)
{
fprintf(stderr,
fprintf(stderr, "Usage:\n"
"mkfontscale [ -b ] [ -s ] [ -o filename ] [-x suffix ]\n"
" [ -a encoding ] [ -f fuzz ] [ -l ] "
" [ -a encoding ] [ -f fuzz ] [ -l ]\n"
" [ -e directory ] [ -p prefix ] [ -n ] [ -r ] \n"
" [-u] [-U] [ directory ]...\n");
" [-u] [-U] [-v] [ directory ]...\n");
exit(1);
}
static void _X_NORETURN _X_COLD
missing_arg (const char *option)
{
fprintf(stderr, "%s: %s requires an argument\n", ProgramName, option);
usage();
}
int
@ -131,6 +143,7 @@ main(int argc, char **argv)
int rc, ll = 0;
char prefix[NPREFIX];
ProgramName = argv[0];
encodingPrefix = NULL;
exclusionSuffix = NULL;
@ -166,34 +179,31 @@ main(int argc, char **argv)
break;
} else if (strcmp(argv[argn], "-x") == 0) {
if(argn >= argc - 1) {
usage();
exit(1);
missing_arg("-x");
}
exclusionSuffix = argv[argn + 1];
argn += 2;
} else if(strcmp(argv[argn], "-a") == 0) {
if(argn >= argc - 1) {
usage();
exit(1);
missing_arg("-a");
}
makeList(&argv[argn + 1], 1, encodings, 0);
argn += 2;
} else if(strcmp(argv[argn], "-p") == 0) {
if(argn >= argc - 1) {
usage();
exit(1);
missing_arg("-p");
}
if(strlen(argv[argn + 1]) > NPREFIX - 1) {
fprintf(stderr, "%s: argument to -p cannot be longer than "
"%d characters\n", ProgramName, NPREFIX - 1);
usage();
exit(1);
}
free(encodingPrefix);
encodingPrefix = dsprintf("%s", argv[argn + 1]);
argn += 2;
} else if(strcmp(argv[argn], "-e") == 0) {
if(argn >= argc - 1) {
usage();
exit(1);
missing_arg("-e");
}
rc = readEncodings(encodingsToDo, argv[argn + 1]);
if(rc < 0)
@ -222,25 +232,21 @@ main(int argc, char **argv)
argn++;
} else if(strcmp(argv[argn], "-o") == 0) {
if(argn >= argc - 1) {
usage();
exit(1);
missing_arg("-o");
}
outfilename = argv[argn + 1];
argn += 2;
} else if(strcmp(argv[argn], "-f") == 0) {
if(argn >= argc - 1) {
usage();
exit(1);
missing_arg("-f");
}
bigEncodingFuzz = atof(argv[argn + 1]) / 100.0;
argn += 2;
} else if (strcmp(argv[argn], "-r") == 0) { /* ignore for now */
argn++;
} else if (strcmp(argv[argn], "-n") == 0) {
argn++;
} else if (strcmp(argv[argn], "-v") == 0) {
printf("%s\n", PACKAGE_STRING);
exit(0);
} else {
usage();
exit(1);
}
}
@ -482,7 +488,7 @@ safe(const char* s)
i++;
}
if(safe_flag) return s;
if(safe_flag) return strdup(s);
len = i;
t = malloc(len + 1);
@ -506,7 +512,7 @@ makeXLFD(char *filename, FT_Face face, int isBitmap)
{
ListPtr xlfd = NULL;
const char *foundry, *family, *weight, *slant, *sWidth, *adstyle,
*spacing, *full_name;
*spacing, *full_name, *tmp;
TT_Header *head;
TT_HoriHeader *hhea;
TT_OS2 *os2;
@ -574,11 +580,11 @@ makeXLFD(char *filename, FT_Face face, int isBitmap)
if(t1info) {
if(!family)
family = t1info->family_name;
family = strdup(t1info->family_name);
if(!family)
family = t1info->full_name;
family = strdup(t1info->full_name);
if(!full_name)
full_name = t1info->full_name;
full_name = strdup(t1info->full_name);
if(!foundry)
foundry = notice_foundry(t1info->notice);
if(!weight)
@ -595,7 +601,7 @@ makeXLFD(char *filename, FT_Face face, int isBitmap)
if(!full_name) {
fprintf(stderr, "Couldn't determine full name for %s\n", filename);
full_name = filename;
full_name = strdup(filename);
}
if(head) {
@ -620,11 +626,13 @@ makeXLFD(char *filename, FT_Face face, int isBitmap)
notice = getName(face, TT_NAME_ID_TRADEMARK);
if(notice) {
foundry = notice_foundry(notice);
free(notice);
}
if(!foundry) {
notice = getName(face, TT_NAME_ID_MANUFACTURER);
if(notice) {
foundry = notice_foundry(notice);
free(notice);
}
}
}
@ -642,7 +650,7 @@ makeXLFD(char *filename, FT_Face face, int isBitmap)
if(!foundry) foundry = "misc";
if(!family) {
fprintf(stderr, "Couldn't get family name for %s\n", filename);
family = filename;
family = strdup(filename);
}
if(!weight) weight = "medium";
@ -651,9 +659,11 @@ makeXLFD(char *filename, FT_Face face, int isBitmap)
if(!adstyle) adstyle = "";
if(!spacing) spacing = "p";
/* Yes, it's a memory leak. */
foundry = safe(foundry);
tmp = family;
family = safe(family);
free((void *)tmp);
if(!isBitmap) {
xlfd = listConsF(xlfd,
@ -676,6 +686,10 @@ makeXLFD(char *filename, FT_Face face, int isBitmap)
spacing, 60);
}
}
free((void *)family);
free((void *)foundry);
free((void *)full_name);
return xlfd;
}