summaryrefslogtreecommitdiffstats
path: root/font/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'font/scripts')
-rwxr-xr-xfont/scripts/gendesc.sh18
-rwxr-xr-xfont/scripts/genfonts.sh23
-rw-r--r--font/scripts/scripts.am27
3 files changed, 68 insertions, 0 deletions
diff --git a/font/scripts/gendesc.sh b/font/scripts/gendesc.sh
new file mode 100755
index 0000000..5bf5376
--- /dev/null
+++ b/font/scripts/gendesc.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+# Usage: gendesc.sh <input .proto> <RES> <CPI> <LPI> <list of fonts>
+if test -z "$1" || test -z "$2" || test -z "$3" || test -z "$4" || \
+ test -z "$5"; then
+ echo "genfonts.sh: missing parameter"; exit 255;
+fi
+INPUT=$1
+RES=$2
+CPI=$3
+LPI=$4
+shift 4
+NBFONTS=`echo $#`
+FONTS=`echo $*`
+sed -e "s/^res .*$/res $RES/" \
+ -e "s/^hor .*$/hor `expr $RES / $CPI`/" \
+ -e "s/^vert .*$/vert `expr $RES / $LPI`/" \
+ -e "s/^fonts .*$/fonts $NBFONTS $FONTS/" \
+ $INPUT
diff --git a/font/scripts/genfonts.sh b/font/scripts/genfonts.sh
new file mode 100755
index 0000000..ad45612
--- /dev/null
+++ b/font/scripts/genfonts.sh
@@ -0,0 +1,23 @@
+#!/bin/sh -xv
+# Usage:
+# genfonts.sh <input .proto file> <RES> <CPI> <FONT name>
+if test -z "$1" || test -z "$2" || test -z "$3" || test -z "$4"; then
+ echo "genfonts.sh: missing parameter"; exit 255;
+fi
+
+INPUT=$1
+RES=$2
+CPI=$3
+FONT=$4
+charwidth=`expr $RES / $CPI` ;
+sed -e "s|^name [A-Z]*$|name $FONT|" \
+ -e \
+ "s/^\\([^ ]*\\) [0-9][0-9]* /\\1 $charwidth /" \
+ -e "s/^spacewidth [0-9][0-9]*$/spacewidth $charwidth/" \
+ -e "s|^internalname .*$|internalname $FONT|" \
+ -e "/^internalname/s/CR/4/" \
+ -e "/^internalname/s/BI/3/" \
+ -e "/^internalname/s/B/2/" \
+ -e "/^internalname/s/I/1/" \
+ -e "/^internalname .*[^ 0-9]/d" \
+ $INPUT
diff --git a/font/scripts/scripts.am b/font/scripts/scripts.am
new file mode 100644
index 0000000..5b63f15
--- /dev/null
+++ b/font/scripts/scripts.am
@@ -0,0 +1,27 @@
+# Copyright (C) 2015-2020 Free Software Foundation, Inc.
+#
+# This file is part of groff.
+#
+# groff is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 2 of the License, or (at your
+# option) any later version.
+#
+# groff is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Scripts for font files generation
+GENFONTSSH=$(top_srcdir)/font/scripts/genfonts.sh
+GENDESCSH = $(top_srcdir)/font/scripts/gendesc.sh
+EXTRA_DIST += $(GENFONTSSH) $(GENDESCSH)
+
+# Local Variables:
+# mode: makefile-automake
+# fill-column: 72
+# End:
+# vim: set autoindent filetype=automake textwidth=72: