[comp.text.tex] pbmtopk patch #1

ajcd@cs.ed.ac.uk (Angus Duggan) (08/10/90)

Whoops, didn't test pktopbm quite thoroughly enough, here's a patch which
fixes a bug in it. I've also made a change to pbmtopk which allows the
character number to be changed when reading option files.

I forgot to mention that this package requires Jef Poskanzer's pbmplus library
(actually only libpbm), which comes with the X11R4 distribution. I think it's
available for anonymous ftp also, but I don't know any net addresses for it.

Enjoy,
A.
==
Angus Duggan, Department of Computer Science,	| Ignorance of the manual is
University of Edinburgh, JCMB,			| no excuse.
The King's Buildings, Mayfield Road,		| JANET:  ajcd@uk.ac.ed.lfcs
Edinburgh, EH9 3JZ, Scotland.	| OR:  ajcd%lfcs.ed.ac.uk@nsfnet-relay.ac.uk

*** Makefile.old	Fri Aug 10 13:13:29 1990
--- Makefile	Fri Aug 10 13:03:09 1990
***************
*** 6,24 ****
  
  all: pbmtopk pktopbm
  
! test: test.dvi
  
  pbmtopk: pbmtopk.c
  	$(CC) $(CFLAGS) -o pbmtopk pbmtopk.c -lm -lpbm
  
  pktopbm: pktopbm.c
! 	$(CC) $(CFLAGS) -o pktopbm pktopbm.c -lm -lpbm
  
  test.dvi: test.tex test.tfm
  	tex test
  
! test.tfm: pbmtopk test.opt
! 	pbmtopk test.300pk test.tfm 300 -s 10 -c 65 -f test.opt
  
  clean:
! 	rm -f pbmtopk pktopbm test.dvi test.log test.tfm test.300pk
--- 6,27 ----
  
  all: pbmtopk pktopbm
  
! test: test.dvi test.pbm
  
  pbmtopk: pbmtopk.c
  	$(CC) $(CFLAGS) -o pbmtopk pbmtopk.c -lm -lpbm
  
  pktopbm: pktopbm.c
! 	$(CC) $(CFLAGS) -o pktopbm pktopbm.c -lpbm
  
+ test.pbm: pktopbm test.300pk
+ 	pktopbm test.300pk -c 65 test.pbm
+ 
  test.dvi: test.tex test.tfm
  	tex test
  
! test.300pk test.tfm: pbmtopk test.opt
! 	pbmtopk test.300pk test.tfm 300 -s 10 -f test.opt
  
  clean:
! 	rm -f pbmtopk pktopbm test.dvi test.log test.tfm test.300pk test.pbm
*** pbmtopk.1.old	Fri Aug 10 11:03:20 1990
--- pbmtopk.1	Fri Aug 10 12:42:33 1990
***************
*** 42,48 ****
  in the font with the specified attributes. If any of the attributes are
  omitted, or replaced with "*", a default value will be calculated from the
  size of the bitmap. The settings of the -W, -H, -D, -I, -h, -v, -x, and -y
! options do not affected characters created in this way. Lines beginning with
  "%" or "#" are ignored.
  .IP "-c num"
  Sets the character number of the next bitmap encountered to num.
--- 42,51 ----
  in the font with the specified attributes. If any of the attributes are
  omitted, or replaced with "*", a default value will be calculated from the
  size of the bitmap. The settings of the -W, -H, -D, -I, -h, -v, -x, and -y
! options do not affected characters created in this way.
! The character number can be changed by including a line starting with "=",
! followed by the new number.
! Lines beginning with
  "%" or "#" are ignored.
  .IP "-c num"
  Sets the character number of the next bitmap encountered to num.
*** pbmtopk.c.old	Fri Aug 10 11:03:27 1990
--- pbmtopk.c	Fri Aug 10 13:08:46 1990
***************
*** 836,842 ****
  
      if (fgets(buffer, MAXOPTLINE, fp) == NULL) break ;
      while (isspace(*here)) here++ ;
!     if (*here && *here != '%' && *here != '#') {
        char str[NAMELENGTH] ;
        integer i, n;
        
--- 836,847 ----
  
      if (fgets(buffer, MAXOPTLINE, fp) == NULL) break ;
      while (isspace(*here)) here++ ;
!     if (*here && *here == '=') {
!       if (sscanf(here+1, "%d", &car) != 1) {
! 	fprintf(stderr, "Bad option file line %s!\n", buffer) ;
! 	jumpout() ;
!       }
!     } else if (*here && *here != '%' && *here != '#') {
        char str[NAMELENGTH] ;
        integer i, n;
        
***************
*** 1036,1039 ****
--- 1041,1045 ----
    writetfmfile() ;
    if (pkfile != stdout) fclose(pkfile) ;
    if (tfmfile != stdout) fclose(tfmfile) ;
+   exit(0);
  }
*** pktopbm.c.old	Fri Aug 10 13:09:52 1990
--- pktopbm.c	Fri Aug 10 13:08:32 1990
***************
*** 299,306 ****
      } else goto lab9997 ;
      bitweight = 0 ;
      if (dynf == 14) {
!       for (i = 1 ; i <= cheight ; i ++)
! 	for (j = 1 ; j <= cwidth ; j ++) {
  	  if (getbit())
  	    bitmap[i][j] = PBM_BLACK ;
  	  else
--- 299,306 ----
      } else goto lab9997 ;
      bitweight = 0 ;
      if (dynf == 14) {
!       for (i = 0 ; i < cheight ; i ++)
! 	for (j = 0 ; j < cwidth ; j ++) {
  	  if (getbit())
  	    bitmap[i][j] = PBM_BLACK ;
  	  else
***************
*** 377,380 ****
--- 377,381 ----
        fprintf(stderr, " Warning: No character in position %d (file %s).\n",
  	      car, filename[car]) ;
    fprintf(stderr, "%d bytes read from packed file.\n", pkloc) ;
+   exit(0);
  }
*** test.opt.old	Fri Aug 10 12:32:20 1990
--- test.opt	Fri Aug 10 12:35:38 1990
***************
*** 1,6 ****
  % pbmtopk option file for the 'test font.
! % invoke with: pbmtopk test.300pk test.tfm 300 -s 10 -c 65 -f test.opt
! %
  % character 'A': small 64x64 version of my face.
  face.pbm
  % character 'B': my name.
--- 1,7 ----
  % pbmtopk option file for the 'test font.
! % invoke with: pbmtopk test.300pk test.tfm 300 -s 10 -f test.opt
! % reset character number to 65 ('A')
! = 65
  % character 'A': small 64x64 version of my face.
  face.pbm
  % character 'B': my name.