]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/lily-guile.cc (ly:number->string): Do not leave space at
authorJan Nieuwenhuizen <janneke@gnu.org>
Fri, 19 Mar 2004 12:20:35 +0000 (12:20 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Fri, 19 Mar 2004 12:20:35 +0000 (12:20 +0000)
end, prepend zeros.

* scm/output-ps.scm (define-fonts): Always scale by designsize.
Fixes feta-nummer, feta-din scaling.

ChangeLog
lily/lily-guile.cc
lily/paper-outputter.cc
scm/output-lib.scm
scm/output-pdf.scm
scm/output-pdftex.scm
scm/output-ps.scm
scm/output-sketch.scm
scm/output-sodipodi.scm
scm/output-tex.scm

index 2b2bba0b1f5e1ced2184162aef4c050f555d7acc..f7dd3e48dc55475d120be88e515944c6d5bd446f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2004-03-19  Jan Nieuwenhuizen  <janneke@gnu.org>
 
+       * lily/lily-guile.cc (ly:number->string): Do not leave space at
+       end, prepend zeros.
+
+       * scm/output-*.scm: Use ly:number->string rather than
+       number->string.  Makes for saner output.
+
        * scm/output-ps.scm (define-fonts): Always scale by designsize.
        Fixes feta-nummer, feta-din scaling.
 
index 954ef38c5813249ee28736869e29530e55063ea7..3b2b85640218c5aa473d0f9b27a2d89e85563d06 100644 (file)
@@ -314,10 +314,9 @@ ly_scm2offset (SCM s)
 }
 
    
-LY_DEFINE (ly_number2string,  "ly:number->string", 1, 0,0,
-         (SCM s),
-         " converts @var{num} to a string without generating many decimals. It "
-"leaves a space at the end.")
+LY_DEFINE (ly_number2string, "ly:number->string",
+          1, 0, 0, (SCM s),
+          "Convert @var{num} to a string without generating many decimals.")
 {
   SCM_ASSERT_TYPE (gh_number_p (s), s, SCM_ARG1, __FUNCTION__, "number");
 
@@ -333,12 +332,10 @@ LY_DEFINE (ly_number2string,  "ly:number->string", 1, 0,0,
          r = 0.0;
        }
 
-      sprintf (str, "%8.4f ", r);
+      sprintf (str, "%08.4f", r);
     }
   else
-    {
-      sprintf (str, "%d ", gh_scm2int (s));
-    }
+    sprintf (str, "%d", gh_scm2int (s));
 
   return scm_makfrom0str (str);
 }
index a5a4205530f34de48c7bd357dedcafc120575c25..e544f472cfc4f969a4701c3cbe1c158f601ba0ef 100644 (file)
@@ -67,11 +67,11 @@ Paper_outputter::Paper_outputter (String name)
        "ly:gulp-file",
        "ly:number->string",
        
-       "number-pair->string",       /* output-lib.scm */
-       "numbers->string",
+       "ly:number-pair->string",    /* output-lib.scm */
+       "ly:numbers->string",
+       "ly:inexact->string",
        
        "assoc-get",
-       "inexact->string",           /* insecure guile? */
 #if IMPORT_LESS        
        "string-index",              /* from srfi srfi-13 */
        "regexp-substitute/global",  /* from (ice9 regex) */
