]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 13 Mar 2005 20:51:59 +0000 (20:51 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 13 Mar 2005 20:51:59 +0000 (20:51 +0000)
ChangeLog
input/regression/lyric-hyphen-retain.ly
lily/accidental.cc
lily/lyric-hyphen.cc
lily/pango-font.cc
mf/feta-params.mf
scm/define-grobs.scm
scm/framework-svg.scm
scm/output-svg.scm
scm/paper.scm

index c397bed89dc052cbce73d4daf5cd2c7f30b0cb83..a636abbd2cf7e9d4758c117ecd3bb062f492c292 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2005-03-12  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * scm/define-grobs.scm (all-grob-descriptions): switch off
+       Hyphen_spanner::set_spacing_rods 
+
+       * lily/lyric-hyphen.cc (print): add padding between syllable and
+       hyphen.
+       (print): shorten hyphen in tight situations (determine using
+       minimum-length)
+
+       * scm/paper.scm (layout-set-staff-size): increase blotdiameter to
+       0.4pt.
+
 2005-03-13  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * ly/titling-init.ly (bookTitleMarkup): Refinements.
index f5142b896e01c1f9a7e25dfd78c4b74011ea1d6b..cd61a5ceb127b561c328c97086e314921319b882 100644 (file)
@@ -8,10 +8,13 @@ end of the line.  Normally, lyrics are not typeset so tightly, but by
 tuning down @code{padding} of in @code{SeparationItem}, syllables are put 
 closer together, and as a result hyphens may disappear.
 
-In some languages (e.g. German and Hungarian),  hyphens should not
+In some languages (e.g. German and Hungarian), hyphens should not
 disappear, since spelling depends on hyphenation. For that purpose,
-hyphens can be forced to remain by overriding @code{minimum-length} of
-the @code{LyricHyphen} grob.
+hyphens can be forced to remain setting @code{spacing-procedure} to
+@code{Hyphen_spanner::set_spacing_rods} of the @code{LyricHyphen}
+grob.  The @code{minimum-length} property may be used to tune the
+amount
+
 "
 
 }
index 0658b28bcf0f64dcde3a17bf35408b0e01909dae..e2f21a105a35c3f14c0bd0b267664c9d0588600e 100644 (file)
@@ -99,8 +99,8 @@ Accidental_interface::accurate_boxes (Grob *a, Grob **common)
            rstem[Y_AXIS] *= 1.1;
 
            belly[Y_AXIS] *= 0.75;
-           lstem[X_AXIS][RIGHT] *= .5;
-           rstem[X_AXIS][LEFT] = lstem[X_AXIS][RIGHT];
+           lstem[X_AXIS][RIGHT] *= .33;
+           rstem[X_AXIS][LEFT] = rstem[X_AXIS].linear_combination (1.0/3.0);
            lstem[Y_AXIS][DOWN] = belly[Y_AXIS][DOWN];
            rstem[Y_AXIS][UP] = belly[Y_AXIS][UP];
            boxes.push (belly);
index 8dd88dc0c1e8d3228fece144a7c6d8b439c67730..10e9c645802704036be052792db2d6d8611ec195 100644 (file)
@@ -16,7 +16,7 @@
 #include "moment.hh"
 
 MAKE_SCHEME_CALLBACK (Hyphen_spanner, print, 1)
