[cl-typesetting-devel] Unicode support feedback needed

Dmitriy Ivanov divanov at aha.ru
Wed Nov 9 11:06:48 UTC 2005


"Marc Battyani" <marc.battyani at fractalconcept.com> wrote:

|> AFAIR, we should also open *page-stream* in binary mode - this needs
|> further
|> elaboration. I am trying to figure out at the moment.
|
| Why would you want to do that ? The content streams are in ASCII
| normally. Excepted for the characters in strings but they can be
| encoded if needed. The Unicode ones are already encoded.

I see. No need to touch *page-stream*.
To open the document stream in binary mode, the following works for me.

(in-package pdf)

(defmethod write-document ((filename pathname) &optional (document
*document*))
   (with-open-file (stream filename
                           :direction :output :if-exists :supersede
                           :element-type #+pdf-binary '(unsigned-byte 8)
                                         #-pdf-binary 'base-char
                           :external-format +external-format+)
     (write-document stream document)))

;;; Works with CID fonts, not for code-page encoded.
(defmethod write-stream-content ((content string))
   (loop for char across content
           do (write-byte (char-code char) pdf::*pdf-stream*)))
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru




More information about the cl-typesetting-devel mailing list