]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/font-metric.cc (ly:font-get-glyph-index): New function.
authorJan Nieuwenhuizen <janneke@gnu.org>
Sat, 11 Dec 2004 18:36:40 +0000 (18:36 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sat, 11 Dec 2004 18:36:40 +0000 (18:36 +0000)
* scm/output-gnome.scm (named-glyph): Use it.

* scm/lily.scm (ly:all-stencil-expressions): Add named-glyph.

ChangeLog
lily/font-metric.cc
scm/font.scm
scm/lily.scm
scm/output-gnome.scm

index ef7e2641f112f449ecc4bf09f97438c5c10dc6ea..6ce1039a1659df5f24064a3d4ca0bce573c85efb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2004-12-11  Jan Nieuwenhuizen  <janneke@gnu.org>
 
+       * lily/font-metric.cc (ly:font-get-glyph-index): New function.
+
+       * scm/output-gnome.scm (named-glyph): Use it.
+
+       * scm/lily.scm (ly:all-stencil-expressions): Add named-glyph.
+
        * flower/string.cc (substitute_char): Rename, rewrite, modify this.
        (upper_string, lower_string, reverse_string): Remove.
 
index 0bf62ae2a0e4d8e17c022185a8f14ad13208772b..0bfbca0adeb176c8c499b64dfa0fbf4693cc3be4 100644 (file)
@@ -161,6 +161,18 @@ LY_DEFINE (ly_get_glyph, "ly:get-glyph",
   return fm->get_ascii_char_stencil (scm_to_int (index)).smobbed_copy ();
 }
 
+LY_DEFINE (ly_font_get_glyph_index, "ly:font-get-glyph-index",
+          2, 0, 0,
+         (SCM font, SCM name),
+          "Return the index for @{name} in @var{font}.")
+{
+  Font_metric *fm = unsmob_metrics (font);
+  SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
+  SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG2, __FUNCTION__, "string");
+
+  return scm_from_int (fm->name_to_index (ly_scm2string (name)));
+}
+
 LY_DEFINE (ly_text_dimension,"ly:text-dimension",
           2, 0, 0,
          (SCM font, SCM text),
index c804c7a77b6564e02c9cfe69d427e28d073e37a3..ed52fb06136f2c45cdc3a97dd3ee019722e041d4 100644 (file)
                  ,(delay (ly:make-virtual-font
                           (ly:font-load "feta20")
                           (ly:font-load "parmesan20")))
-;                ,(delay (ly:make-virtual-font (ly:font-load "bigcheese20")))
+                 ,(delay (ly:make-virtual-font (ly:font-load "bigcheese20")))
                  ,(delay (ly:make-virtual-font
                           (ly:font-load "feta23")
                           (ly:font-load "parmesan23")))
index 074fa58e4c9bbca5251013bf85b532f2aed1e7a3..e7ee977ce81475cc2b952133969a180d6c9f059e 100644 (file)
@@ -128,6 +128,7 @@ predicates. Print a message at LOCATION if any predicate failed."
     ez-ball
     filledbox
     horizontal-line
+    named-glyph
     polygon
     repeat-slash
     round-filled-box
index 1ce2965e5d37971c6bede63d2db962500e9b81f8..9a7af133c4512837d745ef0972fbb58e6f37025a 100644 (file)
@@ -315,14 +315,15 @@ lilypond -fgnome input/simple-song.ly
     (lineto def tx (- ty))
     (set-path-def props def)
     props))
-    
 
 (define (list->offsets accum coords)
   (if (null? coords)
       accum
       (cons (cons (car coords) (cadr coords))
-           (list->offsets accum (cddr coords))
-      )))
+           (list->offsets accum (cddr coords)))))
+
+(define (named-glyph font name)
+  (text font (integer->char (ly:font-get-glyph-index font name))))
 
 (define (polygon coords blotdiameter)
   (let*