🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #11383

PK font makefile generator

#11383
From: John D. Ramsdell
Date: Thu, 01 Mar 1990 13:18
261 lines
7651 bytes
Here is an awk program that generates the makefile for PK fonts.
To install, follow the instructions in Makefile.fake.
John

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	Makefile.fake
#	font-list.text
#	pk-maker.sh
# This archive created: Thu Mar  1 08:08:11 1990
export PATH; PATH=/bin:$PATH
if test -f 'Makefile.fake'
then
	echo shar: will not over-write existing file "'Makefile.fake'"
else
cat << \SHAR_EOF > 'Makefile.fake'
# Fake makefile.
# Installation:
# 1. Place pk-maker.sh and font-list.text in the directory
#    above the ones used to hold the fonts.
# 2. Place this file in the font directory.
# 3. Edit parameters below.
# 4. Type "make -f Makefile.fake".
# 5. The new make file knows how to make itself, 
#    so you can delete this file.

MFINPUT=/usr/local/lib/mf/inputs
DPI=300
MODE=localfont
SAVE_TFM=

Makefile:
	/bin/sh ../pk-maker.sh $(MFINPUT) $(DPI) $(MODE) $(SAVE_TFM)\
		< ../font-list.text > Makefile
SHAR_EOF
fi # end of overwriting check
if test -f 'font-list.text'
then
	echo shar: will not over-write existing file "'font-list.text'"
else
cat << \SHAR_EOF > 'font-list.text'
cmb10	0.0 0.5 1.0 2.0 3.0 4.0 5.0
cmbsy10	0.0 0.5 1.0
cmbx10	0.0 0.5 1.0 2.0 3.0 4.0 5.0
cmbx12	0.0 0.5 1.0
cmbx5	0.0 0.5 1.0 2.0 3.0 4.0 5.0
cmbx6	0.0 0.5 1.0
cmbx7	0.0 0.5 1.0 2.0 3.0 4.0 5.0 5/7 6/7
cmbx8	0.0 0.5 1.0
cmbx9	0.0 0.5 1.0
cmbxsl10	0.0 0.5 1.0
cmbxti10	0.0 0.5 1.0
cmcsc10	0.0 0.5 1.0 2.0 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0.5 1.0 2.0 3.0 4.0 5.0
cmsy8	0.0 0.5 1.0
cmsy9	0.0 0.5 1.0
cmtcsc10	0.0 0.5 1.0
cmtex10	0.0 0.5 1.0
cmtex8	0.0 0.5 1.0
cmtex9	0.0 0.5 1.0
cmti10	0.0 0.5 1.0 2.0 3.0 4.0 5.0
cmti12	0.0 0.5 1.0
cmti7	0.0 0.5 1.0 5/7
cmti8	0.0 0.5 1.0
cmti9	0.0 0.5 1.0
cmtt10	0.0 0.5 1.0 2.0 3.0 4.0 5.0
cmtt12	0.0 0.5 1.0
cmtt8	0.0 0.5 1.0
cmtt9	0.0 0.5 1.0
cmu10	0.0 0.5 1.0
cmvtt10	0.0 0.5 1.0
lasy10	0.0 0.5 1.0 2.0 3.0 4.0 5.0
lasy5	0.0 0.5 1.0 2.0 3.0 4.0 5.0
lasy6	0.0 0.5 1.0
lasy7	0.0 0.5 1.0 2.0 3.0 4.0 5.0
lasy8	0.0 0.5 1.0
lasy9	0.0 0.5 1.0
lasyb10	0.0 0.5 1.0 2.0 3.0 4.0 5.0
lcircle10	0.0 0.5 1.0 2.0 3.0 4.0 5.0
lcirclew10	0.0 0.5 1.0 2.0 3.0 4.0 5.0
lcmss8	3.0 4.0 5.0 6.0 7.0
lcmssb8	3.0 4.0 5.0 6.0 7.0
lcmssi8	3.0 4.0 5.0 6.0 7.0
line10	0.0 0.5 1.0 2.0 3.0 4.0 5.0
linew10	0.0 0.5 1.0 2.0 3.0 4.0 5.0
logo10	0.0 0.5 1.0
SHAR_EOF
fi # end of overwriting check
if test -f 'pk-maker.sh'
then
	echo shar: will not over-write existing file "'pk-maker.sh'"
else
cat << \SHAR_EOF > 'pk-maker.sh'
#!/bin/sh

# Makefile generator for PK fonts.  John D. Ramsdell --- March 1990

