[cl-typesetting-devel] Re: [cl-pdf-devel] Character encoding?
Dmitriy Ivanov
divanov at aha.ru
Tue Feb 26 08:30:11 UTC 2008
Peter Seibel wrote on Mon, 25 Feb 2008 21:48:25 -0800 08:48:
| Actually I now I'm thinking it *is* a cl-pdf issue. Assume for the
| moment that I'm using a Unicode lisp. (I.e. one whose CHAR-CODE returns
| Unicode code points.) I should be able to use cl-pdf directly and have
| it render properly. That PDF under the covers encodes characters using
| octets that are really indices into an array that's part of the font
| should not be an issue I have to deal with.
Relying on an encoding only does not suffice. An additional notion of
_charset_ is for this.
| And looking a bit at the cl-pdf code I see something that looks like
| it's sort of trying to do this--CHAR-EXTERNAL-CODE. But it also seems
| that that isn't always called. (For instance, never on SBCL in
| GET-CHAR-METRICS). Maybe it should be.
|
| Then if cl-pdf assumes that all characters and strings it gets are or
| are made up of Unicode characters, then it seems there are a just a few
| places where it can convert the Unicode code-point to a code-point that
| can be used with the current font: get-char-metrics, show-char, and
| show-text may be it but I haven't done a careful check. It's a bit
| hinky that under the covers cl-pdf just converts them to different Lisp
| characters and then counts on using an 8-bit clean character encoding
| when writing the file but that's just an implementation detail at a
| level below the one I'm talking about.
|
| Obviously we made this change to cl-pdf then cl-typesetting wouldn't
| have to worry about it at all.
In the latest revision, get-char-metrics and write-to-page do call
char-external-code on SBCL. As far as I can guess, SBCL itself lacks an
internal machinery for implementing char-external-code.
| Finally, to generalize a bit, for Lisps that don't use Unicode code
| points, cl-pdf should likewise know how to map from whatever character
| encoding they do use to the encoding used within a PDF file.
I hope that an internal counterpart of char-external-code should do this on
a specific non-Unicode Lisp implementation. The guys who are using such a
Lisp should verify the hypothesis and contribute source code.
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru
More information about the cl-typesetting-devel
mailing list