texttopdf filter for cups
-------------------------

This implements a texttopdf filter, and is derived from cups' texttops.

To compile:
-----------
 
There are two possibilities:

1) Compile standalone:

You'll need a recent cups sourcetree.
Edit the CFLAGS in the Makefile
to point to this sourcetree, and point the LDFLAGS
to an installed libcups2, e.g.

CFLAGS+=-I/somewhere/cups-1.3.7/
LDFLAGS+=-lcups2
 
/* DOES NOT WORK
Make sure you have installed cups-devel. Then just use
"make" in the filter subdirectory.
*/

2) Compile as part of cups

Get a recent cups sourcetree (tested: 1.3.7) and then copy
the files under cups/.../* into the corresponding directory of
the original cups sources.
[Note: textcommon.[ch] and common.[ch] are copied verbatim from
       cups-1.3.7 for standalone compilation. You should not
       need to replace them.]
Then rename filter/Makefile.cups to filter/Makefile.

Compile cups as usual and you will get together with all the other
filter now also a texttopdf filter.

To install:
-----------

For 1): 
  Copy cups/filter/texttopdf to your prefered destination e.g. 
  /usr/lib/cups/filter/.
For 2):
  Just install the patched cups sourcetree as usual.

1)+2):
- texttopdf uses a CUPS_DATADIR/charset/pdf.* (e.g. pdf.utf-8) for
  font configuration. All the fonts named here MUST also be present
  under CUPS_DATADIR/fonts/ as TrueType fonts for texttopdf to work.
  For TrueType Collections (.TTC) you'll have to append '/' and the 
  number of the font in the collection to the filename charsets/pdf.utf-8
  (resp. charsets/pdf.* ), for example to use the second font of uming.ttc 
  use the filename uming.ttc/1

- There are examples of pdf.utf-8 in the cups/filter/charsets directory,
  you may use one of these (don't forget to copy / symlink the fonts).

To use:
-------

The filter is called just like any other cups filter. Have a
look at test.sh for example. 
Ask an cups expert on how to integrate it into the cups workflow, 
as I don't know.

Known Issues
------------
(Release 0.0.1)
 - text extraction does not work (at least for pdftotext from xpdf) for the resulting pdfs.
 - text wrapping in pretty-printing mode does not respect double-wide characters (CJK),
   and thus produce wrong results (wrap too late) for lines where they occur.
   The fix is not trivial, since all the pretty-printing processing is done without knowledge of / prior to
   the font configuration (which is where single or double width code-ranges are specified).
 - The hebrew example in test5.pdf shows one of our limitations:
   Compose glyphs are not composed with the primary glyph but printed as separate glyphs.

