[cl-typesetting-devel] *use-exact-char-boxes*
Dmitriy Ivanov
divanov at aha.ru
Sun Jan 18 13:47:18 UTC 2009
Marc Battyani wrote on Mon, 15 May 2006 17:07:42 +0200 18:07:
| In fact, the only bug is the character descent missing in the first
| table.
|
| In make-char-box:
| :dy *leading* :baseline *font-size*
| should be replaced by something like:
| :dy *leading* :baseline (- *font-size* *descender*)
| With *descender* being the maximum descender for the font.
| Or better by adddding *base-line*:
| :dy *leading* :baseline *base-line*
I have found quite a simple solution working when
*use-exact-char-boxes* is nil.
The descender slot is already present in every pdf::font-metrics instance.
It
holds a minumum descender (as descenders are non-positive norlmally) among
the characters of the font. So we can add the same slot to the font class
definition (see cl-pdf/font.lisp):
(defclass font ()
((name :accessor name :initform "helvetica" :initarg :name)
...
;; minimum descender among chars
(descender :accessor descender :initform 0)))
are simply copy it on initializing:
(defmethod initialize-instance :after ((font font) &key encoding
&allow-other-keys)
(let ((font-metrics (gethash (name font) *font-metrics*)))
...
(setf (font-metrics font) font-metrics
(descender font) (descender font-metrics))
...)))
In cl-typesetting, we are using the value of the font descender in
make-char-box and make-white-char-box.
My gut feeling is that the font ascender should be used similarly somewhere
but I cannot figure out where.
I will provide a patch as soon as I resolve troubles with
updating/committing from/to the repository.
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru
More information about the cl-typesetting-devel
mailing list