home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / fonts / 3377 < prev    next >
Encoding:
Text File  |  1992-11-16  |  2.6 KB  |  87 lines

  1. Path: sparky!uunet!ogicse!uwm.edu!caen!nic.umass.edu!dime!dime.cs.umass.edu!walsh
  2. From: walsh@cs.umass.edu (Norman Walsh)
  3. Newsgroups: comp.fonts
  4. Subject: Re: Does a pfb & pfm to bdf font convertor exist?
  5. Message-ID: <WALSH.92Nov16112032@ibis.cs.umass.edu>
  6. Date: 16 Nov 92 16:20:32 GMT
  7. Article-I.D.: ibis.WALSH.92Nov16112032
  8. References: <92312.183945CXF111@psuvm.psu.edu> <SIMON.92Nov9112743@liasg2.epfl.ch>
  9.     <6730@m1.cs.man.ac.uk>
  10. Sender: news@dime.cs.umass.edu
  11. Reply-To: walsh@cs.umass.edu
  12. Organization: Dept of Comp and Info Sci, Univ of Mass (Amherst)
  13. Lines: 71
  14. In-reply-to: lilleyc@cs.man.ac.uk's message of 11 Nov 92 18:45:52 GMT
  15.  
  16. The combination of PS2PK and PKtoBDF allow you to create X11 bitmap fonts
  17. from pfa/pfb files.  I forget where I got PKtoBDF but I'm sure I found it
  18. with Archie.  PS2PK is described in the FAQ.  
  19.  
  20. Here is a little script (based on TeXtoXfont from the SeeTeX distribution)
  21. that creates the appropriate X font from a pfa/pfb file:
  22.  
  23. ------------------------------------------------------------------------
  24.  
  25. #!/usr/local/bin/bash
  26. #
  27. #   This script file makes a new X/TeX screen font, because one wasn't
  28. #   found.  Parameters are:
  29. #
  30. #   name dpi bdpi mag mode destdir
  31. #
  32. #   Of course, it needs to be set up for your site.
  33. #
  34. # TEMPDIR needs to be unique for each process because of the possibility
  35. # of simultaneous processes running this script.
  36.  
  37. TEMPDIR=/tmp/bdf-PS.$$
  38. NAME=$1
  39. DPI=$2
  40. BDPI=$3
  41. MAG=$4
  42. MODE=$5
  43. DESTDIR=$6
  44.  
  45. BASENAME=$NAME.$MAG.$BDPI
  46. PTSIZE=`echo "2 k $MAG 100 / p q" | dc`
  47. PFADIR=/usr/local/lib/tex/ps/outlines/
  48.  
  49. # Clean up on normal or abnormal exit
  50. trap "cd /; rm -rf $TEMPDIR" 0 1 2 15
  51.  
  52. mkdir $TEMPDIR
  53. cd $TEMPDIR
  54.  
  55. echo Making ${PTSIZE}pt ${BDPI}dpi version of $NAME.
  56. ps2pk -v -X$BDPI -P$PTSIZE -a$PFADIR/$NAME.afm $PFADIR/$NAME.pfa $BASENAME.pk
  57. pktobdf $BASENAME.pk | gawk -vname=$NAME.$DPI -f /usr/local/lib/tex/ps/PStoXfont.awk > $BASENAME.bdf
  58. bdftopcf $BASENAME.bdf > $BASENAME.pcf
  59. mv $BASENAME.pcf $DESTDIR
  60.  
  61. mkfontdir $DESTDIR
  62. xset +fp $DESTDIR
  63. xset fp rehash
  64.  
  65. exit 0
  66.  
  67. -------------------------------------------------------------------------
  68.  
  69. Here's PStoXfont.awk.  It just changes the "FONT" resource name in the BDF
  70. file to match what SeeTeX looks for...
  71.  
  72. BEGIN    { ok=1 }
  73. /^FONT / { printf("FONT %s\n",name)  
  74.            ok=0 
  75.          }
  76.          { if (ok) print $0
  77.            ok=1
  78.          }
  79.  
  80. -------------------------------------------------------------------------
  81.  
  82.                                                   Be seeing you...
  83.                                                     norm
  84. ---
  85. Norman Walsh         | University of Massachusetts, Amherst, MA 01003
  86. <walsh@cs.umass.edu> | CMPSCI Dept., LGRC A210 | Standard disclaimer applies
  87.