]> git.donarmstrong.com Git - lilypond.git/commitdiff
(text): split string into spaces, use moveto
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 10 Apr 2004 22:49:06 +0000 (22:49 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 10 Apr 2004 22:49:06 +0000 (22:49 +0000)
for setting space.

ChangeLog
lily/scaled-font-metric.cc
scm/output-ps.scm

index f12bc4c1c7950585209c68ec23b2d9f371d19f0a..c34663cc5d4892d8f44de3492d3cb0558c2271ba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-04-11  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * scm/output-ps.scm (text): split string into spaces, use moveto
+       for setting space. 
+       
 2004-04-10  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * po/nl.po: Update.
index c1425400edc9b35bf07bceb990eb118f95f0d999..c3d9baa96e2e0d6894d51bb875cb6c83ae1ae6ec 100644 (file)
@@ -93,6 +93,12 @@ LY_DEFINE (ly_font_encoding_alist, "ly:font-encoding-alist",
 SCM
 Modified_font_metric::make_scaled_font_metric (SCM coding, Font_metric *m, Real s)
 {
+  /*
+    UGOHR.
+   */
+  if (is_symbol (coding))
+    coding = scm_symbol_to_string (coding);
+  
   String scheme = ly_scm2string (coding);
   
   Modified_font_metric *sfm = new Modified_font_metric (scheme, m, s);
index 0e75869197ebda574c9c188d42989c42c4555dd2..71e4a214645593ab27460d932ccf7a0e16dca0cb 100644 (file)
    " draw_symmetric_x_triangle"))
 
 (define (text font s)
-  (string-append (font-command font) " setfont "
-                "(" (ps-encoding s) ") show"))
+  (let*
+      
+      (
+       ;; ugh, we should find a better way to
+       ;; extract the hsbw for /space from the font.
+       
+       (space-length (cdar (ly:text-dimension font "t"))) 
+       (commands '())
+       (add-command (lambda (x) (set! commands (cons x commands)))) )
+
+    (string-fold
+     (lambda (chr word)
+       "Translate space as into moveto, group the rest in words."
+       (if (and (< 0 (string-length word))
+               (equal? #\space  chr))
+          (add-command 
+           (string-append "(" (ps-encoding word) ") show\n")))
+
+       (if (equal? #\space  chr)
+          (add-command  (string-append (number->string space-length) " 0.0 rmoveto ")) )
+       
+       (if (equal? #\space  chr)
+          ""
+          (string-append word (make-string 1 chr))))
+     ""
+     (string-append  s " "))
 
+    (string-append
+     (font-command font) " setfont "
+     (string-join (reverse commands)))
+    ))
+  
 (define (unknown) 
   "\n unknown\n")