]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/output-ps.scm (new-text): new function. Use glyphshow to
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 19 Nov 2004 22:41:54 +0000 (22:41 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 19 Nov 2004 22:41:54 +0000 (22:41 +0000)
show glyphs.

* scm/encoding.scm (decode-byte-string): new function.

ChangeLog
VERSION
lily/font-select.cc
scm/encoding.scm
scm/lily-library.scm
scm/output-ps.scm

index fa9e180ed48126c7905cf69cb6b075c9fa17b483..8426c200123581b3f7ae6fa735b4e8c51d20ba58 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2004-11-19  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * scm/output-ps.scm (new-text): new function. Use glyphshow to
+       show glyphs.
+
+       * scm/encoding.scm (decode-byte-string): new function.
+
        * scripts/convert-ly.py (conv): add warning about
        set-global-staff-size.
 
diff --git a/VERSION b/VERSION
index 7a3bd85580899d34897020c184b964f0a8446897..eaee5216d67e8a92e25b7979d7c3f17228b7447d 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,6 +1,6 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=5
-PATCH_LEVEL=0
-MY_PATCH_LEVEL=hwn1
+PATCH_LEVEL=1
+MY_PATCH_LEVEL=
 
index 0613840b00a6b0e8bcb6ac0be78355a4d8a4ba99..5e40842d4c028827dc2e141ec1dba18956ca44ae 100644 (file)
@@ -87,7 +87,6 @@ get_font_by_design_size (Output_def *layout, Real requested,
   Font_metric *fm = unsmob_metrics (scm_force (SCM_VECTOR_REF (font_vector,
                                                               i)));
   return find_scaled_font (layout, fm, requested / size, input_encoding);
-
 }
 
 Font_metric*
index dc10d1f1167f4f1c1b87a6a4d9a0c2c7cc65cd8b..d22223f496d2248f023279516a79a4d401ff09fa 100644 (file)
@@ -63,10 +63,10 @@ vector of symbols."
 (define (get-coding-from-file file-name)
   "Read FILE-NAME, return a list containing encoding vector and table"
    (let* ((coding (read-encoding-file file-name))
-         (com (car coding))
-         (vec (cdr coding))
-         (tab (make-encoding-table vec)))
-    (list com vec tab)))
+         (command (car coding))
+         (vector (cdr coding))
+         (table (make-encoding-table vector)))
+    (list command vector table)))
 
 ;; coding-alist maps NAME -> (list FILE-NAME COMMAND VECTOR TAB)
 (define coding-alist
@@ -130,3 +130,23 @@ vector of symbols."
 
 (define-public (get-coding-table coding-name)
   (cadddr (get-coding coding-name)))
+
+
+(define-public (decode-byte-string encoding-name str)
+  "Return vector of glyphname symbols that correspond to string,
+assuming that STR is byte-coded using ENCODING-NAME."
+  
+  (let*
+      ((coding-vector (get-coding-vector encoding-name))
+       (len (string-length str))
+       (output-vector (make-vector len '.notdef))
+       )
+
+
+    (do
+       ((idx 0 (1+ idx)))
+       ((>= idx len) output-vector)
+      (vector-set! output-vector idx
+                    (vector-ref coding-vector
+                                (char->integer (string-ref str idx))))
+      )))
index 0ec8b3195d51a05134d7a7c09ad81f5bfdfed36e..acf7ff41e1029e70e852041305872c4c207380a5 100644 (file)
@@ -123,9 +123,17 @@ found."
       ))
  
 ;;;;;;;;;;;;;;;;
-;; hash
-
+;; vector
+(define-public (vector-for-each proc vec)
+  (do
+      ((i 0 (1+ i)))
+      ((>= i (vector-length vec)) vec)
+    
+    (vector-set! vec i
+                (proc (vector-ref vec i)))))
 
+;;;;;;;;;;;;;;;;
+;; hash
 
 (if (not (defined? 'hash-table?))      ; guile 1.6 compat
     (begin
index d9788b292ca819f57e36eb7d7d7042e89d8bff7b..8f937d79d8ff3a9395caee065564e03121219b54 100644 (file)
     (ly:numbers->string
      (list x y width height blotdiam)) " draw_round_box"))
 
-(define (text font s)
+(define (old-text font s)
   (let*
       
       ;; ugh, we should find a better way to
      (string-join (reverse commands)))
     ))
 
+(define (new-text font s)
+  (let*
+      ((space-length (cdar (ly:text-dimension font "t")))
+       (space-move (string-append (number->string space-length) " 0.0 rmoveto "))
+       
+       (input-enc (assoc-get 'input-name
+                            (ly:font-encoding-alist font)
+                            'latin1))
+       (out-vec (decode-byte-string input-enc s)))
+
+
+    (string-append
+     (ps-font-command font) " setfont "
+     (string-join
+      (vector->list
+       (vector-for-each
+       
+       (lambda (sym)
+         (if (eq? sym 'space)
+             space-move
+             (string-append "/" (symbol->string sym) " glyphshow")))
+       out-vec)))
+     )))
+
+(define text old-text)
 
 (define (white-text scale s)
    (let ((mystring (string-append "(" s  ") " (number->string scale)   " /Helvetica-bold "