index b31d0bed133e757eea1f0eb62a2c1533e9a6b8a8..e4a9557b46a3b5469bbb69955436902c64f8fb1a 100644 (file)
@@ -88,7 +88,7 @@
  )
 
 (define-public (arg->string arg)
-  (cond ((number? arg) (inexact->string arg 10))
+  (cond ((number? arg) (ly:inexact->string arg 10))
        ((string? arg) (string-append "\"" arg "\""))
        ((symbol? arg) (string-append "\"" (symbol->string arg) "\""))))
 
 ;; do nothing in .scm output
 (define-public (comment s) "")
 
-(define-public (numbers->string lst)
-  (apply string-append (map ly:number->string lst)))
+(define-public (ly:numbers->string lst)
+  (apply string-append
+        (map (lambda (x) (string-append (ly:number->string x) " "))  lst)))
 
 (define (number->octal-string x)
   (let* ((n (inexact->exact x))
      (number->string n8)
      (number->string (remainder (- n (+ (* n64 64) (* n8 8))) 8)))))
 
-(define-public (inexact->string x radix)
+(define-public (ly:inexact->string x radix)
   (let ((n (inexact->exact x)))
     (number->string n radix)))
 
-
-(define-public (number-pair->string c)
+(define-public (ly:number-pair->string c)
   (string-append (ly:number->string (car c)) " "
                 (ly:number->string (cdr c)) " "))
 
index 051d29d751deced73043c498a3fd5273b5f0f732..81ffdb0489e43b9988fef02f43ba45c800066e32 100644 (file)
@@ -24,7 +24,7 @@
 
 (define currentpoint (cons 0 0))
 (define (showcp) 
-  (string-append (number-pair->string currentpoint) " "))
+  (string-append (ly:number-pair->string currentpoint) " "))
 (define (moveto x y)
   (set! currentpoint (cons x y))
   (string-append (showcp) "m "))
   (lineto (+ x (car currentpoint)) (+ y (cdr currentpoint))))
 (define (curveto x1 y1 x2 y2 x y)
   (set! currentpoint (cons x y))
-  (string-append (ly:number->string x1) (ly:number->string y1)
-                (ly:number->string x2) (ly:number->string y2)
-                (ly:number->string x) (ly:number->string y) "c "))
+  (string-append (ly:number->string x1) " " (ly:number->string y1) " "
+                (ly:number->string x2) " " (ly:number->string y2) " "
+                (ly:number->string x) " " (ly:number->string y) " c "))
 (define (curveto-pairs pt1 pt2 pt)
   (curveto (car pt1) (cdr pt1) (car pt2) (cdr pt2) (car pt) (cdr pt)))
 (define (closefill) "h f ")
 (define (closestroke) "S ")
-(define (setlinewidth w) (string-append (ly:number->string w) "w "))
-(define (setgray g) (string-append (ly:number->string g) "g "))
+(define (setlinewidth w) (string-append (ly:number->string w) " w "))
+(define (setgray g) (string-append (ly:number->string g) " g "))
 (define (setlineparams) "1 j 1 J ")
 
 (define (beam width slope thick blot)
 (define (experimental-on) "")
 
 (define (filledbox breadth width depth height) 
-  (string-append (ly:number->string (- breadth))
-                (ly:number->string (- depth))
-                (ly:number->string (+ breadth width))
+  (string-append (ly:number->string (- breadth)) " " 
+                (ly:number->string (- depth)) " "
+                (ly:number->string (+ breadth width)) " "
                 (ly:number->string (+ depth height))
                 " re f "))
 
 
 (define (invoke-char s i)
   (string-append 
-   "(\\" (inexact->string i 8) ") " s " " ))
+   "(\\" (ly:inexact->string i 8) ") " s " " ))
 
 (define (placebox x y s) "")
 
