[cl-typesetting-devel] *use-exact-char-boxes*

Dmitriy Ivanov divanov at aha.ru
Mon May 15 06:23:51 UTC 2006


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

|> I would like to use exact char boxes not only in math mode but also in
|> other places. As I have noticed earlier, text would look prettier
|> within table cells and draw-block. When *use-exact-char-boxes* is nil,
|> the internal baseline of the first line in block is equal to dy and
|> that leads to shifting the entire text down.
|
| Maybe the problem is here. Have you a simple example so that I can look
| at it and see exactly what you mean?

Here is the simplest example. You could see an unpleasant effect with
padding equal to 0 and *leading-ratio* equal to 1.

Within the first table, text in the bottom line breaches the border. Within
the second one, the leading 1.0 is not actually respected.

(defun test-char-mode (&optional (file (lw:current-pathname
"char-mode.pdf")))
  (tt:with-document ()
    (let ((tt:*default-font* (pdf::get-font "Helvetica"))
          (tt::*leading-ratio* 1.)
          content)
     (let ((tt::*use-exact-char-boxes* nil))
       (setq content (tt:compile-text ()
         (tt:paragraph (:top-margin 10 :h-align :center)
           (tt:format-string "*leading-ratio*=~S *use-exact-char-boxes*=~S"
                             tt::*leading-ratio* tt::*use-exact-char-boxes*))
         (tt:table (:col-widths '(300 100) :border 1/2 :padding 0
:cell-padding 0)
           (tt:row ()
             (tt:cell ()
               (tt:with-style (:h-align :left :font-size 20)
                 (dotimes (i 5)
                   (tt:put-string "The cool Common Lisp typesetting system.
"))))
             (tt:cell () "test")))))
       (tt:draw-pages content :margins #(30 30 30 30)))
     (let ((tt::*use-exact-char-boxes* t))
       (setq content (tt:compile-text ()
         (tt:paragraph (:top-margin 10 :h-align :center)
           (tt:format-string "*leading-ratio*=~S *use-exact-char-boxes*=~S"
                             tt::*leading-ratio* tt::*use-exact-char-boxes*))
         (tt:table (:col-widths '(300 100) :border 1/2 :padding 0
:cell-padding 0)
           (tt:row ()
             (tt:cell ()
               (tt:with-style (:h-align :left :font-size 20)
                 (dotimes (i 5)
                   (tt:put-string "The cool Common Lisp typesetting system.
"))))
             (tt:cell () "test")))))
       (tt:draw-pages content :margins #(30 30 30 30) :break :after))
     (pdf:write-document file))))

(test-char-mode)

--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru




More information about the cl-typesetting-devel mailing list