[cl-pdf-devel] Unicode/ISO-8859-2

Marc Battyani marc.battyani at fractalconcept.com
Sun Sep 25 08:53:08 UTC 2005


"Levente Mészáros" <levente.meszaros at mailbox.hu> wrote:

Hi Levy,

>I'm new to this list and to both cl-pdf and cl-typesetting, and
unforunately
>I could really use some help. Until now I was using docbook and XSLT
>processors for generating documents, but I found out that it is a bad
>solution (and well I was really kind saying this), so I decided to use
lisp.

Good decision! ;-)

>I'm hungarian guy and I would like to generate documents in my national
>language. I tried really hard, but I could not manage to generate a pdf
file
>with unicode (or iso-8859-2) characters in it, although all tests shipped
>with the packages worked very well.

There is no Unicode support in cl-pdf yet. So for now, you need to use the
iso-8859-2 character set.
If the characters in this charset are already in the PDF standard fonts,
then you just have to provide the encoding. (see encodings.lisp) Otherwise
you need to provide the font.

>I have attached a unicode xml file which I was trying to use as an example
>and a small program which I was hacking with. I'm using the newest clisp
>under cygwin and windows XP.

>I have patched deflate-stream-interface.lisp not to use ASCII encoding, but
>utf-8. Perhaps I was wrong on this:
>77c77
><   (ext:convert-string-to-bytes string charset:ascii :start start :end
end)
>---
>>   (ext:convert-string-to-bytes string charset:utf-8 :start start :end
end)

OK but it will not be enough. While troubleshooting this kind of stuff, you
should disable compression completely to avoid 2 kinds of problems at the
same time.

>Unfortunately I get error messages like:
>*** - AREF: index 337 for #(#<PDF:CHAR-METRICS VoidChar> #<PDF:CHAR-METRICS
[...]

Well 337 is somewhat too big for a vector of length 256...

>and the worst is sometimes segfault...
>
>Could somebody help me and show how could I generate a document with that
>text or with any central european or unicode (utf-8) text?

Yes, you should look at Dmitri Ivanov's web page on cl-pdf where he has an
example of the use of cl-pdf with Cyrillic fonts:
http://lisp.ystok.ru/cl-pdf.html
http://lisp.ystok.ru/code/ex-1251.pdf

>And is there any documentation of cl-pdf and cl-typesetting? I mean other
>than the source code?

Unfortunately not yet. There have been some attempts at it but nothing
really finished. The lack of documentation of cl-pdf/cl-typesetting is a
problem but each time I can manage to find some time to work on them I
prefer to write some new functionality, like Unicode support for instance,
rather than some doc. ;-)

At least I should add some more examples. So if anybody has small self
contained examples, I would be happy to add them to the repositories.

>I also had problems running kw-extensions.lisp examples. They produce empty
>documents, but I would really need something like that. It looks much
closer
>to what docbook offers and still I get all the flexibility of the framework
>and lisp.

>Thank you for reading this letter... ;-)

You're welcome :)

Marc





More information about the cl-pdf-devel mailing list