[cl-typesetting-devel] Unicode support feedback needed

Dmitriy Ivanov divanov at aha.ru
Mon Nov 7 19:17:32 UTC 2005


Hello Marc,

| I didn't get much feedback so far about the Unicode support in
| cl-pdf/cl-typesetting.
|
| Anybody has tested this on several implementations?
| Any patches for implementations other than LW?
| (Just look at the unicode-readme.txt for how to use Unicode in cl-pdf)

At the first glance, works for me on LWW 4.4.6 and AcroReader 5.1 both
with and without compressing fonts. Even Cyrillic alphabet is displayed
fine. Thanks!

Unfortunately, due to huge size of TTF, they are hardly of practical use
when embedded without subsetting. Moreover, neither copy-and-paste
nor the Find dialog works in Acrobat yet :-(

Bellow are the small patches.

cl-pdf
======
1) ttu-font.lisp
The original version signals on loading ttu font, but this one works

(defun load-ttu-font (ufm-file &optional ttf-file)
  (let ((ttufm (read-ufm-file ufm-file 'ttu-font-metrics)))
    (when ttf-file
      (with-open-file (in ttf-file :direction :input
                   :element-type '(unsigned-byte 8)) ;was :default
(setf (length1 ttufm) (file-length in)
       (binary-data ttufm) (make-array (length1 ttufm)
                                      :element-type '(unsigned-byte 8)))
(read-sequence (binary-data ttufm) in)))
    ttufm))

2) pdf-base.lisp
(defun show-text-on-next-line (string)
  (write-cid-string string)
  (write-line "'" *page-stream*))

(defun rotate* (radians)
  (let* ((s (sin radians))
  (c (cos radians)))
    (format *page-stream* "~10f ~10f ~10f ~10f 0.0 0.0 cm~%" c s (- s) c)))

cl-typesetting
============
1) IMHO, defconstant* is an unfortunate name as it neither correlates with
let*/do* nor list* convention.

2) We would better have
  (defmacro coerce-to-unicode-string (object) ...)
instead of
  (coerce thing (unicode-string-type))

I have neither disassembled nor profiled but gut feels that coerce is rather
slow.

Maybe a symbol-macro should be used instead of the usual macro:
(define-symbol-macro unicode-string-type
  #+lispworks 'lispworks:simple-text-string
  #-(or lispworks) 'string)

3) tables.lisp
I don't see the following change for (defun stroke-table ...) committed

-              (unless (zerop border) ; next, draw table border
+             ;; Next, draw table border if not suppressed
+             (unless (or (zerop border) (null cell-border))

--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru




More information about the cl-typesetting-devel mailing list