index 68425da5c692ea07289a283081ff79c4c3d027de..d7e6e259dda4acd730b8a6daf4160d71d09e58c5 100644 (file)
@@ -58,7 +58,7 @@
   (embedded-pdf (list 'dashed-slur   thick dash l)))
 
 (define (char i)
-  (string-append "\\char" (inexact->string i 10) " "))
+  (string-append "\\char" (ly:inexact->string i 10) " "))
 
 (define (dashed-line thick on off dx dy)
   (embedded-pdf (list 'dashed-line  thick on off dx dy)))
@@ -68,7 +68,7 @@
    "\\font\\" command "="
    (car name-mag)
    " scaled "
-   (ly:number->string (inexact->exact (* 1000  (cdr name-mag))))
+   (ly:number->string (inexact->exact (* 1000 (cdr name-mag))))
    "\n"))
 
 (define (ez-ball c l b)
 
 (define (invoke-char s i)
   (string-append 
-   "\n\\" s "{" (inexact->string i 10) "}" ))
+   "\n\\" s "{" (ly:inexact->string i 10) "}" ))
 
 ;; FIXME: explain ploblem: need to do something to make this really safe.  
 (define (output-tex-string s)
index 4ad9a06802cfcf9857607f323b700a97a53231dc..b3de105c1c46c8fa56e18201055c57f5edb75969 100644 (file)
 
 (define (ps-number-def prefix key val)
   (let ((s (if (integer? val)
-              (number->string val)
-              (number->string (exact->inexact val)))))
+              (ly:number->string val)
+              (ly:number->string (exact->inexact val)))))
     (string-append "/" prefix (symbol->string key) " " s " def\n")))
 
 (define (tex-font? fontname)
 ;;; Output-interface functions
 (define (beam width slope thick blot)
   (string-append
-   (numbers->string (list slope width thick blot)) " draw_beam" ))
+   (ly:numbers->string (list slope width thick blot)) " draw_beam" ))
 
 ;; two beziers
 (define (bezier-sandwich l thick)
   (string-append 
-   (apply string-append (map number-pair->string l))
+   (apply string-append (map ly:number-pair->string l))
    (ly:number->string thick)
    " draw_bezier_sandwich "))
 
 (define (bracket arch_angle arch_width arch_height  height arch_thick thick)
   (string-append
-   (numbers->string
+   (ly:numbers->string
     (list arch_angle arch_width arch_height height arch_thick thick))
    " draw_bracket"))
 
 (define (char i)
   (string-append 
-   "(\\" (inexact->string i 8) ") show " ))
+   "(\\" (ly:inexact->string i 8) ") show " ))
 
 (define (comment s)
   (string-append "% " s "\n"))
 ;; what the heck is this interface ?
 (define (dashed-slur thick dash l)
   (string-append 
-   (apply string-append (map number-pair->string l)) 
+   (apply string-append (map ly:number-pair->string l)) 
    (ly:number->string thick) 
    " [ "
    (ly:number->string dash)
           (scaling (cdr value)))
       (cons key (cons value
                      (string-append
-                      "lilyfont" fontname "-" (number->string scaling))))))
+                      "lilyfont" fontname "-" (ly:number->string scaling))))))
 
   (set! font-name-alist
        (map ps-encoded-fontswitch internal-external-name-mag-pairs))
 (define (dot x y radius)
   (string-append
    " "
-   (numbers->string
+   (ly:numbers->string
     (list x y radius)) " draw_dot"))
 
 (define (draw-line thick x1 y1 x2 y2)
 (define (ez-ball ch letter-col ball-col)
   (string-append
    " (" ch ") "
-   (numbers->string (list letter-col ball-col))
+   (ly:numbers->string (list letter-col ball-col))
    " /Helvetica-Bold " ;; ugh
    " draw_ez_ball"))
 
 (define (filledbox breapth width depth height) 
-  (string-append (numbers->string (list breapth width depth height))
+  (string-append (ly:numbers->string (list breapth width depth height))
                 " draw_box"))
 
 (define (fontify name-mag-pair exp)
 (define (polygon points blotdiameter)
   (string-append
    " "
-   (numbers->string points)
+   (ly:numbers->string points)
    (ly:number->string (/ (length points) 2))
    (ly:number->string blotdiameter)
    " draw_polygon"))
 
 (define (repeat-slash wid slope thick)
   (string-append
-   (numbers->string (list wid slope thick))
+   (ly:numbers->string (list wid slope thick))
    " draw_repeat_slash"))
 
 (define (round-filled-box x y width height blotdiam)
    (string-append
     " "
-    (numbers->string
+    (ly:numbers->string
      (list x y width height blotdiam)) " draw_round_box"))
 
 (define (new-start-system origin dim)
   (string-append
-   "\n" (number-pair->string origin) " start-system\n"
+   "\n" (ly:number-pair->string origin) " start-system\n"
    "{\n"
    "set-ps-scale-to-lily-scale\n"))
 
 (define (stem breapth width depth height) 
   (string-append
-   (numbers->string (list breapth width depth height))
+   (ly:numbers->string (list breapth width depth height))
    " draw_box" ))
 
 (define (stop-system)
 
 (define (symmetric-x-triangle thick w h)
   (string-append
-   (numbers->string (list h w thick))
+   (ly:numbers->string (list h w thick))
    " draw_symmetric_x_triangle"))
 
 (define (text s)
index 94a1383c8118d84f4f437beeb0bd2df7b4454c8c..89f7dc6ef7dc00790f837316613baea401ebe818 100644 (file)
@@ -99,7 +99,7 @@
 ;;; urg.
 (define (sketch-numbers->string l)
   (string-append
-   (number->string (car l))
+   (ly:number->string (car l))
    (if (null? (cdr l))
        ""
        (string-append ","  (sketch-numbers->string (cdr l))))))
 
 (define (bracket arch_angle arch_width arch_height  height arch_thick thick)
   (string-append
-   (numbers->string (list arch_angle arch_width arch_height height arch_thick thick)) " draw_bracket" ))
+   (ly:numbers->string (list arch_angle arch_width arch_height height arch_thick thick)) " draw_bracket" ))
 
 (define (char x y i)
   (string-append
 ;; what the heck is this interface ?
 (define (dashed-slur thick dash l)
   (string-append 
-   (apply string-append (map number-pair->string l)) 
+   (apply string-append (map ly:number-pair->string l)) 
    (ly:number->string thick) 
    " [ "
    (ly:number->string dash)
    " ] 0 draw_dashed_line"))
 
 (define (repeat-slash wid slope thick)
- (string-append (numbers->string (list wid slope thick))
+ (string-append (ly:numbers->string (list wid slope thick))
   " draw_repeat_slash"))
 
 (define (end-output)
@@ -327,7 +327,7 @@ layer('Layer 1',1,1,0,0,(0,0,0))
 (define (ez-ball ch letter-col ball-col)
   (string-append
    " (" ch ") "
-   (numbers->string (list letter-col ball-col))
+   (ly:numbers->string (list letter-col ball-col))
    " /Helvetica-Bold " ;; ugh
    " draw_ez_ball"))
 
index 68a878d5e6c7b92d25efb99072fbcdfa78efe858..5d79103a5f6f6f9fe58f2ae52d238570e8bd08c5 100644 (file)
 (define (control-flip-y c)
   (cons (car c) (* -1 (cdr c))))
 
-(define (numbers->string l)
+(define (ly:numbers->string l)
   (string-append
    (number->string (car l))
    (if (null? (cdr l))
        ""
-       (string-append ","  (numbers->string (cdr l))))))
+       (string-append ","  (ly:numbers->string (cdr l))))))
 
 (define (svg-bezier l close)
   (let* ((c0 (car (list-tail l 3)))
index 32aa45778e946f5a3c3b1e1e24472f1d8683b723..7f8259d4a4417569d963b9cb4bd93e5e3c7eba50 100644 (file)
   (embedded-ps (list 'dashed-slur thick dash `(quote ,l))))
 
 (define (char i)
-  (string-append "\\char" (inexact->string i 10) " "))
+  (string-append "\\char" (ly:inexact->string i 10) " "))
 
 (define (dashed-line thick on off dx dy)
   (embedded-ps (list 'dashed-line  thick on off dx dy)))
    "\\font\\" command "="
    (car name-mag)
    " scaled "
-   (ly:number->string (inexact->exact (round (* 1000  (cdr name-mag)))))
+   (ly:number->string (inexact->exact (round (* 1000 (cdr name-mag)))))
    "\n"))
 
 (define (ez-ball c l b)
 
 (define (invoke-char s i)
   (string-append 
-   "\n\\" s "{" (inexact->string i 10) "}" ))
+   "\n\\" s "{" (ly:inexact->string i 10) "}" ))
 
 ;; FIXME: explain ploblem: need to do something to make this really safe.  
 (define-public (output-tex-string s)
 (define (filledbox breapth width depth height)
   (if (and #f (defined? 'ps-testing))
       (embedded-ps
-       (string-append (numbers->string (list breapth width depth height))
+       (string-append (ly:numbers->string (list breapth width depth height))
                      " draw_box" ))
       (string-append "\\lyvrule{"
                     (ly:number->string (- breapth)) "}{"