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

Marc Battyani marc.battyani at fractalconcept.com
Mon Jan 19 02:22:04 UTC 2009


Dmitriy Ivanov wrote:
> 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.
>   
Seems reasonable to me. Just check that the examples still work before
committing. ;-)

The repository should work at
http://www.fractalconcept.com/public/open-source
or http://www.fractalconcept.com:8000/public/open-source

Marc




More information about the cl-typesetting-devel mailing list