Hi Alex,

current @lib/ps.l does not deal with utf well enough and comes with a
workaround involving bin/lat1.

Bellow is a prototype code for displaying utf characters in poscript
insired by
https://mailman.research.att.com/pipermail/graphviz-interest/2004q2/001407.html

# *PsGlyph

(in "glyphlist.txt"
   (until (eof)
      (let L (line)
         (unless (= "#" (car L))
            (let (I (index ";" L)
                  G (pack (head (- I 1) L))
                  H (hex (pack (tail (- I) L))) )
               (let A (assoc H *PsGlyph)
                  (if A
                     (con A (cons G (cdr A)))
                     (push '*PsGlyph (list H G)) ) ) ) ) ) ) )

(de psString (S)
   (prin "(")
   (for X (if (atom S) (chop S) S)
      (let C (char X)
         (cond
            ((< C 32) # control char
               (case X
                  ("^M" (prin "\\r"))
                  ("^J" (prin "\\n"))
                  ("^I" (prin "\\t")) ) )
            ((<= 32 C 126) # ascii
               (prin (case X
                        ("\\" "\\\\")
                        ("(" "\\(")
                        (")" "\\)")
                        (T X) ) ) )
            ((<= 130 C) # utf
               (let? L (cdr (assoc C *PsGlyph))
                  (prinl ")")
                  (prin "[")
                  (for G L
                     (prin " /" G) )
                  (prinl "] {glyphshow} forall")
                  (prin "(") ) )
            (T
               (prinl ")")
               (prinl "/.notdef glyphshow")
               (prin "(") ) ) ) )
   (prinl ")") )

(de psLabel (X Y Text Center)
   (if Center
      (prog # http://www.postscript.org/FAQs/language/node67.html
         (prinl X " " Y " moveto")
         (psString Text)
         (prinl "dup stringwidth pop 2 div neg 0 rmoveto show") )
      (prinl "newpath " X " " Y " moveto")
      (psString Text)
      (prinl "show") ) )

glyphlist.txt from adobe
http://www.adobe.com/devnet/opentype/archives/glyphlist.txt is needed
and has to be converted to utf8.

I am not sure about Japanese but it works with Czech;-)

However, centering unicode/non-ascii characters does not work.  Any
ideas how to achieve that?

Thank you,

Tomas
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to