-  SCM
+SCM
 Hyphen_spanner::print (SCM smob)
 {
   Spanner *me = unsmob_spanner (smob);
@@ -31,10 +31,11 @@ Hyphen_spanner::print (SCM smob)
 
   Interval span_points;
   Direction d = LEFT;
+  Drul_array<bool> broken;
   do
     {
       Interval iv = bounds[d]->extent (common, X_AXIS);
-
+      
       span_points[d] = iv.is_empty ()
        ? bounds[d]->relative_coordinate (common, X_AXIS)
        : iv[-d];
@@ -47,18 +48,28 @@ Hyphen_spanner::print (SCM smob)
 
   // interval?
 
-  Real dp = robust_scm2double (me->get_property ("dash-period"), 1.0);
-  Real dl = robust_scm2double (me->get_property ("length"), .5);
-
-  if (dp < dl)
-    dp = 1.5 * dl;
+  Real dash_period = robust_scm2double (me->get_property ("dash-period"), 1.0);
+  Real dash_length = robust_scm2double (me->get_property ("length"), .5);
+  Real padding = robust_scm2double (me->get_property ("padding"), 0.1);
+  
+  if (dash_period < dash_length)
+    dash_period = 1.5 * dash_length;
 
+  
   Real l = span_points.length ();
-  int n = int (ceil (l / dp - 0.5));
+
+  int n = int (ceil (l / dash_period - 0.5));
   if (n <= 0)
     n = 1;
 
-  Real space_left = l - dl - (n - 1)* dp;
+  if (l < dash_length + 2*padding
+      && !bounds[RIGHT]->break_status_dir ())
+    {
+      Real minimum_length = robust_scm2double (me->get_property ("minimum-length"), .3);
+      dash_length = (l - 2*padding) >? minimum_length;
+    }
+  
+  Real space_left = l - dash_length - (n - 1) * dash_period;
 
   /*
     If there is not enough space, the hyphen should disappear, but not
@@ -70,14 +81,14 @@ Hyphen_spanner::print (SCM smob)
 
   space_left = space_left >? 0.0;
 
-  Box b (Interval (0, dl), Interval (h, h + th));
+  Box b (Interval (0, dash_length), Interval (h, h + th));
   Stencil dash_mol (Lookup::round_filled_box (b, 0.8 * lt));
 
   Stencil total;
   for (int i = 0; i < n; i++)
     {
       Stencil m (dash_mol);
-      m.translate_axis (span_points[LEFT] + i * dp + space_left / 2, X_AXIS);
+      m.translate_axis (span_points[LEFT] + i * dash_period + space_left / 2, X_AXIS);
       total.add_stencil (m);
     }
 
@@ -96,23 +107,28 @@ Hyphen_spanner::set_spacing_rods (SCM smob)
   r.distance_
     = robust_scm2double (me->get_property ("minimum-length"), 0);
 
-  Direction d = LEFT;
-  do
+  if (r.distance_ > 0.0)
     {
-      r.item_drul_[d] = sp->get_bound (d);
-      if (r.item_drul_[d])
-       r.distance_ += r.item_drul_[d]->extent (r.item_drul_[d], X_AXIS)[-d];
+      Real padding = robust_scm2double (me->get_property ("padding"), 0.1);
+      r.distance_ += 2*padding;
+      Direction d = LEFT;
+      do
+       {
+         r.item_drul_[d] = sp->get_bound (d);
+         if (r.item_drul_[d])
+           r.distance_ += r.item_drul_[d]->extent (r.item_drul_[d], X_AXIS)[-d];
+       }
+      while (flip (&d) != LEFT);
+
+      if (r.item_drul_[LEFT]
+         && r.item_drul_[RIGHT])
+       r.add_to_cols ();
     }
-  while (flip (&d) != LEFT);
-
-  if (r.item_drul_[LEFT]
-      && r.item_drul_[RIGHT])
-    r.add_to_cols ();
-
+  
   return SCM_UNSPECIFIED;
 }
 
 ADD_INTERFACE (Hyphen_spanner, "lyric-hyphen-interface",
               "A centred hyphen is a simple line between lyrics used to divide syllables",
-              "thickness height dash-period minimum-length length");
+              "padding thickness height dash-period minimum-length length");
 
index d5d01499d5a53d2887c1fb4e4c97a4fa4127d52c..6eba7c878098709fb6c4c4d255841203561db8d1 100644 (file)
@@ -237,6 +237,9 @@ Pango_font::text_stencil (String str) const
   if (!dest.extent_box ()[X_AXIS].is_empty ())
     {
       Stencil frame = Lookup::frame (dest.extent_box (), 0.1, 0.1);
+      Box empty;
+      empty.set_empty();
+      Stencil dimless_frame (empty, frame.expr());
       dest.add_stencil (frame);
     }
 #endif
@@ -251,86 +254,3 @@ Pango_font::font_file_name () const
 }
 
 #endif
-
-#if 0
-void test_pango ()
-{
-  int dpi = 1200;
-
-  char *font_family = "Emmentaler";
-  PangoContext *pango_context
-    = pango_ft2_get_context (dpi, dpi);
-  PangoFontDescription *font_description;
-  font_description = pango_font_description_new ();
-  pango_font_description_set_family (font_description, g_strdup (font_family));
-  pango_font_description_set_style (font_description, (PangoStyle) 20);
-  pango_context_set_font_description (pango_context, font_description);
-
-  PangoAttrList *attr_list = pango_attr_list_new ();
-  char *str = "sfz";
-  GList *items = pango_itemize (pango_context, str, 0, strlen (str),
-                               attr_list, NULL);
-
-  GList *ptr = items;
-  while (ptr)
-    {
-      PangoItem *item = (PangoItem *)ptr->data;
-      printf ("off %d len %d num %d\n", item->offset, item->length, item->num_chars);
-
-      PangoAnalysis paobj = item->analysis;
-      PangoAnalysis *pa = &paobj;
-
-      PangoFontDescription *descr = pango_font_describe (pa->font);
-      //      assert (font_description == descr);
-      printf ("font descr string '%s' fname '%s'",
-             pango_font_description_to_string (descr),
-             pango_font_description_to_filename (descr));
-
-      printf ("type name %s\n", g_type_name (G_TYPE_FROM_INSTANCE (pa->font)));
-      PangoFcFont *fcfont = G_TYPE_CHECK_INSTANCE_CAST (pa->font,
-                                                       PANGO_TYPE_FC_FONT,
-                                                       PangoFcFont);
-
-      FcPattern *fcpat = fcfont->font_pattern;
-      FcPatternPrint (fcpat);
-      char *retval ="bla";
-
-      FcPatternGetString (fcpat, FC_FILE, 0, (FcChar8 **) &retval);
-      printf ("retval %s\n", retval);
-
-      FT_Face ftface = pango_fc_font_lock_face (fcfont);
-
-      printf ("shape %ux %s lang %ux font %ux languagae %ux\nft face %ux\n", pa->shape_engine,
-             G_OBJECT_TYPE_NAME (pa->shape_engine),
-             pa->lang_engine, pa->font, pa->language, ftface);
-
-      PangoGlyphString *pgs = pango_glyph_string_new ();
-      pango_shape (str, strlen (str), pa, pgs);
-
-      int i;
-      for (i = 0; i < pgs->num_glyphs; i++)
-       {
-         PangoGlyphInfo *pgi = pgs->glyphs + i;
-
-         PangoGlyph pg = pgi->glyph;
-         PangoGlyphGeometry ggeo = pgi->geometry;
-
-         printf ("c %d w %d x %d y %d\n", pg, ggeo.width, ggeo.x_offset,
-                 ggeo.y_offset);
-
-         char str[1024];
-         FT_Get_Glyph_Name (ftface, pg, str, 1024);
-         printf ("glyph %s\n", str);
-       }
-      printf ("\nPS name %s\n", FT_Get_Postscript_Name (ftface));
-
-      PangoRectangle r1;
-      PangoRectangle r2;
-
-      pango_glyph_string_extents (pgs, pa->font, &r1, &r2);
-
-      ptr = ptr->next;
-      printf ("\nnext item\n");
-    }
-}
-#endif
index 1323b7f41e219a2f47611dc167c704f9be1e3199..64cc51b0792cd2728fddbd9c14137f7f32755416 100644 (file)
@@ -73,7 +73,7 @@ fi;
 %        I don't think we do this anywhere -- jcn
 %
 
-blot_diameter# = .35 pt#;
+blot_diameter# = .40 pt#;
 if (blot_diameter# * hppp) < 1:
        blot_diameter# := 1 / hppp;
 fi
index 1bbd3b5aa748cba2fef362b494ccf44a13649b04..e715554fb7d702a3742677d034b0881d68bd82ff 100644 (file)
                        (time-signature . (extra-space . 0.0))
                        (staff-bar . (extra-space . 0.0))
                        (breathing-sign . (minimum-space . 0.0))
-                       (clef . (extra-space . 0.85))
+                       (clef . (extra-space . 0.7))
                        (first-note . (fixed-space . 1.0))
                        (right-edge . (extra-space . 0.0))
                        (key-signature . (extra-space . 0.0))
        (Y-extent-callback . #f)
        (minimum-length-fraction . 0.25)
        (length-fraction . 0.25)
-;      (spacing-procedure . ,Ledger_line_spanner::set_spacing_rods)
+       (spacing-procedure . ,Ledger_line_spanner::set_spacing_rods)
        (print-function . ,Ledger_line_spanner::print)
        (layer . 0)
        (meta . ((interfaces . (spanner-interface ledger-line-interface))))
        (height . 0.42)
        (dash-period . 10.0)
        (length . 0.66)
-       (spacing-procedure . ,Hyphen_spanner::set_spacing_rods)
+       (minimum-length . 0.3)
+       (padding . 0.07)
+;      (spacing-procedure . ,Hyphen_spanner::set_spacing_rods)
        (print-function . ,Hyphen_spanner::print)
        (Y-extent . (0 . 0))
        (meta . ((interfaces . (lyric-interface lyric-hyphen-interface
index c514619daa8e1682ac149f18a0049733c1a4fc76..f159a5059dc1a1a3acdb6cf0851093ef4ee40a0d 100644 (file)
@@ -38,6 +38,7 @@
                                `(begin (set! lily-unit-length ,unit-length) ""))
     (dump (eo 'svg
              '(xmlns . "http://www.w3.org/2000/svg")
+             '(xmlns:xlink . "http://www.w3.org/1999/xlink")
              '(version . "1.2")
 
              ;; Argggghhhh: SVG takes the px <-> mm mapping from the windowing system
index 3da3cda6848711b29ac4d8d36ae5997e6d3cd6ac..56665a6a792601c3aa53487df7fc113267202825 100644 (file)
              attributes-alist)))
 
 (define-public (eo entity . attributes-alist)
+  "o = open"
   (format #f "<~S~a>\n" entity (attributes attributes-alist)))
 
 (define-public (eoc entity . attributes-alist)
+  " oc = open/close"
   (format #f "<~S~a/>\n" entity (attributes attributes-alist)))
 
 (define-public (ec entity)
+  "c = close"
   (format #f "</~S>\n" entity))
 
 (define-public (entity entity string . attributes-alist)
        (match-2 (regexp-exec pango-description-regexp-nocomma str))
        (match (if match-1
                  match-1
-                 match-2))
-       )
+                 match-2)))
 
     (if (regexp-match? match)
        (begin
 
 ;;; catch-all for missing stuff
 ;;; comment this out to see find out what functions you miss :-)
-(define (dummy . foo) "")
-(map (lambda (x) (module-define! this-module x dummy))
-     (append
-      (ly:all-stencil-expressions)
-      (ly:all-output-backend-commands)))
+
+(if #f
+    (begin
+      (define (dummy . foo) "")
+      (map (lambda (x) (module-define! this-module x dummy))
+          (append
+           (ly:all-stencil-expressions)
+           (ly:all-output-backend-commands)))
+      ))
+
+(define (url-link url x y)
+  (string-append
+   (eo 'a `(xlink:href . ,url))
+   (eoc 'rect
+       `(x . ,(car x))
+       `(y . ,(car y))
+       `(width . ,(- (cdr x) (car x)))
+       `(height . ,(- (cdr y) (car y)))
+       '(fill . "none")
+       '(stroke . "none")
+       '(stroke-width . "0.0"))
+   (ec 'a)))
+
+(define (grob-cause offset grob)
+  "")
+
+(define (no-origin)
+  "")
+
 
 (define (rect-beam width slope thick blot-diameter)
   (let* ((x width)
            `(height . ,(+ thick (* (abs z) (/ thick 2))))
            `(rx . ,(/ blot-diameter 2))
            `(transform . ,(format #f "matrix (1, ~f, 0, 1, 0, 0)"  z)
-                          ))))
+                       ))))
 
 (define (beam width slope thick blot-diameter)
   (let* ((b blot-diameter)
                           0 (- t)
                           (- w) h
                           0 t))
-         )))
+           )))
 
 (define (bezier-sandwich lst thick)
   (let* ((first (list-tail lst 4))
            '(fill . "black")
            `(d . ,(string-append (svg-bezier first #f)
                                  (svg-bezier second first-c0)))
-         )))
+           )))
 
 (define (char font i)
   (dispatch
index 04ab27045b4c17244a733116fdb811a83fd069a9..569ebcd743589362b13c3100d017bd61dc8bf1f0 100644 (file)
@@ -47,7 +47,7 @@
     ;; !! synchronize with feta-params.mf
     (module-define! m 'linethickness lt)
     (module-define! m 'ledgerlinethickness (+ (* 0.5 pt) (/ ss 10)))
-    (module-define! m 'blotdiameter (* 0.35 pt))
+    (module-define! m 'blotdiameter (* 0.4 pt))
     (module-define! m 'interscoreline (* 4 mm))))
 
 (define-safe-public (set-global-staff-size sz)