[cl-typesetting-devel] *use-exact-char-boxes*
Marc Battyani
marc.battyani at fractalconcept.com
Mon May 15 08:04:52 UTC 2006
"Dmitriy Ivanov" <divanov at aha.ru> wrote:
> "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)
OK looks like the descent is not taken into account in the first case and it
should be fixed but, as I already wrote, using exact-char-boxes will lead to
non uniform line spacing. See your example modified: (pdf attached)
(defun test-char-mode (&optional (file #P"/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)
(tt:put-string "Apa Apaaa Apaaaa Apaaa Apaaaa Apaaa Apaaa
Apaaa")
(tt:put-string "aaa aaaaa aaaaaa aaaaaa aaaaaa aaaaaa
aaaaaa aaaaa aaaa aaaaa aaaaa ")
(dotimes (i 4)
(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)
(tt:put-string "Apa Apaaa Apaaaa Apaaa Apaaaa Apaaa Apaaa
Apaaa")
(tt:put-string "aaa aaaaa aaaaaa aaaaaa aaaaaa aaaaaa
aaaaaa aaaaa aaaa aaaaa aaaaa ")
(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))))
Marc
More information about the cl-typesetting-devel
mailing list