+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.
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
+
"
}
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);
#include "moment.hh"
MAKE_SCHEME_CALLBACK (Hyphen_spanner, print, 1)
- SCM
+SCM
Hyphen_spanner::print (SCM smob)
{
Spanner *me = unsmob_spanner (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];
// 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
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);
}
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");
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
}
#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
% 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
(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
`(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
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
;; !! 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)