From: Han-Wen Nienhuys Date: Sat, 10 Apr 2004 22:49:06 +0000 (+0000) Subject: (text): split string into spaces, use moveto X-Git-Tag: release/2.3.0~27 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=014c016b2da8f43dcc618faf07c069cc43d24a62;p=lilypond.git (text): split string into spaces, use moveto for setting space. --- diff --git a/ChangeLog b/ChangeLog index f12bc4c1c7..c34663cc5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-04-11 Han-Wen Nienhuys + + * scm/output-ps.scm (text): split string into spaces, use moveto + for setting space. + 2004-04-10 Jan Nieuwenhuizen * po/nl.po: Update. diff --git a/lily/scaled-font-metric.cc b/lily/scaled-font-metric.cc index c1425400ed..c3d9baa96e 100644 --- a/lily/scaled-font-metric.cc +++ b/lily/scaled-font-metric.cc @@ -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); diff --git a/scm/output-ps.scm b/scm/output-ps.scm index 0e75869197..71e4a21464 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -403,9 +403,38 @@ " 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")