[cl-typesetting-devel] apparent hyphenation-related bug and fix
Chhi'med Kunzang
clkunzang at gmail.com
Thu Jun 4 19:51:05 UTC 2009
I have encountered a weird bug, which is that when using some fonts at
some sizes ("Times-Roman" at 12.0 for example), I get extra spacing
inserted in the middle of words. I haven't worked out exactly when
this happens and why it sometimes doesn't, but it certainly does
happen sometimes. As it turns out the place where these spaces appear
is where hyphens *would* appear if the line needed to be hyphenated.
A quick tour through the code led me to believe that the placeholders
for the hyphens were being left in and rendered as spaces. However,
the code is complex, and I don't pretend to completely understand it.
I came up with a simple solution which fixes my immediate problem, but
I do not yet know if it may introduce new problems. I am including
the relevant information here so that someone more knowledgeable can
verify this is the correct solution and can incorporate it (or a
better solution) into the source at some point.
As far as I know, I am using the most recent version of the cl-
typesetting. My version is 0.8.
The solution was a simple conditional which prevents pushing the
unneeded HYPHEN-BOX onto the current LINE-BOXES.
From layout.lisp:
(defmethod fit-lines ((content text-content) dx dy &optional (v-
align :top)(advance t))
<snip>
; ((<= next-x last-x) (push box line-boxes))
((<= next-x last-x) (unless (typep box 'hyphen-box)
(push box line-boxes)))
<snip>
(return-lines))))
I hope that helps, if correct, and that if incorrect someone else
might be able to suggest a better workaround.
Thanks,
Chhi'mèd
More information about the cl-typesetting-devel
mailing list