]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scripts/ly2dvi.py: Add paper sizes.
authorJan Nieuwenhuizen <janneke@gnu.org>
Sat, 23 Nov 2002 16:40:52 +0000 (16:40 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sat, 23 Nov 2002 16:40:52 +0000 (16:40 +0000)
* lily/timing-engraver.cc:
* lily/time-signature.cc:
* lily/span-bar.cc:
* lily/grob-scheme.cc: Code formatting fixes.

* scm/sodipodi.scm:
* scm/sketch.scm:
* buildscripts/mf-to-table.py:
* buildscripts/make-font-dir.py: Font testing.

ChangeLog
buildscripts/make-font-dir.py
buildscripts/mf-to-table.py
lily/grob-scheme.cc
lily/span-bar.cc
lily/time-signature.cc
lily/timing-engraver.cc
scm/sketch.scm
scm/sodipodi.scm
scripts/ly2dvi.py

index d3b0bc2272404227d40cd8b675a1a26557d5d35f..82cb3d8c10670ba172bf8aa38f44098198176df0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2002-11-23  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * scripts/ly2dvi.py: Add paper sizes.
+
+       * lily/timing-engraver.cc: 
+       * lily/time-signature.cc: 
+       * lily/span-bar.cc: 
+       * lily/grob-scheme.cc: Code formatting fixes.
+
+       * scm/sodipodi.scm: 
+       * scm/sketch.scm:
+       * buildscripts/mf-to-table.py: 
+       * buildscripts/make-font-dir.py: Font testing.
+
 2002-11-23  Heikki Junes <hjunes@cc.hut.fi>
 
        * lilypond-mode.el (LilyPond-autocompletion): deletes end-of-word,
index be2be389d502ea627b01a9d77387748dccdba2f2..59939b2dbe2024ed6b842d40fd89a76fa892fd75 100644 (file)
@@ -83,7 +83,11 @@ class Font_info:
                if len (split) >= 4:
                        # Assume
                        #   Adobe FontName = X11 foundry-family-weight-style
-                       self.foundry, self.family = split[:2]
+                       if 1:
+                               self.foundry, self.family = split[:2]
+                       else: # testin'
+                               self.foundry = split[0]
+                               self.family = string.join (split[1:-2], ' ')
                        self.weight = string.join (split[2:-1], ' ')
                        self.style = split[-1:][0]
                        self.FamilyName = '%s %s' % (self.family, self.weight)
index 298311a0594df891d6c78919d2e051b0754e2ecc..0bb63b0412efa5b9532828180aba7c7d66a022c7 100644 (file)
@@ -86,12 +86,18 @@ def parse_logfile (fn):
                        font_family = (tags[3])
                        # To omit 'GNU' (foundry) from font name proper:
                        # name = tags[2:]
+                       #urg
+                       if 0: #testing
+                               tags.append ('Regular')
                        name = tags[1:]
                        global_info['FontName'] = string.join (name,'-')
                        global_info['FullName'] = string.join (name,' ')
                        global_info['FamilyName'] = string.join (name[1:-1],
                                                                 '-')
-                       global_info['Weight'] = tags[4]
+                       if 1:
+                               global_info['Weight'] = tags[4]
+                       else: #testing
+                               global_info['Weight'] = tags[-1]
                        global_info['FontBBox'] = '0 0 1000 1000'
                        global_info['Ascender'] = '0'
                        global_info['Descender'] = '0'
index f46fa63bdf0176601ae506cee4edee0b127871d7..6e36de07d4aa9c901f430a892cc60c5a641d172a 100644 (file)
@@ -5,13 +5,14 @@
 #include "paper-def.hh"
 #include "system.hh"
 
-LY_DEFINE(ly_set_grob_property,"ly:set-grob-property!", 3, 0, 0,
+
+LY_DEFINE (ly_set_grob_property,"ly:set-grob-property!", 3, 0, 0,
   (SCM grob, SCM sym, SCM val),
   "Set @var{sym} in grob @var{grob} to value @var{val}")
 {
   Grob * sc = unsmob_grob (grob);
-  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
-  SCM_ASSERT_TYPE(gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");  
+  SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+  SCM_ASSERT_TYPE (gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");  
 
   if (!type_check_assignment (sym, val, ly_symbol2scm ("backend-type?")))
     error ("typecheck failed");
@@ -20,7 +21,7 @@ LY_DEFINE(ly_set_grob_property,"ly:set-grob-property!", 3, 0, 0,
   return SCM_UNSPECIFIED;
 }
 
-LY_DEFINE(ly_get_grob_property,
+LY_DEFINE (ly_get_grob_property,
          "ly:get-grob-property", 2, 0, 0, (SCM grob, SCM sym),
          "Get the value of a value in grob @var{g} of property @var{sym}. It
 will return @code{'()} (end-of-list) if @var{g} doesn't have @var{sym} set.
@@ -46,75 +47,70 @@ initially read from @file{scm/grob-description.scm}.
 ")
 {
   Grob * sc = unsmob_grob (grob);
-  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
-  SCM_ASSERT_TYPE(gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");  
+  SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+  SCM_ASSERT_TYPE (gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");  
 
   return sc->internal_get_grob_property (sym);
 }
 
-LY_DEFINE(spanner_get_bound, "ly:get-spanner-bound", 2 , 0, 0,
-         (SCM slur, SCM dir),
-         "Get one of the bounds of @var{spanner}. @var{dir} may be @code{-1} for
-left, and @code{1} for right.
-")
+LY_DEFINE (spanner_get_bound, "ly:get-spanner-bound", 2 , 0, 0,
+          (SCM slur, SCM dir),
+          "Get one of the bounds of @var{spanner}. @var{dir} is @code{-1} "
+          "for left, and @code{1} for right.")
 {
   Spanner * sl = dynamic_cast<Spanner*> (unsmob_grob (slur));
-  SCM_ASSERT_TYPE(sl, slur, SCM_ARG1, __FUNCTION__, "spanner grob");
-  SCM_ASSERT_TYPE(ly_dir_p (dir), slur, SCM_ARG2, __FUNCTION__, "dir");
+  SCM_ASSERT_TYPE (sl, slur, SCM_ARG1, __FUNCTION__, "spanner grob");
+  SCM_ASSERT_TYPE (ly_dir_p (dir), slur, SCM_ARG2, __FUNCTION__, "dir");
   return sl->get_bound (to_dir (dir))->self_scm ();
 }
 
-/*
-  TODO: make difference between scaled and unscalead variable in
-  calling (i.e different funcs.)
- */
-LY_DEFINE(ly_get_paper_var,"ly:get-paper-variable", 2, 0, 0,
+/* TODO: make difference between scaled and unscalead variable in
+   calling (i.e different funcs.) */
+LY_DEFINE (ly_get_paper_var,"ly:get-paper-variable", 2, 0, 0,
   (SCM grob, SCM sym),
   "Get a variable from the \\paper block.")
 {
   Grob * sc = unsmob_grob (grob);
-  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
-  SCM_ASSERT_TYPE(gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");  
+  SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+  SCM_ASSERT_TYPE (gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");  
 
   return sc->get_paper () ->lookup_variable (sym);
 }
 
 
 
-LY_DEFINE(ly_get_extent, "ly:get-extent", 3, 0, 0,
-         (SCM grob, SCM refp, SCM axis),
-         "Get the extent in @var{axis} direction of @var{grob} relative to the
-grob @var{refp}")
+LY_DEFINE (ly_get_extent, "ly:get-extent", 3, 0, 0,
+          (SCM grob, SCM refp, SCM axis),
+          "Get the extent in @var{axis} direction of @var{grob} relative to "
+          "the grob @var{refp}")
 {
   Grob * sc = unsmob_grob (grob);
   Grob * ref = unsmob_grob (refp);
-  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
-  SCM_ASSERT_TYPE(ref, refp, SCM_ARG2, __FUNCTION__, "grob");
+  SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+  SCM_ASSERT_TYPE (ref, refp, SCM_ARG2, __FUNCTION__, "grob");
   
-  SCM_ASSERT_TYPE(ly_axis_p (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
+  SCM_ASSERT_TYPE (ly_axis_p (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
 
   return ly_interval2scm ( sc->extent (ref, Axis (gh_scm2int (axis))));
 }
 
-LY_DEFINE (ly_get_parent,   "ly:get-parent", 2, 0, 0, (SCM grob, SCM axis),
-          "Get the parent of @var{grob}.  @var{axis} can be 0 for the X-axis, 1
-for the Y-axis.")
+LY_DEFINE (ly_get_parent, "ly:get-parent", 2, 0, 0, (SCM grob, SCM axis),
+          "Get the parent of @var{grob}.  @var{axis} is 0 for the X-axis, "
+          "1 for the Y-axis.")
 {
   Grob * sc = unsmob_grob (grob);
-  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
-  SCM_ASSERT_TYPE(ly_axis_p (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
+  SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+  SCM_ASSERT_TYPE (ly_axis_p (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
 
   Grob * par = sc->get_parent (Axis (gh_scm2int (axis)));
-  return par ? par->self_scm() : SCM_EOL;
+  return par ? par->self_scm () : SCM_EOL;
 }
 
 /* ly prefix? */
 LY_DEFINE (get_system,
           "ly:get-system",
           1, 0, 0, (SCM grob),
-          "
-Return the System Grob of @var{grob}.
-")
+          "Return the System Grob of @var{grob}.")
 {
   Grob *me = unsmob_grob (grob);
   SCM_ASSERT_TYPE (me, grob, SCM_ARG1, __FUNCTION__, "grob");
@@ -129,9 +125,7 @@ Return the System Grob of @var{grob}.
 LY_DEFINE (get_original,
           "ly:get-original",
           1, 0, 0, (SCM grob),
-          "
-Return the original Grob of @var{grob}
-")
+          "Return the original Grob of @var{grob}")
 {
   Grob *me = unsmob_grob (grob);
   SCM_ASSERT_TYPE (me, grob, SCM_ARG1, __FUNCTION__, "grob");
@@ -140,17 +134,12 @@ Return the original Grob of @var{grob}
 
 
 /* ly prefix? spanner in name? */
-/*
-  TODO: maybe we should return a vector -- random access is more
-  logical for this list?
- */
+/* TODO: maybe we should return a vector -- random access is more
+  logical for this list? */
 
 LY_DEFINE (get_broken_into,
          "ly:get-broken-into", 1, 0, 0, (SCM spanner),
-          "
-Return broken-into list for @var{spanner}.
-"
-)
+          "Return broken-into list for @var{spanner}.")
 {
   ///  Spanner *me = unsmob_spanner (spanner);
   Spanner *me = dynamic_cast<Spanner*> (unsmob_grob (spanner));
index 4820be55c6bf98c94fba4726af4737b3b4c9dffb..8956019fefa6370460a6bb56bac260fb60714f42 100644 (file)
@@ -27,8 +27,7 @@ Span_bar::add_bar (Grob*me, Grob*b)
 
 MAKE_SCHEME_CALLBACK (Span_bar,brew_molecule,1);
 
-/*
-  Limitations/Bugs:
+/* Limitations/Bugs:
 
    (1) Elements from 'me->get_grob_property ("elements")' must be
    ordered according to their y coordinates relative to their common
@@ -42,20 +41,17 @@ MAKE_SCHEME_CALLBACK (Span_bar,brew_molecule,1);
    (2) This method depends on bar_engraver not being removed from
    staff context.  If bar_engraver is removed, the size of the staff
    lines is evaluated as 0, which results in a solid span bar line
-   with faulty y coordinate.
- */
+   with faulty y coordinate. */
 
-/*
-  This routine was originally by Juergen Reuter, but it was a on the
-  bulky side. Rewritten by Han-Wen. 
- */
+/* This routine was originally by Juergen Reuter, but it was a on the
+   bulky side. Rewritten by Han-Wen. */
 SCM
 Span_bar::brew_molecule (SCM smobbed_me) 
 {
   Grob *me = unsmob_grob (smobbed_me);
   SCM first_elt = me->get_grob_property ("elements");
 
-  // compute common refpoint of elements
+  /* compute common refpoint of elements */
   Grob *refp = me;
   for (SCM elts = first_elt; gh_pair_p (elts); elts = ly_cdr (elts))
     {
@@ -64,19 +60,17 @@ Span_bar::brew_molecule (SCM smobbed_me)
       refp = staff_bar->common_refpoint (refp, Y_AXIS);
     }
 
-  Span_bar::evaluate_glyph(me);
+  Span_bar::evaluate_glyph (me);
   SCM glyph = me->get_grob_property ("glyph");
 
-  /*
-    glyph may not be a string, when ME is killed by Hara Kiri in
-    between.
-  */
+  /* glyph may not be a string, when ME is killed by Hara Kiri in
+    between. */
   if (!gh_string_p (glyph))
     return SCM_EOL;
   
   String glyph_string = ly_scm2string (glyph);
 
-  // compose span_bar_mol
+  /* compose span_bar_mol */
   Molecule span_bar_mol;
 
   Interval prev_extent;
@@ -90,18 +84,18 @@ Span_bar::brew_molecule (SCM smobbed_me)
       
       if (!prev_extent.empty_b ())
        {
-         Interval l(prev_extent [UP],
+         Interval l (prev_extent [UP],
                     ext[DOWN]);
 
          if (l.empty_b ())
            {
-             /* there is  overlap between the bar lines. We do nothign here.
-              */
+             /* There is overlap between the bar lines.  Do nothing. */
            }
          else
            {
-             Molecule interbar
-               = Bar_line::compound_barline (staff_bar, glyph_string, l.length());
+             Molecule interbar = Bar_line::compound_barline (staff_bar,
+                                                             glyph_string,
+                                                             l.length ());
              interbar.translate_axis (l.center (), Y_AXIS);
              span_bar_mol.add_molecule (interbar);
            }
@@ -109,7 +103,8 @@ Span_bar::brew_molecule (SCM smobbed_me)
       prev_extent = ext;
     }
 
-  span_bar_mol.translate_axis (- me->relative_coordinate (refp, Y_AXIS), Y_AXIS);
+  span_bar_mol.translate_axis (- me->relative_coordinate (refp, Y_AXIS),
+                              Y_AXIS);
   
   return span_bar_mol.smobbed_copy ();
 }
@@ -138,10 +133,9 @@ Span_bar::before_line_breaking (SCM smob)
   evaluate_empty (unsmob_grob (smob));
   evaluate_glyph (unsmob_grob (smob));
 
-  /*
-    no need to call   Bar_line::before_line_breaking (), because the info
-    in ELEMENTS already has been procced by Bar_line::before_line_breaking ().
-  */
+  /* No need to call Bar_line::before_line_breaking (), because the info
+     in ELEMENTS already has been procced by
+     Bar_line::before_line_breaking (). */
   return SCM_UNSPECIFIED;
 }
 
@@ -155,10 +149,9 @@ Span_bar::center_on_spanned_callback (SCM element_smob, SCM axis)
   assert (a == Y_AXIS);
   Interval i (get_spanned_interval (me));
 
-  /*
-    Bar_line::brew_molecule delivers a barline of y-extent (-h/2,h/2), so
-    we have to translate ourselves to be in the center of the 
-    interval that we span.  */
+  /* Bar_line::brew_molecule delivers a barline of y-extent (-h/2,h/2), so
+     we have to translate ourselves to be in the center of the 
+     interval that we span. */
   if (i.empty_b ())
     {
       me->suicide ();
@@ -171,12 +164,9 @@ Span_bar::center_on_spanned_callback (SCM element_smob, SCM axis)
 void
 Span_bar::evaluate_empty (Grob*me)
 {
-  /*
-    TODO: filter all hara-kiried out of ELEMENS list, and then
-    optionally do suicide. Call this cleanage function from
-    center_on_spanned_callback () as well.
-    
-   */
+  /* TODO: filter all hara-kiried out of ELEMENS list, and then
+     optionally do suicide. Call this cleanage function from
+     center_on_spanned_callback () as well. */
   if (!gh_pair_p (me->get_grob_property ("elements")))
     {
       me->suicide ();
@@ -192,7 +182,8 @@ Span_bar::evaluate_glyph (Grob*me)
 
   while (gh_pair_p (elts))
     {
-      gl =  unsmob_grob (gh_car (elts))->internal_get_grob_property (glyph_symbol);
+      gl = unsmob_grob (gh_car (elts))
+       ->internal_get_grob_property (glyph_symbol);
       if (gh_string_p (gl))
        break;
       elts =gh_cdr (elts);
@@ -219,14 +210,16 @@ Span_bar::evaluate_glyph (Grob*me)
     }
 
   gl = scm_makfrom0str (type.to_str0 ());
-  if (scm_equal_p (me->internal_get_grob_property (glyph_symbol), gl) != SCM_BOOL_T)
+  if (scm_equal_p (me->internal_get_grob_property (glyph_symbol), gl)
+      != SCM_BOOL_T)
     me->internal_set_grob_property (glyph_symbol, gl);
 }
 
 Interval
 Span_bar::get_spanned_interval (Grob*me) 
 {
-  return ly_scm2interval (Axis_group_interface::group_extent_callback (me->self_scm (), gh_int2scm (Y_AXIS))); 
+  return ly_scm2interval (Axis_group_interface::group_extent_callback
+                         (me->self_scm (), gh_int2scm (Y_AXIS))); 
 }
 
 
@@ -238,9 +231,7 @@ Span_bar::get_bar_size (SCM smob)
   Interval iv (get_spanned_interval (me));
   if (iv.empty_b ())
     {
-      /*
-       This happens if the bars are hara-kiried from under us.
-      */
+      /* This happens if the bars are hara-kiried from under us. */
       me->suicide ();
       return gh_double2scm (-1);
     }
index e66adfc8d4214b6776b28bf66a5cc66de2368757..35da64f305d9f4bf49eef7b36c0e7293ac849d6c 100644 (file)
 #include "warn.hh"
 #include "staff-symbol-referencer.hh"
 
-MAKE_SCHEME_CALLBACK (Time_signature,brew_molecule,1);
-/*
-  TODO: make different functions for special and normal timesigs.
- */
+MAKE_SCHEME_CALLBACK (Time_signature, brew_molecule, 1);
+/* TODO: make different functions for special and normal timesigs. */
 SCM
 Time_signature::brew_molecule (SCM smob) 
 {
@@ -79,15 +77,13 @@ Time_signature::special_time_signature (Grob *me, SCM scm_style, int n, int d)
 
   String char_name = style + to_string (n) + "/" + to_string (d);
   me->set_grob_property ("font-family", ly_symbol2scm ("music"));
-  Molecule out =
-    Font_interface::get_default_font (me)->find_by_name ("timesig-" + char_name);
+  Molecule out = Font_interface::get_default_font (me)
+    ->find_by_name ("timesig-" + char_name);
   if (!out.empty_b ())
     return out;
 
-  /*
-    If there is no such symbol, we default to the numbered style.
-    (Here really with a warning!)
-  */
+  /* If there is no such symbol, we default to the numbered style.
+    (Here really with a warning!) */
   me->warning (_f ("time signature symbol `%s' not found; "
                   "reverting to numbered style", char_name));
   return numbered_time_signature (me, n, d);
@@ -97,14 +93,14 @@ Molecule
 Time_signature::numbered_time_signature (Grob*me,int num, int den)
 {
   SCM chain = Font_interface::font_alist_chain (me);
-  me->set_grob_property("font-family", ly_symbol2scm ("number"));
-
-  Molecule n = Text_item::text2molecule (me,
-                                        scm_makfrom0str (to_string (num).to_str0 ()),
-                                        chain);
-  Molecule d = Text_item::text2molecule (me,
-                                        scm_makfrom0str (to_string (den).to_str0 ()),
-                                        chain);
+  me->set_grob_property ("font-family", ly_symbol2scm ("number"));
+
+  Molecule n =
+    Text_item::text2molecule (me, scm_makfrom0str (to_string (num).to_str0 ()),
+                             chain);
+  Molecule d =
+    Text_item::text2molecule (me, scm_makfrom0str (to_string (den).to_str0 ()),
+                             chain);
   n.align_to (X_AXIS, CENTER);
   d.align_to (X_AXIS, CENTER);
   Molecule m;
@@ -124,7 +120,7 @@ Time_signature::numbered_time_signature (Grob*me,int num, int den)
   return m;
 }
 
-ADD_INTERFACE (Time_signature,"time-signature-interface",
+ADD_INTERFACE (Time_signature, "time-signature-interface",
   "A time signature, in different styles.
   The following values for 'style are are recognized:
 
index 7150ca4699b406fe2b5b21730599fdf9c203231c..13f1ab9b0895111fdccb750ac2b239161c6c0246 100644 (file)
 class Timing_engraver : public Timing_translator, public Engraver
 {
 protected:
-  /*
-    Needed to know whether we're advancing in grace notes, or not.
-   */
+  /* Needed to know whether we're advancing in grace notes, or not. */
   Moment last_moment_;
   
   virtual void start_translation_timestep ();
   virtual void stop_translation_timestep ();
 
 public:
-  TRANSLATOR_DECLARATIONS(Timing_engraver);
+  TRANSLATOR_DECLARATIONS (Timing_engraver);
 };
 
 
@@ -48,21 +46,21 @@ Timing_engraver::start_translation_timestep ()
   Moment now = now_mom ();
   SCM which = get_property ("whichBar");
 
-  /*
-    Set the first bar of the score? 
-   */
+  /* Set the first bar of the score? */
   if (!gh_string_p (which))
     which
       = (now.main_part_ || now.main_part_ == last_moment_.main_part_)
       ? SCM_EOL : scm_makfrom0str ("|");
 
   Moment mp = measure_position ();
-  bool start_of_measure = (last_moment_.main_part_ != now.main_part_&& !mp.main_part_  );
+  bool start_of_measure = (last_moment_.main_part_ != now.main_part_
+                          && !mp.main_part_);
 
   if (start_of_measure)
     {
-      Moment mlen = Moment(measure_length ());
-      unsmob_grob (get_property ("currentCommandColumn"))->set_grob_property ("measure-length", mlen.smobbed_copy()); 
+      Moment mlen = Moment (measure_length ());
+      unsmob_grob (get_property ("currentCommandColumn"))
+       ->set_grob_property ("measure-length", mlen.smobbed_copy ()); 
     }
   
   if (!gh_string_p (which) && !to_boolean (nonauto))
@@ -89,7 +87,7 @@ Timing_engraver::stop_translation_timestep ()
 }
 
 
-ENTER_DESCRIPTION(Timing_engraver,
+ENTER_DESCRIPTION (Timing_engraver,
 /* descr */       " Responsible for synchronizing timing information from staves. 
 Normally in @code{Score}.  In order to create polyrhythmic music,
 this engraver should be removed from @code{Score} and placed in
index 42d9e0da5727503625a4d5fabeb68e816033914b..f877bd56f4b9ca466586664414d1f737480b6183 100644 (file)
    ;; how to get zero-left padding with ``Guile's fprintf'' ?
    ;;(format #f "txt('\\x~2x',(" i)
    ;;(format #f "txt('\\x~02x',(" i)
-   ;; ugh uhg
-   (if (< i 16)
-       (format #f "txt('\\x0~x',(" i)
-       (format #f "txt('\\x~x',(" i))
+   ;; ugh: python's '%02x' % i
+   (format #f "&#x~2,'0x;" i)
    (sketch-numbers->string (map mul-scale (list x y)))
    "))\n"))
 
index 268fc48ccb52171fe36990b81f8d27b6ad6893a9..7a12ac9f69de19c407df5e1ecd9df491dfe7496f 100644 (file)
 ;; Interface functions
 
 (define (char i)
-  (tagify "tspan" (make-string 1 (integer->char i))))
+  (if (or
+       #t
+       (= i #x9)
+       (= i #xa)
+       (= i #xd)
+       (>= i #x20))
+      ;;(tagify "tspan" (format #f "&#x~2,'0x;" i))
+      (tagify "tspan" (format #f "&#xe0~2,'0x;" i))
+      ;; how to access remaining characters??
+      ;;;(tagify "tspan" (format #f "&#x~2,'0x;" #x20)
+      (begin
+       (format #t "can't display char: ~x\n" i)
+       " ")))
 
 (define (end-output)
   "</g></svg>")
          `(height . ,(number->string (* output-scale (+ depth height))))))
 
 
-(define (fontify name-mag-pair expr)
-
-  ;; for simple sodipodi with feta20.pfb:
-;;  (tagify "text" (dispatch expr) '(style . "fill:black;stroke:none;font-family:futa20;font-style:normal;font-weight:normal;font-size:20;fill-opacity:1;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;text-anchor:start;writing-mode:lr;"))
-
-  ;; Sketch' svg input filter groks this:
-  (tagify "text" (dispatch expr) '(style . "fill:black;stroke:none;font-family:LilyPond-Feta-20;font-style:normal;font-weight:normal;font-size:20;fill-opacity:1;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;text-anchor:start;writing-mode:lr;"))
+(define font-alist '(("feta13" . ("LilyPond-Feta13" . "13"))
+                    ("feta20" . "fill:black;stroke:none;font-family:lilypond;font-style:feta;font-weight:normal;font-size:20;fill-opacity:1;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;text-anchor:start;writing-mode:lr;")
+                    ("parmesan20" . "fill:black;stroke:none;font-family:lilypond;font-style:parmesan;font-weight:normal;font-size:20;fill-opacity:1;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;text-anchor:start;writing-mode:lr;")
+                    ))
+(define (get-font name-mag-pair)
+  ;; name-mag-pair: (quote ("feta20" . 0.569055118110236))"feta20"(quote ("feta20" . 0.569055118110236))
+  (let ((f (assoc (caadr name-mag-pair) font-alist)))
+    (if (pair? f)
+       (cdr f)
+       (begin
+         (format #t "font not found: ~s\n" (caadr name-mag-pair))
+         (cdr (assoc "feta20" font-alist))))))
 
-  )
+(define (fontify name-mag-pair expr)
+  (string-append
+   (tagify "text" (dispatch expr) (cons 'style (get-font name-mag-pair)))))
 
 
 (define (header creator generate)
index 814783e8722f2b4793986af1a404c320ecd390a3..c614059fda0cd43d845253a5466da028320a27da 100644 (file)
@@ -355,9 +355,11 @@ def one_latex_definition (defn, first):
 
 
 ly_paper_to_latexpaper =  {
-       'a4' : 'a4paper',
        'letter' : 'letterpaper', 
-       'a3' : 'a3paper'
+       'a3' : 'a3paper',
+       'a4' : 'a4paper',
+       'a5' : 'a5paper',
+       'a6' : 'a6paper',
 }
 
 #TODO: should set textheight (enlarge) depending on papersize.