[cl-typesetting-devel] Re: [cl-pdf-devel] Hyphenation

Dmitriy Ivanov divanov at aha.ru
Fri Sep 1 05:38:50 UTC 2006


Hello Jonathon,

| Is there any way to turn off hyphenation?

I use the following version of typeset:put-string.

(defvar *default-language* nil "Default hyphenation language used by
put-string.")

(defun put-string (string &optional (language *default-language*))
 ;;; DI: Check for language (hyphenation pattern is absent for Russian).
  (when (stringp string)
    (let ((hyphen-points (when language (hyphenate-string string
language))))
      (loop with hyphen-point = (pop hyphen-points)
          for prev-char = #\I then char
          for char across string
          for i from 0
          for kerning = (* (pdf:get-kerning prev-char char *font*
*font-size*) *text-x-scale*)
          do
     (when (and hyphen-point (= i hyphen-point))
       (setf hyphen-point (pop hyphen-points))
       (add-box (make-instance 'hyphen-box :char-box (make-char-box #\-))))
     (cond
      ((white-char-p char)
       (cond
        ((white-char-p prev-char) nil)
        ((punctuation-mark-p prev-char)(add-box (make-punctuation-space-box
prev-char)))
        (t (add-box (make-white-char-box #\Space)))))
      (t (unless (zerop kerning)
    (add-box (make-kerning-space kerning)))
  (add-box (make-char-box char))
  (add-box (make-inter-char-glue))))))))

AFAIU, you should not worry about my version of hyphenate-string.
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru




More information about the cl-typesetting-devel mailing list