]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.96.jcn6
authorJan Nieuwenhuizen <janneke@gnu.org>
Sat, 21 Oct 2000 13:50:52 +0000 (15:50 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sat, 21 Oct 2000 13:50:52 +0000 (15:50 +0200)
VERSION
input/test/markup.ly
lily/include/text-item.hh
lily/lookup.cc
lily/text-item.cc
scm/font.scm

diff --git a/VERSION b/VERSION
index 444172cee6068a1deec3a4d8cd72a768c0033632..40bf8d0b734d84a9d4272ad3f0e32daa7b510e23 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
 PATCH_LEVEL=96
-MY_PATCH_LEVEL=jcn5
+MY_PATCH_LEVEL=jcn6
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index 9b3e531c11295664ef84a2a18b9e29452b4a1aba..5d8f0a0566e2518ff1dfdd07f1ef6ccab90b4ef6 100644 (file)
@@ -9,9 +9,10 @@
                c-\textscript #'(bold "textb")
                d-\textscript #'(lines "een" "twee" "drie")
                e-\textscript #'(lines (bold "een") 
-                 (rows "en" "dat" "is" ((family . "orator") "2"))
+                 (rows "en" "dat" "is" ((family . "number") "2"))
                  (italic "drie"))
                f-\textscript #'(finger "3")
+               g-\textscript #'(music (named "noteheads-2"))
        }
        \paper{
                linewidth = -1.\mm;
@@ -20,6 +21,7 @@
                        TextScript \push #'style-sheet = #'paper16
                        TextScript \push #'font-family = #'roman
                        TextScript \pop #'no-spacing-rods
+                       TextScript \push #'direction = #1
                }
        }
 }
index 1f8beff7dd282081dfd12f41415247f09e44d0f9..507627b5a2b0e3558b6d1fcc1be02e76fcd74daf 100644 (file)
@@ -20,6 +20,8 @@ public:
   static Molecule text2molecule (Score_element *me, SCM text, SCM properties);
   static Molecule string2molecule (Score_element *me, SCM text, SCM properties);
   static Molecule markup_sentence2molecule (Score_element *me, SCM markup_sentence, SCM properties);
+  static Molecule lookup_character (Score_element *me, SCM font_name, SCM text);
+  static Molecule lookup_text (Score_element *me, SCM font_name, SCM char_name);
 };
 
 #endif /* TEXT_ITEM */
index ef4089ca36be7d2cda60993e51708911fa2c9dc2..4396bd92ec08b7df187e606f9722c0e6fdf41346 100644 (file)
@@ -237,15 +237,6 @@ sanitise_TeX_string (String text)
   return text;
 }
 
-/**
-   JUNKME
- */
-String
-sanitise_PS_string (String t)
-{
-  return t;
-}
-
 /**
    JUNKME
 */
@@ -306,8 +297,6 @@ Lookup::text (String style, String text, Paper_def *paper_l)
       String str (lines[i]);
       if (output_global_ch == "tex")
        str = sanitise_TeX_string  (str);
-      else if (output_global_ch == "ps")
-       str = sanitise_PS_string (str);
       lines[i] = str;
     }
 
index c715035e4954d9c1d0853ce2d1f78601328582e8..dda7728f25c8fbb40a1b47474bd6fd02066208f9 100644 (file)
@@ -7,6 +7,7 @@
   Jan Nieuwenhuizen <janneke@gnu.org>
  */
 
+#include "debug.hh"
 #include "text-item.hh"
 #include "paper-def.hh"
 #include "lookup.hh"
@@ -70,23 +71,70 @@ Text_item::string2molecule (Score_element *me, SCM text, SCM properties)
       SCM f = me->get_elt_property ("properties-to-font-name");
       font_name = gh_call2 (f, paper, properties);
     }
-  String font_str = "roman";
-  if (gh_string_p (font_name))
-    font_str = ly_scm2string (font_name);
+   
+  // should move fallback to scm
+  if (!gh_string_p (font_name))
+    font_name = ly_str02scm ("cmr10");
     
-  SCM magnification = me->get_elt_property ("font-magnification");
+  SCM lookup = scm_assoc (ly_symbol2scm ("lookup"), properties);
 
-  Font_metric* metric_l = 0;
-  if (gh_number_p (magnification))
-    metric_l = all_fonts_global_p->find_scaled (font_str,
-                                               gh_scm2int (magnification));
+  Molecule mol;
+  if (gh_pair_p (lookup) && ly_symbol2string (gh_cdr (lookup)) == "name")
+    mol = lookup_character (me, font_name, text);
   else
-    metric_l = all_fonts_global_p->find_font (font_str);
+    mol = lookup_text (me, font_name, text);
+  
+  return mol;
+}
 
