[cl-typesetting-devel] Kerning question: hbox vs. paragraph

Peter Heslin pj at heslin.eclipse.co.uk
Thu Jan 12 22:19:26 UTC 2006


I'm just playing around with cl-typesetting to get familiar with it,
and it looks great!

Here's my question.  When text is typeset using the paragraph macro,
the kerning is fine, but when using the hbox macro alone, it appears
to be a little off.  Here's a minimal example:

(defun test-kern ()
  (with-document ()
    (draw-pages (compile-text ()
                              (hbox () "foo AWAY")
                              (hbox () (put-string "foo"))
                              (paragraph () "foo AWAY")))
    (when pdf:*page* (finalize-page pdf:*page*))
    (pdf:write-document #P"/tmp/test.pdf")))

When you look at the PDF, the last string is typeset fine, but the
first two are slightly off.  The middle "o" in "foo" is a bit too
close the "f", and too far from the last "o".  Likewise in "AWAY", the
"W" is not evenly spaced between the two "A"s in the first two
strings.  In the paragraph example, it's fine. It is a subtle problem,
but it's there.

Looking quickly at the code in typo.lisp, I don't see any obvious
reason for this difference.

Is hbox not supposed to be used to typeset normal text?  Without
documentation it's hard to tell ;-)

Thanks,

Peter




More information about the cl-typesetting-devel mailing list