HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] a simple way to reproduce formfeed problem. How to fix ?



On Monday 14 October 2002 06:17 pm, Vu Pham wrote:
> Hi all,
>
> It's me again. The followings are the simple steps to reproduce my problem
> with formfeed.
>
> 1. I use vi to create a file test.txt  with 60 empty lines ( just pressing
> Enter 60 times ).
>
> 2. At line 57, add Control-L, then save this file
>
> 3. Create the output postscript psfile from test.txt
> # /usr/sbin/textfmt -B -f Courier-Bold -Ml=0.4 -p 11 -s default > psfile <
> test.txt

This is a bug in the 'textfmt' program.  The problem is that it produces end 
of page code without producing start of page code. 

The Postscript code for a page looks like:
------------------------------------------------------------------------------------------------------
%%Page: "1" 1
save $printdict begin

	... other stuff to print text

showpage
end restore
------------------------------------------------------------------------------------------------------

But for the case that you've produced, the Postscript code that's generated 
is:
------------------------------------------------------------------------------------------------------
%%Page: "1" 1
save $printdict begin

	... other stuff to print text

showpage
end restore

showpage
end restore
------------------------------------------------------------------------------------------------------

So there's a begin without an end.

You can try the attached patch - textfmt won't produce the bad code with it.  
But I can't guarantee there won't be some other problem - I have to look at 
the code a bit more - I've not seen the insides of TextFmt.c++ before, and 
it's bed time now.

*** TextFmt.c++.~1~	Thu Feb 14 23:52:21 2002
--- TextFmt.c++	Mon Oct 14 22:30:28 2002
***************
*** 758,763 ****
--- 758,767 ----
  	case '\0':			// discard nulls
  	    break;
  	case '\f':			// form feed
+ 	    if (bol)
+ 		beginLine();
+ 	    if (bot)
+ 		beginText();
  	    endTextCol();
  	    bol = bot = true;
  	    break;
***************
*** 849,854 ****
--- 853,862 ----
  	case '\0':			// discard nulls
  	    break;
  	case '\f':			// form feed
+ 	    if (bol)
+ 		beginLine();
+ 	    if (bot)
+ 		beginText();
  	    endTextCol();
  	    bol = bot = true;
  	    break;



Project hosted by iFAX Solutions