# Usage: $ME MFINPUT DPI MODE < font-list.text
# where MFINPUT is the directory which contains the METAFONT sources.
#       DPI is the dots-per-inch of the device,
#       MODE is the METAFONT mode used to generate fonts,
#   and font-list is a sequence of records in the form
#             font-name		size_1 ... size_n
#       where size is the magstep if it has no "/", otherwise it is
#	      a fraction which gives the magnification.
#
# Place this file and the font-list in the parent directory of the
# directory which is to hold the fonts.  After the first Makefile 
# has been generated, updates are are made by simply typing
# "make Makefile".

# To create fonts, type "make -k > make.log 2>&1 &" to /bin/sh, or
# "make -k >& make.log &" to /bin/csh.  If all looks fine in make.log,
# type "make clean".

MFINPUT=$1
DPI=$2
MODE=${3-localfont}
SAVE_TFM=$4

ME=`basename $0`
USAGE="$ME MFINPUT DPI [MODE] [SAVE_TFM]"

if test ! "$MFINPUT"
then
  echo Missing MFINPUT. 1>&2
  echo Usage: "$USAGE" 1>&2
  exit 1
fi

if test ! "$DPI"
then
  echo Missing DPI. 1>&2
  echo Usage: "$USAGE" 1>&2
  exit 1
fi

echo $ME MFINPUT DPI and MODE: ${MFINPUT} ${DPI} ${MODE} 1>&2

awk '
BEGIN {
  dpi = int('$DPI'+0.5)
  mode = "'$MODE'"
  base = log(1.2)
  type = "pk"
  font_data = 0
}
{ 
  for (i = 2; i <= NF; i++) {
    basename[font_data] = $1
    if ($i == "0.0")
      scale[font_data] = 1.0
    else if ($i !~ /\//)
      scale[font_data] = exp($i*base)
    else if (split($i, fraction, "/") == 2)
      scale[font_data] = fraction[1] / fraction[2]
    else scale[font_data] = 0.0
    if (scale[font_data] > 0.0)
      font[$1 "." int(dpi*scale[font_data]+0.5)] = font_data
    else print "'$ME': Bad input record \"" $0 "\"." | "cat 1>&2"
    font_data += 1
  }
}
END {
# basename[font_data] is the font basename.
# scale[font_data] is the font scale (with 1.0 as no scaling).
# font[filename] is the font_data associated with filename.
# The use of the font array eliminates duplicates

  print "# Makefile for " dpi " lines per inch fonts using mode " mode "."
  print "# Fake targets are all and clean."
  print "# Set \"SAVE_TFM=true\" to save tfm files."
  print ""
  print "MFINPUT='$MFINPUT'"
  print "DPI=" dpi
  print "MODE=" mode
  print "SAVE_TFM='$SAVE_TFM'"
  print ""
  
  printf("all:")		# all is the default target.
  for (filename in font) {
    print " \\"
    printf("  %s", filename type)
  }
  print ""

  print ""
  print "Makefile:\t../font-list.text ../'$ME'"
  print "\trm -f Makefile.bak; mv Makefile Makefile.bak"
  print "\t/bin/sh ../'$ME' $(MFINPUT) $(DPI) $(MODE) $(SAVE_TFM) < ../font-list.text > Makefile"
  print ""
  print "clean:"
  print "\t-rm -f *gf *.log"
  
  for (filename in font) {
    bn = basename[font[filename]]
    print ""
    print filename type ":\t$(MFINPUT)/" bn ".mf"
    printf("\tmf '\''\\mode:=%s;'\'' \"batchmode;\" ", mode)
    if (scale[font[filename]] != 1.0)
      printf("\"mag:=%s;\" ", scale[font[filename]])
    print "input " bn ".mf"
    printf("\t-rm -f %s.log\n", bn)
    printf("\t-if test ! \"$(SAVE_TFM)\"; then rm -f %s.tfm; fi\n", bn)
    printf("\tgftopk %sgf\n", filename)
    printf("\t-rm -f %sgf\n", filename)
  }
}
'
SHAR_EOF
fi # end of overwriting check
#	End of shell archive
exit 0
Technical Details
Message-ID: <99652@linus.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!snorkelwacker!spdcc!merk!alliant!linus!ramsdell

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!snorkelwacker!spdcc!merk!alliant!linus!ramsdell
From: ramsdell@linus.UUCP (John D. Ramsdell)
Newsgroups: comp.text.tex
Subject: PK font makefile generator
Message-ID: <99652@linus.UUCP>
Date: 1 Mar 90 13:18:04 GMT
Reply-To: ramsdell@mitre.org
Organization: The MITRE Corp., Bedford, MA
Lines: 261