[Barcode] Lout and Barcodes. (fwd)

Dani Pardo dani@enpl.es
Fri, 3 Nov 2000 09:25:44 +0000 (WET)


	Hi All. Have you ever used Lout? It's a kind of TeX, but pretty
more easy to learn and much compact. 
	The question is that some time ago, I thought Lout & Barcode
library could be a powerful "duo" to generate labels and Forms with
barcodes in it. Take a look at the message. What do you think? Should Lout
have a @System function, or should Barcode generate a BoundingBox? All two
options seem pretty logic.



---------- Forwarded message ----------
Date: Fri, 3 Nov 2000 09:17:34 +0000 (WET)
From: Dani Pardo <dani@enpl.es>
To: jeff@cs.usyd.edu.au
Subject: Re: Lout and Barcodes.

On Fri, 3 Nov 2000, Jeff Kingston wrote:

> > So (I guess) that if I somehow used @Filter, I'd read the Postscript
> > commands that generates the barcode library in the page, not the
> > barcodes itself.
> 
> I don't understand this clearly, but basically the simplest thing would
> be for the barcode software to either generate Lout source (@Box
> commands, etc.) or since it's not likely to know about Lout commands
> the alternative would be for it to generate PostScript which could
> be returned as raw PostScript

  Yes, that's what the library does, generate Postscript commands to
stdout, the same way lout does, see:
-------------------------------------
#include <stdio.h>
#include <stdlib.h>

#include "barcode.h"

int main(int argc, char **argv)
{

    /* default size, bottom left */
    Barcode_Encode_and_Print("800894002700",stdout, 0, 0, 40, 40,
                      BARCODE_EAN | BARCODE_OUT_PS |
BARCODE_OUT_NOHEADERS);

    return 0;
}
----------------------------------------
 
 ... this outputs something like:

calix:~/barcode-0.94$ ./a.out |more

% Printing barcode for "800894002700", EAN-13
% The space/bar succession is represented by the following widths
% 911132111123121321132311321111111321121221312321132111132111
 0.85 setlinewidth  59.50  55.00 moveto 0 75.00 rlineto stroke
 0.85 setlinewidth  61.50  55.00 moveto 0 75.00 rlineto stroke

... etc

 You can also tell the library to generate the headers
(%%!PS-Adobe-2.0, %%Creator: etc..)
 I've tried to generate one of those files, and use @IncludeGraphic, but
Lout tells me:

40,1: @IncludeGraphic given zero size (no BoundingBox line in file
include.ps
 
 (Lout is right, the barcode library doesn't define any BoundingBox).
 So, I guess there are two things that can solve the problem:

 - Barcode library to generate a BoundingBox to be included by Lout with
@IncludeGraphic.

 - Lout to have a new funcion, a kind of @System, that calls a system
program, and appends its output to the PS file being generated. This would
mean that Lout should trust the program being invoked, the same way
@Filter trusts the command "sort" in the example found in the docs. I
don't know how Lout is implemented, but It would be nice to hear from you,
about the difficultness of implementing such a function. 
 

---
Dani Pardo, dani@enpl.es
Enplater S.A