From: hanwen <hanwen>
Date: Sat, 8 Jan 2005 14:22:08 +0000 (+0000)
Subject: (all-grob-descriptions): remove all
X-Git-Tag: release/2.5.23~701
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e1d8e1d652bab70c9a80095b73bafe514356da75;p=lilypond.git

(all-grob-descriptions): remove all
extra-offsets from definitions.

2005-01-08  Erlend Aasland  <erlenda@gmail.com>

	* scm/output-lib.scm: Rename guitar-tunings to guitar-tuning and
	add tuning for 4-string bass and some common 4/5-string banjo tunings.
	New function (four-string-banjo) turns a 5-string tuning into a 4-string
	tuning.
	New function (fret-number-tablature-format-banjo) computes correct fret
	numbers on 5-string banjos.

	* ly/engraver-init.ly: Default stringTunings = #guitar-tuning
	Add beam correction to TabVoice.

	* scm/define-grobs.scm: Adjust notehead offset. Print fret numbers
	using bold font; makes tabs more readable.
---

diff --git a/ChangeLog b/ChangeLog
index 24bcb3d73f..e696e0d1c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,36 @@
 2005-01-08  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+	* scm/define-grobs.scm (all-grob-descriptions): remove all
+	extra-offsets from definitions.
+
+2005-01-08  Erlend Aasland  <erlenda@gmail.com>
+
+	* scm/output-lib.scm: Rename guitar-tunings to guitar-tuning and
+	add tuning for 4-string bass and some common 4/5-string banjo tunings.
+	New function (four-string-banjo) turns a 5-string tuning into a 4-string
+	tuning.
+	New function (fret-number-tablature-format-banjo) computes correct fret
+	numbers on 5-string banjos.
+
+	* ly/engraver-init.ly: Default stringTunings = #guitar-tuning
+	Add beam correction to TabVoice.
+
+	* scm/define-grobs.scm: Adjust notehead offset. Print fret numbers
+	using bold font; makes tabs more readable.
+
+2005-01-08  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+	* lily/font-select.cc (get_font_by_design_size): don't make
+	Modified_font_metric; this causes trouble, since we don't know the
+	font magnification from inside Pango_font::text_stencil()
+
+	* lily/all-font-metrics.cc (find_pango_font): take magnification argument.
+
+	* Documentation/user/notation.itely (The Lyrics context): comment out
+	broken {Small ensembles} link.
+
+	* scm/framework-svg.scm (output-framework): change calling convention.
+
 	* lily/object-key-dumper-scheme.cc: new file.
 
 	* lily/object-key-undumper-scheme.cc: new file.
diff --git a/Documentation/user/notation.itely b/Documentation/user/notation.itely
index 1db5387afc..c0f670bace 100644
--- a/Documentation/user/notation.itely
+++ b/Documentation/user/notation.itely
@@ -4074,7 +4074,11 @@ A complete example of a SATB score setup is in section
 Program reference: @internalsref{LyricCombineMusic},
 @internalsref{Lyrics}, @internalsref{Melisma_translator}.
 
-Examples: @ref{Small ensembles},
+
+@c link broken:
+@c Examples: @ref{Small ensembles},
+
+
 @inputfileref{input/@/regression,lyric@/-combine@/-new@/.ly}.
 @c TODO: make separate section for melismata
 
diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc
index 19be65b8cc..3815458f9f 100644
--- a/lily/all-font-metrics.cc
+++ b/lily/all-font-metrics.cc
@@ -59,9 +59,16 @@ All_font_metrics::All_font_metrics (All_font_metrics const&)
 }
 
 #if HAVE_PANGO_FT2
+
 Pango_font *
-All_font_metrics::find_pango_font (PangoFontDescription*description)
+All_font_metrics::find_pango_font (PangoFontDescription*description,
+				   Real magnification,
+				   Real output_scale)
 {
+  pango_font_description_set_size (description,
+				   gint (magnification *
+					 pango_font_description_get_size (description)));
+  
   gchar *fn = pango_font_description_to_filename (description);
   SCM key = ly_symbol2scm (fn);
 
@@ -72,7 +79,8 @@ All_font_metrics::find_pango_font (PangoFontDescription*description)
 	progress_indication ("[" + String (fn));
       Pango_font *pf = new Pango_font (pango_ft2_fontmap_,
 				       RIGHT,
-				       description);
+				       description,
+				       output_scale);
       val = pf->self_scm ();
       pango_dict_->set (key, val);
       scm_gc_unprotect_object (val);
@@ -86,6 +94,7 @@ All_font_metrics::find_pango_font (PangoFontDescription*description)
   g_free (fn); 
   return dynamic_cast<Pango_font*> (unsmob_metrics (val));
 }
