[cl-pdf-devel] on escaping parentheses and backslashes

Aleksandar Bakic a_bakic at yahoo.com
Tue Nov 29 23:49:15 UTC 2005


Hi,

Another patch on the same topic. There are still problems: ccaron is rendered
as Cdot by acroread (using the original windows fonts). The same happens with
pdf2ps. xpdf renders ccaron fine.

Alex

Index: pdf-base.lisp
===================================================================
--- pdf-base.lisp       (revision 110)
+++ pdf-base.lisp       (working copy)
@@ -27,9 +27,15 @@
       (loop for c across string do
           (let* ((code (char-code c))
                  (hi (ldb (byte 8 8) code))
-                 (lo (ldb (byte 8 0) code)))
-            (write-char (code-char hi) *page-stream*)
-            (write-char (code-char lo) *page-stream*)))
+                 (lo (ldb (byte 8 0) code))
+                 (chi (code-char hi))
+                 (clo (code-char lo)))
+            (when (find chi "\\()" :test #'char=)
+              (write-char #\\ *page-stream*))
+            (write-char chi *page-stream*)
+            (when (find clo "\\()" :test #'char=)
+              (write-char #\\ *page-stream*))
+            (write-char clo *page-stream*)))
       (princ string *page-stream*))
   (write-string ") " *page-stream*))
 
@@ -38,9 +44,15 @@
   (if (and *font* (typep (font-metrics *font*) 'ttu-font-metrics))
       (let* ((code (char-code char))
              (hi (ldb (byte 8 8) code))
-             (lo (ldb (byte 8 0) code)))
-        (write-char (code-char hi) *page-stream*)
-        (write-char (code-char lo) *page-stream*))
+             (lo (ldb (byte 8 0) code))
+            (chi (code-char hi))
+            (clo (code-char lo)))
+       (when (find chi "\\()" :test #'char=)
+         (write-char #\\ *page-stream*))
+        (write-char chi *page-stream*)
+       (when (find clo "\\()" :test #'char=)
+         (write-char #\\ *page-stream*))
+        (write-char clo *page-stream*))
       (write-char char *page-stream*))
   (write-string ") " *page-stream*))



	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com



More information about the cl-pdf-devel mailing list