<pre>>><i> The example uses a unicode font and simply puts a string into the<br></i>>><i> output document which contains #\Space #\( #\) and a few other<br></i>>><i> characters. Both parenthesis and space are needed to produce the wrong
<br></i>>><i> pdf.</i><br><br>> Unfortunately, the unicode integration is still in an alpha state as<br>> I've never found the time to continue it :(<br>> I will look at your example to see if I can make a fix for it.
<br><br>I encountered the same problem with unbalanced parentheses in text.<br><br>Sample code (Gentoo Linux, sbcl-1.0.12):<br><br>(pdf:load-ttu-font #P"/usr/local/fonts/arial.ufm" #P"/usr/local/fonts/arial.ttf")
<br><br>(with-open-file (out #P"/tmp/bad.pdf" :direction :output :if-exists :supersede :element-type :default :external-format :latin-1)<br> (pdf:with-document ()<br> (pdf:with-page ()<br> (pdf:in-text-mode
<br> (pdf:move-text 20 20)<br> (pdf:set-font (pdf:get-font "ArialMT") 12)<br> (pdf::show-text "hello (")))<br> (pdf:write-document out)))<br><br>The problem in the function of write-cid-string. I change it and solved the problem:
<br></pre><pre>--- /usr/share/common-lisp/source/cl-pdf/pdf-base.lisp 2007-10-10 12:50:45.000000000 +0000<br>+++ pdf-base.lisp 2007-12-29 16:38:18.000000000 +0000<br>@@ -25,11 +25,14 @@<br> (write-char #\( *page-stream*)
<br> (if (and *font* (typep (font-metrics *font*) 'ttu-font-metrics))<br> (loop for c across string do<br>- (let* ((code (char-code c))<br>- (hi (ldb (byte 8 8) code))<br>- (lo (ldb (byte 8 0) code)))
<br>- (write-char (code-char hi) *page-stream*)<br>- (write-char (code-char lo) *page-stream*)))<br>+ (let* ((code (char-code c))<br>+ (hi (ldb (byte 8 8) code))<br>+ (lo (ldb (byte 8 0) code))
<br>+ (is-bracket (or (eql c #\() (eql c #\)))))<br>+ (if is-bracket (write-char #\\ *page-stream*))<br>+ (write-char (code-char hi) *page-stream*)<br>+ (if is-bracket (write-char #\\ *page-stream*))
<br>+ (write-char (code-char lo) *page-stream*)))<br> (princ string *page-stream*))<br> (write-string ") " *page-stream*))<br><br><br><br>Andrey<br></pre>