]> git.donarmstrong.com Git - lilypond.git/commitdiff
(all-grob-descriptions): remove all
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 8 Jan 2005 14:22:08 +0000 (14:22 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 8 Jan 2005 14:22:08 +0000 (14:22 +0000)
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.

13 files changed:
ChangeLog
Documentation/user/notation.itely
lily/all-font-metrics.cc
lily/font-select.cc
lily/include/all-font-metrics.hh
lily/include/pango-font.hh
lily/include/paper-def.hh [deleted file]
lily/pango-font.cc
lily/pango-select.cc
ly/engraver-init.ly
scm/define-grobs.scm
scm/font.scm
scm/output-lib.scm

index 24bcb3d73fb4919b3b412f45c1c68c9e6feb777e..e696e0d1c4777b1b22a3053cff6b39eeedb96243 100644 (file)
--- 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.
index 1db5387afc8632e2eaa98ad848e904545030c4c0..c0f670baced5f38937edcd0d374ba6504d225a00 100644 (file)
@@ -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
 
index 19be65b8cc821c9da77fe7d3ca557b06d03ea2e3..3815458f9f9fc0a330cc425516aa0b6e593cf781 100644 (file)
@@ -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
 
 /*
index 4443209d01c009ec30e0a0457088f65bf99c61ad..cc234bf7910fa8443f11da18bc9723dbdae860d7 100644 (file)
@@ -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
index b0cdeff9d51bbd0f1239c4cd032e1df1d79b076f..90cd306292ff50046c788edaf0521abbc3de681b 100644 (file)
@@ -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);  
index ebfb68d8e5325cb697ae25b1356747f076c6d9ad..81fdf09e7ae5978c31d756a49e63061fdc274e80 100644 (file)
@@ -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 (file)
index e69de29..0000000
index 45da3a6e30633be2376beef5a4796361f4c45e14..d2cd7f192e52bad2bf176f539585ce1fc6259704 100644 (file)
@@ -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;
 }
 
index fabc6f6fcbac77e8f7fcf2f086e4631def1718e4..5002fe8a197b8c488e53a0f34d38356d6576abcf 100644 (file)
@@ -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
index d480dcf14336f0420885ed7293e6edc44eac0843..e897cc3d9239118901ff57791751f4c3a0fac910 100644 (file)
@@ -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
 }
index 5b8ea469c50e5a8051aa806672af136047466226..ad4a6fa6584171a1517d369a90a795c792cc564d 100644 (file)
        (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
        (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)
        (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
index 3b10f93a594d4e7d9da11d39ea66b8c9076081c1..328397c9fd840c451f24cd95560b0b30fd410ab5 100644 (file)
                  ,(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)
index 6172b8cb2ed92af9f95a17f380edf1eda931107a..f20bbdda78dedb7a48220c3945ba51e61855484d 100644 (file)
                ;; 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))
 
 
 
-(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