+
 #endif
 
 /*
diff --git a/lily/font-select.cc b/lily/font-select.cc
index 4443209d01..cc234bf791 100644
--- a/lily/font-select.cc
+++ b/lily/font-select.cc
@@ -69,7 +69,9 @@ get_font_by_design_size (Output_def *layout, Real requested,
 #if HAVE_PANGO_FT2
       PangoFontDescription *description
 	= pango_font_description_from_string (pango_description_string.to_str0 ());
-      fm = all_fonts_global->find_pango_font (description);
+      return all_fonts_global->find_pango_font (description,
+						requested / size,
+						output_scale (layout));
 #else
       error ("Trying to retrieve pango font without HAVE_PANGO_FT2."); 
 #endif
@@ -114,7 +116,7 @@ select_encoded_font (Output_def *layout, SCM chain)
   if (scm_is_string (name)
       && is_pango_format_global)
     {
-      select_pango_font (layout, chain);
+      return select_pango_font (layout, chain);
     }
   else
 #endif
diff --git a/lily/include/all-font-metrics.hh b/lily/include/all-font-metrics.hh
index b0cdeff9d5..90cd306292 100644
--- a/lily/include/all-font-metrics.hh
+++ b/lily/include/all-font-metrics.hh
@@ -29,7 +29,7 @@ class All_font_metrics
   Scheme_hash_table *otf_dict_;
   File_path search_path_;
 
-#ifdef HAVE_PANGO16
+#ifdef HAVE_PANGO_FT2
   PangoFT2FontMap *pango_ft2_fontmap_;
   Scheme_hash_table *pango_dict_;
   int pango_dpi_;
@@ -40,7 +40,12 @@ public:
   All_font_metrics (String search_path);
   ~All_font_metrics ();
   
-  Pango_font *find_pango_font (PangoFontDescription*description);
+#ifdef HAVE_PANGO_FT2
+  Pango_font *find_pango_font (PangoFontDescription*description,
+			       Real magnification,
+			       Real scale);
+#endif
+  
   Adobe_font_metric *find_afm (String name);
   Tex_font_metric *find_tfm (String);
   Font_metric *find_font (String name);  
diff --git a/lily/include/pango-font.hh b/lily/include/pango-font.hh
index ebfb68d8e5..81fdf09e7a 100644
--- a/lily/include/pango-font.hh
+++ b/lily/include/pango-font.hh
@@ -26,10 +26,12 @@ class Pango_font : public Font_metric
   PangoAttrList *attribute_list_;
   Real scale_;
   SCM subfonts_;
+  
 public:
   Pango_font (PangoFT2FontMap *,
 	      Direction leftright,
-	      PangoFontDescription *);
+	      PangoFontDescription *,
+	      Real);
   ~Pango_font ();
 
   SCM font_file_name () const;
diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/lily/pango-font.cc b/lily/pango-font.cc
index 45da3a6e30..d2cd7f192e 100644
--- a/lily/pango-font.cc
+++ b/lily/pango-font.cc
@@ -23,7 +23,8 @@
 
 Pango_font::Pango_font (PangoFT2FontMap *fontmap,
 			Direction dir,
-			PangoFontDescription *description)
+			PangoFontDescription *description,
+			Real output_scale)
 {
   subfonts_ = SCM_EOL;
   PangoDirection pango_dir = (dir == RIGHT)
@@ -42,7 +43,7 @@ Pango_font::Pango_font (PangoFT2FontMap *fontmap,
 
     --hwn
    */
-  scale_ = INCH_TO_BP / (Real (PANGO_SCALE) * Real (PANGO_RESOLUTION));
+  scale_ = INCH_TO_BP / (Real (PANGO_SCALE) * Real (PANGO_RESOLUTION) * output_scale);
   
   pango_context_set_language (context_, pango_language_from_string ("en_US"));
   pango_context_set_base_dir (context_, pango_dir);
@@ -175,6 +176,14 @@ Pango_font::text_stencil (String str) const
 		      exp);
     }
   
+#if 1
+  if (!dest.extent_box ()[X_AXIS].is_empty ())
+    {
+      Stencil frame = Lookup::frame (dest.extent_box(), 0.1, 0.1);
+      dest.add_stencil (frame);
+    }
+#endif
+
   return dest;
 }
 
diff --git a/lily/pango-select.cc b/lily/pango-select.cc
index fabc6f6fcb..5002fe8a19 100644
--- a/lily/pango-select.cc
+++ b/lily/pango-select.cc
@@ -56,9 +56,7 @@ select_pango_font (Output_def *layout, SCM chain)
   PangoFontDescription *pfd = properties_to_pango_description (chain,
 							       point_constant * layout->get_dimension (ly_symbol2scm ("text-font-size")));
   
-  Font_metric * fm = all_fonts_global->find_pango_font (pfd);
-
-  return find_scaled_font (layout, fm, 1.0);
+  return all_fonts_global->find_pango_font (pfd, 1.0, output_scale (layout));
 }
 
 PangoStyle
diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly
index d480dcf143..e897cc3d92 100644
--- a/ly/engraver-init.ly
+++ b/ly/engraver-init.ly
@@ -525,7 +525,7 @@ AncientRemoveEmptyStaffContext = \context {
 
     %% One may change the strings tuning as following :
     %% The lenght of the list must be equal to the number of string
-    stringTunings = #guitar-tunings
+    stringTunings = #guitar-tuning
     tablatureFormat = #fret-number-tablature-format
 
     %%
@@ -613,6 +613,13 @@ EasyNotation = \context {	% TODO: why \context override?
       %\override Beam #'damping = #100000
       %\override Stem #'up-to-staff = ##t
 
+      % TabStaff increase the staff-space, which in turn
+      % increases beam thickness and spacing; beams are
+      % too big. We have to adjust the beam settings:
+      \override Beam #'thickness = #0.32
+      \override Beam #'space-function =
+          #(lambda (beam mult) (* 0.62 (Beam::space_function beam mult)))
+
       % No accidental in tablature !
       \remove Accidental_engraver
 }
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index 5b8ea469c5..ad4a6fa658 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -145,8 +145,6 @@
 	(X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
 	(self-alignment-X . 1)
 
-	;; hmm. why did we do this: ?
-	(extra-offset . (1.3 . 0))
 	(meta .
 	      ((interfaces . (side-position-interface
 			      text-interface
@@ -1164,7 +1162,6 @@
 	(Y-offset-callbacks . (,Side_position_interface::aligned_side))
 	(X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
 	(direction . 1)
-	(extra-offset . (-1 . 0))
 	(padding . 0.5)
 	(staff-padding . 0.5)
 	(script-priority . 200)
@@ -1219,8 +1216,8 @@
 	(style . default)
 	(print-function . ,Text_interface::print)
 	(Y-offset-callbacks . (,Staff_symbol_referencer::callback))
-	(extra-offset . (0 . -0.65)) ;; UGH! TODO: Clean this up!
 	(stem-attachment-function . ,tablature-stem-attachment-function)
+	(font-series . bold)
 	(meta . ((interfaces
 		  . (rhythmic-head-interface
 		     font-interface
diff --git a/scm/font.scm b/scm/font.scm
index 3b10f93a59..328397c9fd 100644
--- a/scm/font.scm
+++ b/scm/font.scm
@@ -174,7 +174,7 @@
 		  ,(delay  (ly:font-load "emmentaler23"))		  
 		  ,(delay  (ly:font-load "emmentaler26"))))
 
-     (fetaBraces 100.0 #(,(delay
+     (fetaBraces ,(ly:pt 20.0) #(,(delay
 			    (ly:font-load "aybabtu")))))))
 
 (define-public (add-cmr-fonts node factor)
diff --git a/scm/output-lib.scm b/scm/output-lib.scm
index 6172b8cb2e..f20bbdda78 100644
--- a/scm/output-lib.scm
+++ b/scm/output-lib.scm
@@ -21,6 +21,19 @@
 		;; remove 1 because list index starts at 0 and guitar string at 1. 
                 (- string 1)))))
 
+;; The 5-string banjo has got a extra string, the fifth (duh), wich
+;; starts at the fifth fret on the neck. Frets on the fifth string
+;; are referred to relative to the other frets:
+;;   the "first fret" on the fifth string is really the sixth fret
+;;   on the banjo neck.
+;; We solve this by defining a new fret-number-tablature function:
+(define-public (fret-number-tablature-format-banjo string tuning pitch)
+    (let ((fret (- (ly:pitch-semitones pitch) (list-ref tuning (- string 1)))))
+        (number->string (cond
+            ((and (> fret 0) (= string 5))
+                (+ fret 5))
+            (else fret)))))
+
 (define-public (hammer-print-function grob)
   (let* ((note-collums (ly:grob-property grob 'note-columns))
          (note-column1 (cadr note-collums))
@@ -59,7 +72,22 @@
 
 
 
-(define-public guitar-tunings '(4 -1 -5 -10 -15 -20))
+(define-public guitar-tuning '(4 -1 -5 -10 -15 -20))
+(define-public bass-tuning '(-17 -22 -27 -32))
+
+;; tunings for 5-string banjo
+(define-public banjo-open-g-tuning '(2 -1 -5 -10 7))
+(define-public banjo-c-tuning '(2 -1 -5 -12 7))
+(define-public banjo-modal-tuning '(2 0 -5 -10 7))
+(define-public banjo-open-d-tuning '(2 -3 -6 -10 9))
+(define-public banjo-open-dm-tuning '(2 -3 -6 -10 9))
+;; convert 5-string banjo tunings to 4-string tunings by
+;; removing the 5th string
+;;
+;; example:
+;; \set TabStaff.stringTunings = #(four-string-banjo banjo-open-g-tuning)
+(define-public (four-string-banjo tuning)
+  (reverse (cdr (reverse tuning))))
 
 ;;; end of tablature functions