[cl-typesetting-devel] *use-exact-char-boxes*
Dmitriy Ivanov
divanov at aha.ru
Fri May 12 07:00:17 UTC 2006
Hello Marc,
| Hi Dmitriy,
|
| If you set *use-exact-char-boxes* to t then the characters on a line
| will use their real bounding box like it is defined in the char
| metrics. If it is set to t then the height of the bounding box will be
| replaced by the value of *leading* to ensure that the lines have all
| the same leading.
Not sure. According to make-char-box, if *use-exact-char-boxes* is set to
nil, the height is replaced by *leading*. On the contrary, when it is t, the
height is determined by ascender and descender. The same should be done for
make-white-char-box, see my version below. With this approach the *leading*
is really gone so I have to the following hack to fit-lines:
(defmethod fit-lines ((content text-content) dx dy &optional (v-align
:top)(advance t))
... ;snip
(setf (boxes text-line)(nreverse line-boxes))
;; ugly hack: somehow catch and respect current *leading*
(when *use-exact-char-boxes*
(let ((delta-size (- *leading* (dy text-line))))
(when (plusp delta-size)
(incf (dy text-line) delta-size)
(incf (internal-baseline text-line) delta-size))))
...)
(defun make-white-char-box (char &optional (trimmable-p t))
;; DI: In exact mode, we must also use ascender for not making baseline
too large.
(if *use-exact-char-boxes*
(multiple-value-bind (width ascender descender)
(pdf:get-char-size char *font* *font-size*)
(setq width (* width *text-x-scale*))
(make-instance 'white-char-box :trimmable-p trimmable-p
:dx width
:dy (- ascender descender) :baseline ascender
:max-expansion (* width 10) :max-compression (* width
0.7)
:expansibility (* width 2.0) :compressibility width))
(let ((width (* (pdf:get-char-width char *font* *font-size*)
*text-x-scale*)))
(make-instance 'white-char-box :trimmable-p trimmable-p
:dx width
:dy *leading* :baseline *font-size*
:max-expansion (* width 10) :max-compression (* width
0.7)
:expansibility (* width 2.0) :compressibility
width))))
| In fact generally you want to have the same leading for all the lines.
| I added *use-exact-char-boxes* for the math mode to deal with the
| special math characters.
It would be better to have both *use-exact-char-boxes* and *leading* working
together :-)
| BTW it was nice to meet you at the ECLM. I hope you have recovered your
| voice... ;-)
It is fine now, thanks :-)
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru
More information about the cl-typesetting-devel
mailing list