From divanov at aha.ru Sun Jan 18 13:47:18 2009 From: divanov at aha.ru (Dmitriy Ivanov) Date: Sun, 18 Jan 2009 16:47:18 +0300 Subject: [cl-typesetting-devel] *use-exact-char-boxes* References: <04bc01c677f6$7b246240$1402a8c0@marcx2> <000f01c67815$03bb7120$8100a8c0@digo> <005001c67817$ac57bd50$1402a8c0@marcx2> <001001c6782b$9c1c8740$8100a8c0@digo> <013501c67831$5071be40$1402a8c0@marcx2> Message-ID: <006201c97973$4aef81a0$8100a8c0@digo> 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 From marc.battyani at fractalconcept.com Mon Jan 19 02:22:04 2009 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Sun, 18 Jan 2009 21:22:04 -0500 Subject: [cl-typesetting-devel] *use-exact-char-boxes* In-Reply-To: <006201c97973$4aef81a0$8100a8c0@digo> References: <04bc01c677f6$7b246240$1402a8c0@marcx2> <000f01c67815$03bb7120$8100a8c0@digo> <005001c67817$ac57bd50$1402a8c0@marcx2> <001001c6782b$9c1c8740$8100a8c0@digo> <013501c67831$5071be40$1402a8c0@marcx2> <006201c97973$4aef81a0$8100a8c0@digo> Message-ID: <4973E3CC.2020005@fractalconcept.com> 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 From divanov at aha.ru Tue Jan 20 09:04:57 2009 From: divanov at aha.ru (Dmitriy Ivanov) Date: Tue, 20 Jan 2009 12:04:57 +0300 Subject: [cl-typesetting-devel] *use-exact-char-boxes* References: <04bc01c677f6$7b246240$1402a8c0@marcx2> <000f01c67815$03bb7120$8100a8c0@digo> <005001c67817$ac57bd50$1402a8c0@marcx2> <001001c6782b$9c1c8740$8100a8c0@digo> <013501c67831$5071be40$1402a8c0@marcx2> <006201c97973$4aef81a0$8100a8c0@digo> <4973E3CC.2020005@fractalconcept.com> Message-ID: <00f301c97adf$55e3d4e0$8100a8c0@digo> Marc Battyani wrote on Sun, 18 Jan 2009 21:22:04 -0500 05:22: |> In cl-typesetting, we are using the value of the font descender in |> make-char-box and make-white-char-box. | | Seems reasonable to me. Just check that the examples still work before | committing. ;-) The patch has committed. The full-example works for me, nevertheless. please update carefully :-) The net effect is shifting text up a bit. Maybe the top-margin should be enlarged for paragraphs. -- Sincerely, Dmitriy Ivanov lisp.ystok.ru