Hi Marc<br><br>I have the problem with unbalanced parentheses when use cl-pdf library (in revision 159).<br>This problem is solved in the cl-typesetting library (stroke.lisp):<br>  (when (find char "\\()" :test #'char=)<br>
     (push #\\ string))<br>No, that decision is  wrong. The problem is in the cl-pdf library and should be resolved there.<br><br><br><div><span class="gmail_quote">2008/1/20, Marc Battyani <<a href="mailto:marc.battyani@fractalconcept.com">marc.battyani@fractalconcept.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Andrey Moskvitin wrote:<br>> >>/ The example uses a unicode font and simply puts a string into the<br>> />>/ output document which contains #\Space #\(  #\) and a few other<br>> />>/ characters. Both parenthesis and space are needed to produce the wrong<br>
><br>> />>/ pdf./<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>><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>><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>><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>><br>><br>> --- /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>><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>><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>><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>><br>> +             (write-char (code-char lo) *page-stream*)))<br>
>        (princ string *page-stream*))<br>>    (write-string ") " *page-stream*))<br>><br>><br>Hi Andrey,<br><br>Thanks for this.<br>IIRC, I corrected this in revision 152 (october 14). Is this fix a<br>
complement to that fix or an alternative fix?<br><br>Marc<br><br><br></blockquote></div><br>