-  SCM list = gh_list (ly_symbol2scm ("text"), text, SCM_UNDEFINED);
-  list = fontify_atom (metric_l, list);
+/*
+  caching / use some form of Lookup without 'paper'?
+*/
+Molecule
+Text_item::lookup_character (Score_element *me, SCM font_name, SCM char_name)
+{
+  Adobe_font_metric *afm = all_fonts_global_p->find_afm (ly_scm2string (font_name));
+
+  if (!afm)
+    {
+      warning (_f ("can't find font: `%s'", ly_scm2string (font_name)));
+      warning (_f ("(search path: `%s')", global_path.str ().ch_C()));
+      error (_ ("Aborting"));
+    }
+  
+  AFM_CharMetricInfo const *metric =
+    afm->find_char_metric (ly_scm2string (char_name), true);
+
+  if (!metric)
+    {
+      Molecule m;
+      m.set_empty (false);
+      return m;
+    }
 
-  return Molecule (metric_l->text_dimension (ly_scm2string (text)), list);
+  SCM list = gh_list (ly_symbol2scm ("char"),
+                     gh_int2scm (metric->code),
+                     SCM_UNDEFINED);
+  
+  list = fontify_atom (afm, list);
+  return Molecule (afm_bbox_to_box (metric->charBBox), list);
+}
+
+Molecule
+Text_item::lookup_text (Score_element *me, SCM font_name, SCM text)
+{
+  SCM magnification = me->get_elt_property ("font-magnification");
+  Font_metric* metric = 0;
+  if (gh_number_p (magnification))
+    metric = all_fonts_global_p->find_scaled (ly_scm2string (font_name),
+                                             gh_scm2int (magnification));
+  else
+    metric = all_fonts_global_p->find_font (ly_scm2string (font_name));
+  
+  SCM list = gh_list (ly_symbol2scm ("text"), text, SCM_UNDEFINED);
+  list = fontify_atom (metric, list);
+  
+  return Molecule (metric->text_dimension (ly_scm2string (text)), list);
 }
 
 Molecule
index 96a8cb521b8d9180bdb62a54fde6eb5b03020c9e..403cca53991118bc0ed777b0cb734f647abb6199 100644 (file)
 
 (define style-to-font-alist
   '(
-    (finger . "* * orator * * -4")
-    (volta . "* * orator * * -3")
-    (timesig . "* * orator * * 0")
-    (mark . "* * orator * * 2")
+    (finger . "* * number * * -4")
+    (volta . "* * number * * -3")
+    (timesig . "* * number * * 0")
+    (mark . "* * number * * 2")
     (script . "* * roman * * -1")
     (large . "* * roman * * 1")
     (Large . "bold * roman * * 2")
     (("medium upright braces feta-braces 20" . 0) . "feta-braces20")
     (("bold italic dynamic feta 10" . 0) . "feta-din10")
     ;; Hmm
-    (("medium upright orator feta-nummer 13" . 3) . "feta-nummer13")
-    (("medium upright orator feta-nummer 13" . 2) . "feta-nummer13")
-    (("medium upright orator feta-nummer 12" . 1) . "feta-nummer12")
-    (("medium upright orator feta-nummer 10" . 0) . "feta-nummer10")
-    (("medium upright orator feta-nummer 8" . -1) . "feta-nummer8")
-    (("medium upright orator feta-nummer 6" . -2) . "feta-nummer6")
-    (("medium upright orator feta-nummer 5" . -3) . "feta-nummer5")
-    (("medium upright orator feta-nummer 4" . -4) . "feta-nummer4")
-    (("medium upright orator feta-nummer 3" . -5) . "feta-nummer3")
+    (("medium upright number feta-nummer 13" . 3) . "feta-nummer13")
+    (("medium upright number feta-nummer 13" . 2) . "feta-nummer13")
+    (("medium upright number feta-nummer 12" . 1) . "feta-nummer12")
+    (("medium upright number feta-nummer 10" . 0) . "feta-nummer10")
+    (("medium upright number feta-nummer 8" . -1) . "feta-nummer8")
+    (("medium upright number feta-nummer 6" . -2) . "feta-nummer6")
+    (("medium upright number feta-nummer 5" . -3) . "feta-nummer5")
+    (("medium upright number feta-nummer 4" . -4) . "feta-nummer4")
+    (("medium upright number feta-nummer 3" . -5) . "feta-nummer3")
     (("medium upright roman cmr 8" . -1) . "cmr8" )
     (("medium upright roman cmr 10" . 0) . "cmr10")
     (("medium upright roman cmr 12" . 1) . "cmr12")
      (roman . (font-family . "roman"))
      (music . (font-family . "music"))
      (bold . (font-series . "bold"))
-     (italic . (font-shape . "italic")))
+     (italic . (font-shape . "italic"))
+     (named . (lookup . name))
+     (text . (lookup . value)))
    (map (lambda (x) (cons (car x) (cons 'font-style (car x))))
        style-to-font-alist)))