\clef violin
\key cis \major cis1 \key ces \major ces
\clef soprano
- \key cis \major cis \key ces \major ces
+ \key cis \major cis \key ces \major ces \break
\clef mezzosoprano
\key cis \major cis \key ces \major ces
\clef alto
- \key cis \major cis \key ces \major ces
+ \key cis \major cis \break \key ces \major ces
\clef tenor
- \key cis \major cis \key ces \major ces
+ \key cis \major cis \key ces \major ces \break
\clef baritone
\key cis \major cis \key ces \major ces
\clef bass
-\version "2.10.0"
+\version "2.11.5"
{
\fatText
\override #'(font-encoding . fetaMusic) {
\lookup #"noteheads-0"
}
- \musicglyph #"accidentals.-1"
+ \musicglyph #"accidentals.mirroredflat"
\combine "X" "+"
\combine "o" "/"
\box \column { \line { "string 1" } \line { "string 2" } }
#:hspace 2.0
#:override '(font-encoding . fetaMusic) #:line (#:lookup "noteheads-0"
)
- #:musicglyph "accidentals.-1"
+ #:musicglyph "accidentals.mirroredflat"
#:combine "X" "+"
#:combine "o" "/"
#:box #:column ("string 1" "string 2")
a->set_property ("restore-first", SCM_BOOL_T);
}
- a->set_property ("alteration", scm_from_int (pitch->get_alteration () * Rational (4)));
entry->accidental_ = a;
}
&& !to_boolean (me->get_property ("restore-first"))
&& !parens)
{
- int acc = scm_to_int (me->get_property ("alteration"));
- switch (acc)
+ Rational alteration = ly_scm2rational (me->get_property ("alteration"));
+ if (alteration == FLAT_ALTERATION)
{
- case FLAT:
- {
- Box stem = b;
- Box bulb = b;
+ Box stem = b;
+ Box bulb = b;
- /*
- we could make the stem thinner, but that places the flats
- really close.
- */
- stem[X_AXIS][RIGHT] *= .5;
-
- /*
- To prevent vertical alignment for 6ths
- */
- stem[Y_AXIS] *= 1.1;
- bulb[Y_AXIS][UP] *= .35;
-
- boxes.push_back (bulb);
- boxes.push_back (stem);
- }
- break;
- case NATURAL:
- {
- Box lstem = b;
- Box rstem = b;
- Box belly = b;
-
- lstem[Y_AXIS] *= 1.1;
- rstem[Y_AXIS] *= 1.1;
+ /*
+ we could make the stem thinner, but that places the flats
+ really close.
+ */
+ stem[X_AXIS][RIGHT] *= .5;
- belly[Y_AXIS] *= 0.75;
- 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_back (belly);
- boxes.push_back (lstem);
- boxes.push_back (rstem);
- }
- break;
/*
- TODO: add support for, double flat.
+ To prevent vertical alignment for 6ths
*/
+ stem[Y_AXIS] *= 1.1;
+ bulb[Y_AXIS][UP] *= .35;
+
+ boxes.push_back (bulb);
+ boxes.push_back (stem);
+ }
+ else if (alteration == NATURAL_ALTERATION)
+ {
+ Box lstem = b;
+ Box rstem = b;
+ Box belly = b;
+
+ lstem[Y_AXIS] *= 1.1;
+ rstem[Y_AXIS] *= 1.1;
+
+ belly[Y_AXIS] *= 0.75;
+ 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_back (belly);
+ boxes.push_back (lstem);
+ boxes.push_back (rstem);
}
+ /*
+ TODO: add support for, double flat.
+ */
}
if (!boxes.size ())
return boxes;
}
-/*
- * Some styles do not provide all flavours of accidentals, e.g. there
- * is currently no sharp accidental in vaticana style. In these cases
- * this function falls back to one of the other styles.
- */
-
-/*
- todo: this sort of stuff in Scheme. --hwn.
-*/
-string
-Accidental_interface::get_fontcharname (string style, int alteration)
-{
- if (alteration == DOUBLE_FLAT
- || alteration == DOUBLE_SHARP)
- return to_string (alteration);
-
- if (style == "hufnagel")
- switch (alteration)
- {
- case FLAT: return "hufnagel-1";
- case 0: return "vaticana0";
- case SHARP: return "mensural1";
- }
- if (style == "medicaea")
- switch (alteration)
- {
- case FLAT: return "medicaea-1";
- case 0: return "vaticana0";
- case SHARP: return "mensural1";
- }
- if (style == "vaticana")
- switch (alteration)
- {
- case FLAT: return "vaticana-1";
- case 0: return "vaticana0";
- case SHARP: return "mensural1";
- }
- if (style == "mensural")
- switch (alteration)
- {
- case FLAT: return "mensural-1";
- case 0: return "vaticana0";
- case SHARP: return "mensural1";
- }
-
- if (style == "neomensural")
- style = ""; // currently same as default
- if (style == "default")
- style = "";
-
- return style + to_string (alteration);
-}
-
MAKE_SCHEME_CALLBACK (Accidental_interface, print, 1);
SCM
Accidental_interface::print (SCM smob)
{
Grob *me = unsmob_grob (smob);
- bool parens = to_boolean (me->get_property ("parenthesized"));
-
- SCM scm_style = me->get_property ("style");
- string style;
- if (scm_is_symbol (scm_style))
- style = ly_symbol2string (scm_style);
- else
- /*
- preferably no name for the default style.
- */
- style = "";
Font_metric *fm = Font_interface::get_default_font (me);
- SCM stencils = me->get_property ("stencils");
- if (!scm_is_pair (stencils)
- || !unsmob_stencil (scm_car (stencils)))
- return SCM_EOL;
+ SCM alist = me->get_property ("glyph-name-alist");
+ SCM glyph_name = ly_assoc_get (me->get_property ("alteration"),
+ alist, SCM_BOOL_F);
+
+ if (!scm_is_string (glyph_name))
+ {
+ me->warning ("Could not find glyph-name for alteration");
+ return SCM_EOL;
+ }
- Stencil mol (*unsmob_stencil (scm_car (stencils)));
+ Stencil mol (fm->find_by_name (scm_i_string_chars (glyph_name)));
if (to_boolean (me->get_property ("restore-first")))
{
- string font_char = get_fontcharname (style, 0);
- Stencil acc (fm->find_by_name ("accidentals." + font_char));
+ /*
+ this isn't correct for ancient accidentals, but they don't
+ use double flats/sharps anyway.
+ */
+ Stencil acc (fm->find_by_name ("accidentals.natural"));
if (acc.is_empty ())
- me->warning (_f ("accidental `%s' not found", font_char));
+ me->warning (_ ("natural alteration glyph not found"));
else
mol.add_at_edge (X_AXIS, LEFT, acc, 0.1, 0);
}
- if (parens)
+ if (to_boolean (me->get_property ("parenthesized")))
mol = parenthesize (me, mol);
return mol.smobbed_copy ();
}
-
-MAKE_SCHEME_CALLBACK (Accidental_interface, calc_stencils, 1);
-SCM
-Accidental_interface::calc_stencils (SCM smob)
-{
- Grob *me = unsmob_grob (smob);
-
- SCM scm_style = me->get_property ("style");
- string style;
- if (scm_is_symbol (scm_style))
- style = ly_symbol2string (scm_style);
- else
- /*
- preferably no name for the default style.
- */
- style = "";
-
-
- Font_metric *fm = Font_interface::get_default_font (me);
- SCM acc = me->get_property ("alteration");
- if (scm_is_number (acc))
- {
- string font_char = get_fontcharname (style, scm_to_int (acc));
-
- Stencil acc_stencil (fm->find_by_name ("accidentals." + font_char));
-
- return scm_list_1 (acc_stencil.smobbed_copy ());
- }
- else
- return SCM_EOL;
-}
ADD_INTERFACE (Accidental_interface,
"alteration "
"avoid-slur "
"forced "
- "style "
"parenthesized "
"restore-first "
+ "glyph-name-alist "
"tie "
);
}
else
{
- accidentals_[d]->set_property ("alteration", scm_from_int (int (Real (Rational (4) * p.get_alteration ()))));
+ accidentals_[d]->set_property ("alteration", ly_rational2scm (p.get_alteration ()));
}
}
while (flip (&d) != DOWN);
}
-SCM
-make_qt_key (SCM rat_key)
-{
- SCM qt_key = SCM_EOL;
- SCM *tail = &qt_key;
-
- for (SCM s = rat_key; scm_is_pair (s); s = scm_cdr (s))
- {
- *tail = scm_cons (scm_cons (scm_caar (s),
- scm_from_int (Rational (4)* ly_scm2rational (scm_cdar (s)))),
- SCM_EOL);
- tail = SCM_CDRLOC (*tail);
- }
-
- return qt_key;
-}
-
void
Key_engraver::create_key (bool is_default)
{
key_event_
? key_event_->self_scm () : SCM_EOL);
- cancellation_->set_property ("alteration-alist", make_qt_key (restore));
+ cancellation_->set_property ("alteration-alist", restore);
cancellation_->set_property ("c0-position",
get_property ("middleCPosition"));
}
}
-
- item_->set_property ("alteration-alist", make_qt_key (key));
+ item_->set_property ("alteration-alist", key);
}
if (!is_default)
DECLARE_GROB_INTERFACE();
};
-/*
- FIXME: too much hardcoding here.
-*/
-const int FLAT_TOP_PITCH = 2; /* fes, ges, as and bes typeset in lower octave */
-const int SHARP_TOP_PITCH = 4; /* ais and bis typeset in lower octave */
-
-/*
- TODO: look this up. I'm not sure where the naturals ought to go.
-
- COMMENT: Current implementation does not use the NATURAL_TOP_PITCH for anything,
- always typesets naturals in the same place as the thing they cancel. -rz
-*/
-const int NATURAL_TOP_PITCH = 4;
-
-/*
- FIXME: key-item should just get a list of (position, acc), and leave
- the thinking to other parties.
-
- - TODO: put this in Scheme
-
- TODO: can we do without c0pos? it's partly musical.
-*/
-int
-alteration_pos (SCM what, int alter, int c0p)
-{
- if (scm_is_pair (what))
- return scm_to_int (scm_car (what)) * 7 + scm_to_int (scm_cdr (what)) + c0p;
-
- int p = scm_to_int (what);
-
- // Find the c in the range -4 through 2
- int from_bottom_pos = c0p + 4;
- from_bottom_pos = from_bottom_pos % 7;
- from_bottom_pos = (from_bottom_pos + 7) % 7; // Precaution to get positive.
- int c0 = from_bottom_pos - 4;
-
- if ((alter < 0 && ((p > FLAT_TOP_PITCH) || (p + c0 > 4)) && (p + c0 > 1))
- || (alter > 0 && ((p > SHARP_TOP_PITCH) || (p + c0 > 5)) && (p + c0 > 2))
- || (alter == 0 && ((p > NATURAL_TOP_PITCH) || (p + c0 > 5)) && (p + c0 > 2)))
- {
- p -= 7; /* Typeset below c_position */
- }
-
- /* Provide for the four cases in which there's a glitch
- it's a hack, but probably not worth
- the effort of finding a nicer solution.
- --dl. */
- if (c0 == 2 && alter > 0 && p == 3)
- p -= 7;
- if (c0==-3 && alter > 0 && p ==-1)
- p += 7;
- if (c0==-4 && alter < 0 && p ==-1)
- p += 7;
- if (c0==-2 && alter < 0 && p ==-3)
- p += 7;
-
- return p + c0;
-}
/*
TODO
else
style = "";
- SCM newas = me->get_property ("alteration-alist");
Stencil mol;
SCM c0s = me->get_property ("c0-position");
- int c0p = 0;
- if (scm_is_number (c0s))
- c0p = scm_to_int (c0s);
bool is_cancellation = me->internal_has_interface
(ly_symbol2scm ("key-cancellation-interface"));
int last_pos = -1000;
Font_metric *fm = Font_interface::get_default_font (me);
- for (SCM s = newas; scm_is_pair (s); s = scm_cdr (s))
+ SCM alist = me->get_property ("glyph-name-alist");
+
+ for (SCM s = me->get_property ("alteration-alist"); scm_is_pair (s); s = scm_cdr (s))
{
- int alteration = scm_to_int (scm_cdar (s));
- string font_char
- = Accidental_interface::get_fontcharname (style,
- is_cancellation
- ? 0
- : alteration);
- Stencil acc (fm->find_by_name ("accidentals." + font_char));
+ SCM alt = is_cancellation
+ ? scm_from_int (0)
+ : scm_cdar (s);
+
+ SCM glyph_name = ly_assoc_get (alt, alist, SCM_BOOL_F);
+ Stencil acc (fm->find_by_name (ly_scm2string (glyph_name)));
if (acc.is_empty ())
- me->warning (_f ("accidental `%s' not found", font_char));
+ me->warning (_ ("alteration not found"));
else
{
SCM what = scm_caar (s);
- int pos = alteration_pos (what, alteration, c0p);
+
+ SCM proc = ly_lily_module_constant ("key-signature-interface::alteration-position");
+
+ int pos = scm_to_int (scm_call_3 (proc, what, scm_cdar (s), c0s));
acc.translate_axis (pos * inter, Y_AXIS);
/*
ADD_INTERFACE (Key_signature_interface,
"A group of accidentals, to be printed as signature sign.",
+ "alteration-alist "
"c0-position "
+ "glyph-name-alist "
"style "
- "alteration-alist "
);
"Stem and noteheads combined",
/* properties */
- "accidentals "
"arpeggio "
"force-hshift "
"horizontal-shift "
{
int n = (notename_ + 2) % scale_->step_tones_.size ();
string s = ::to_string (char (n + 'a'));
- Rational qtones = alteration_ * Rational (4,1);
- int qt = int (rint (Real (qtones)));
+ Rational qtones = alteration_ * Rational (4,1);
+ int qt = int (rint (Real (qtones)));
- s += string (accname[qt + 4]);
+ s += string (accname[qt + 4]);
if (octave_ >= 0)
{
int o = octave_ + 1;
return p;
}
+Rational NATURAL_ALTERATION (0);
Rational FLAT_ALTERATION (-1, 2);
+Rational DOUBLE_FLAT_ALTERATION (-1);
Rational SHARP_ALTERATION (1, 2);
Pitch
trill_accidental_ = make_item ("TrillPitchAccidental", ev->self_scm ());
// fixme: naming -> alterations
- trill_accidental_->set_property ("alteration", scm_from_int (Rational (4)
- * p->get_alteration ()));
+ trill_accidental_->set_property ("alteration", ly_rational2scm (p->get_alteration ()));
Side_position_interface::add_support (trill_accidental_, trill_head_);
trill_head_->set_object ("accidental-grob", trill_accidental_->self_scm ());
{
penalty = parameters_.accidental_collision_;
- SCM alt = g->get_property ("alteration");
+ Rational alt = ly_scm2rational (g->get_property ("alteration"));
SCM scm_style = g->get_property ("style");
if (!scm_is_symbol (scm_style)
&& !to_boolean (g->get_property ("parenthesized"))
&& !to_boolean (g->get_property ("restore-first")))
{
/* End copy accidental.cc */
- switch (scm_to_int (alt))
- {
- case FLAT:
- case DOUBLE_FLAT:
- xp = LEFT;
- break;
- case SHARP:
- xp = 0.5 * dir_;
- break;
- case NATURAL:
- xp = -dir_;
- break;
- }
+ if (alt == FLAT_ALTERATION
+ || alt == DOUBLE_FLAT_ALTERATION)
+ xp = LEFT;
+ else if (alt == SHARP_ALTERATION)
+ xp = 0.5 * dir_;
+ else if (alt == NATURAL_ALTERATION)
+ xp = -dir_;
}
}
%
%input feta-eindelijk;
-%input feta-toevallig;
+input feta-toevallig;
%input feta-puntje;
-input feta-bolletjes;
+%input feta-bolletjes;
%input feta-arrow;
%input feta-schrift;
%input feta-schrift;
%
% feta-toevallig.mf -- implement Accidentals
%
-% source file of the Feta (Font-En-Tja) music font
-%
% (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
%
+%
+% also show in other configuration wrt staff lines.
+%
+def draw_shifted_too =
+if test > 0:
+ fet_beginchar ("shifted too", "");
+ set_char_box (0, 0,0,0);
+ currentpicture := remember_pic;
+
+ draw_staff (-2, 2, 0.5);
+ fet_endchar;
+fi;
+enddef;
+
+
+
%
% Accidentals from various sources, notably
%
%
+%
+% Naming for microtonal
+%
+% BASES SLASHES STEMS
+%
+% mirroredflat.flat.slashslash
+%
+
+% standard sharp:
+% sharp.slashslash.stemstem
+% sharp.slashslash.stem
+
+
fet_begingroup ("accidentals");
save remember_pic;
picture remember_pic;
+save sharp_beamheight;
+sharp_beamheight# := 0.3 staff_space# + stafflinethickness#;
%
% The beams of most sharps have horizontal endings (as if drawn with
%
def draw_meta_sharp (expr width, offset) =
- save beamheight, beamwidth, beamslope;
+ save beamwidth, beamslope;
save ne, nw_dist;
pair ne, nw_dist;
beamwidth := width;
- beamheight# := 0.3 staff_space# + stafflinethickness#;
- define_whole_vertical_blacker_pixels (beamheight);
+ define_whole_vertical_blacker_pixels (sharp_beamheight);
clearxy;
- beamslope = beamheight / beamwidth;
+ beamslope = sharp_beamheight / beamwidth;
pickup pencircle scaled 2 blot_diameter;
rt x2 - lft x1 = beamwidth;
- y2 - y1 = beamheight;
+ y2 - y1 = sharp_beamheight;
.5 [z1, z3] = (.5 w, offset);
x3 = x2;
- top y2 - bot y3 = beamheight;
+ top y2 - bot y3 = sharp_beamheight;
x4 = x1;
- top y1 - bot y4 = beamheight;
+ top y1 - bot y4 = sharp_beamheight;
ne = unitvector (z2 - z1);
nw_dist = (ne rotated 90) * blot_diameter;
enddef;
-fet_beginchar ("Sharp", "2");
+fet_beginchar ("Sharp", "sharp");
save stem, stemx, stemwidth;
save outer_space, interbeam;
draw_staff (-2, 2, 0);
fet_endchar;
+draw_shifted_too;
-if test > 0:
- fet_beginchar ("Sharp", "2");
-
- set_char_box (0, 1.1 staff_space#,
- 1.5 staff_space#, 1.5 staff_space#);
-
- currentpicture := remember_pic;
-
- draw_staff (-2, 2, 0.5);
- fet_endchar;
-fi;
-
-
-fet_beginchar ("1/2 Sharp", "1");
+fet_beginchar ("1/2 Sharp", "sharp.slashslash.stem");
save stem, stemwidth;
save outer_space, interbeam;
draw_staff (-2, 2, 0);
fet_endchar;
+draw_shifted_too;
-if test > 0:
- fet_beginchar ("1/2 Sharp", "1");
+fet_beginchar ("Sharp (3 beams)", "sharp.slashslashslash.stemstem");
+ save stem, stemx, stemwidth;
+ save outer_space, interbeam;
+ save sharp_beamheight;
- set_char_box (0, 0.7 staff_space#,
- 1.5 staff_space#, 1.5 staff_space#);
+ sharp_beamheight# := 0.22 staff_space# + stafflinethickness#;
- currentpicture := remember_pic;
- draw_staff (-2, 2, 0.5);
- fet_endchar;
-fi;
+ stemwidth# := stafflinethickness# + .05 staff_space#;
+ define_whole_blacker_pixels (stemwidth);
+ interbeam := 1.2 staff_space_rounded;
+
+ set_char_box (0, 1.1 staff_space#,
+ 1.5 staff_space#, 1.5 staff_space#);
-fet_beginchar ("3/4 Sharp", "3");
+ stem := 7 / 16 * w;
+ stemx := hround stem;
+ outer_space := hround ((w - stemx - stemwidth) / 2);
+
+ w := 2 outer_space + stemx + stemwidth;
+ d := d - feta_space_shift;
+
+ draw_meta_sharp (.88 w, -.5 interbeam);
+ draw_meta_sharp (w, 0);
+ draw_meta_sharp (.88 w, -.5 interbeam + vround interbeam);
+
+ pickup pencircle scaled stemwidth;
+
+ lft x5 = lft x6 = outer_space;
+ lft x7 = lft x8 = outer_space + stemx;
+ bot y5 = -d;
+ top y6 = vround (1.5 staff_space - stem * beamslope);
+ bot y7 = -top y6 + feta_space_shift;
+ top y8 = h;
+
+ labels (5, 6, 7, 8);
+
+ draw_gridline (z5, z6, stemwidth);
+ draw_gridline (z7, z8, stemwidth);
+
+ remember_pic := currentpicture;
+
+ draw_staff (-2, 2, 0);
+fet_endchar;
+
+draw_shifted_too;
+
+fet_beginchar ("1/2 Sharp (3 beams)", "sharp.slashslashslash.stem");
+ save stem, stemx, stemwidth;
+ save outer_space, interbeam;
+ save sharp_beamheight;
+
+ sharp_beamheight# := 0.22 staff_space# + stafflinethickness#;
+
+ stemwidth# := stafflinethickness# + .05 staff_space#;
+ define_whole_blacker_pixels (stemwidth);
+
+ interbeam := 1.2 staff_space_rounded;
+
+ set_char_box (0, 0.95 staff_space#,
+ 1.3 staff_space#, 1.3 staff_space#);
+
+ stem := 7 / 16 * w;
+ outer_space := hround ((w - stemwidth) / 2);
+ w := 2 outer_space + stemwidth;
+ d := d - feta_space_shift;
+
+ draw_meta_sharp (.8 w, -.5 interbeam);
+ draw_meta_sharp (w, 0);
+ draw_meta_sharp (.8 w, -.5 interbeam + vround interbeam);
+
+ pickup pencircle scaled stemwidth;
+
+ lft x5 = lft x6 = outer_space;
+ top y6 = vround (1.5 staff_space - .5 stem);
+ bot y5 = -top y6 + feta_space_shift;
+ labels (5, 6);
+
+
+ draw_gridline (z5, z6, stemwidth);
+
+
+ remember_pic := currentpicture;
+
+ draw_staff (-2, 2, 0);
+fet_endchar;
+
+draw_shifted_too;
+
+
+fet_beginchar ("3/4 Sharp", "sharp.slashslash.stemstemstem");
save stem, stemx, stemwidth;
save outer_space, interbeam;
draw_staff (-2, 2, 0);
fet_endchar;
+draw_shifted_too;
-if test > 0:
- fet_beginchar ("3/4 Sharp", "3");
-
- set_char_box (0, 1.6 staff_space#,
- 1.5 staff_space#, 1.5 staff_space#);
-
- currentpicture := remember_pic;
-
- draw_staff (-2, 2, 0.5);
- fet_endchar;
-fi;
%
% The stems of the natural are brushed (at least, in Barenreiter SCS)
%
-fet_beginchar ("Natural", "0");
+fet_beginchar ("Natural", "natural");
save stemwidth, top_stem_thick;
save ne, pat_top, pat_bottom;
pair ne;
draw_staff (-2, 2, 0);
fet_endchar;
-
-if test > 0:
- fet_beginchar ("Natural", "0");
- set_char_box (0, 2/3 staff_space#,
- 1.5 staff_space#, 1.5 staff_space#);
-
- currentpicture := remember_pic;
-
- draw_staff (-2, 2, 0.5);
- fet_endchar;
-fi;
+draw_shifted_too;
%
% unfortunately, 600dpi is not enough to show the brush of the stem.
%
-fet_beginchar ("Flat", "-2");
+fet_beginchar ("Flat", "flat");
set_char_box (1.2 stafflinethickness#, .8 staff_space#,
0.6 staff_space#, 1.9 staff_space#);
draw_staff (-2, 2, 0);
fet_endchar;
+draw_shifted_too;
-if test > 0:
- fet_beginchar ("Flat", "-2");
- set_char_box (1.2 stafflinethickness#, .8 staff_space#,
- 0.6 staff_space#, 1.9 staff_space#);
+fet_beginchar ("Flat (slashed)", "flat.slash");
+ set_char_box (1.2 stafflinethickness#, .8 staff_space#,
+ 0.6 staff_space#, 1.9 staff_space#);
- currentpicture := remember_pic;
+ draw_meta_flat (0, w, 0.31 staff_space);
+ clearxy;
+ save slope, slash_width;
+ slope = 0.5;
+ slash_width = w;
+ z1 = (0, h / 2);
+ z2 = z1 - (slash_width, slash_width * slope)/2;
+ z3 = z1 + (slash_width, slash_width * slope)/2;
+
+ pickup pencircle scaled 1.5 stafflinethickness;
+ draw z2 .. z3;
+ labels (1, 2, 3);
+ remember_pic := currentpicture;
- draw_staff (-2, 2, 0.5);
- fet_endchar;
-fi;
+ draw_staff (-2, 2, 0);
+fet_endchar;
+
+fet_beginchar ("Flat (slashed twice)", "flat.slashslash");
+ set_char_box (1.2 stafflinethickness#, .8 staff_space#,
+ 0.6 staff_space#, 1.9 staff_space#);
+
+ draw_meta_flat (0, w, 0.31 staff_space);
+ clearxy;
+ save slope, slash_width;
+
+ slope = 0.5;
+ slash_width = w;
+ pickup pencircle scaled 1.5 stafflinethickness;
+
+ z1 = (0, 5/12 h);
+ z2 = (0, 2/3 h);
+ draw z1 - (slash_width, slash_width * slope)/2
+ .. z1 + (slash_width, slash_width * slope)/2;
+ draw z2 - (slash_width, slash_width * slope)/2
+ .. z2 + (slash_width, slash_width * slope)/2;
+ labels (1, 2);
+ remember_pic := currentpicture;
+
+ draw_staff (-2, 2, 0);
+fet_endchar;
+
+fet_beginchar ("Flatflat (mirrored)", "mirroredflat.flat");
+ set_char_box (0, 1.6 staff_space#,
+ 0.6 staff_space#, 1.9 staff_space#);
+ draw_meta_flat (0, w/2, 0.31 staff_space);
+ currentpicture := currentpicture xscaled -1;
+ draw_meta_flat (0, w/2, 0.31 staff_space);
+
+ currentpicture := currentpicture shifted (w/2,0);
+ penlabels (range 0 thru 11);
-fet_beginchar ("Semi flat", "-1");
+ remember_pic := currentpicture;
+
+ draw_staff (-2, 2, 0);
+fet_endchar;
+
+draw_shifted_too;
+
+
+
+fet_beginchar ("Semi flat", "mirroredflat");
set_char_box (1.2 stafflinethickness#, .8 staff_space#,
0.6 staff_space#, 1.9 staff_space#);
fet_endchar;
-fet_beginchar ("Double Flat", "-4");
+fet_beginchar ("Double Flat", "flatflat");
save left_wid, overlap, right_wid;
left_wid = .7;
fet_endchar;
-fet_beginchar ("3/4 Flat", "-3");
+fet_beginchar ("3/4 Flat", "flatflat.slash");
save left_wid, overlap, right_wid;
left_wid = .7;
draw_staff (-2, 2, 0);
fet_endchar;
+draw_shifted_too;
-if test > 0:
- fet_beginchar ("3/4 Flat", "-3");
- save left_wid, overlap, right_wid;
-
- left_wid = .7;
- right_wid = .8;
- overlap = .05;
-
- set_char_box (1.2 stafflinethickness#,
- (left_wid + right_wid - overlap) * staff_space#,
- .6 staff_space#, 1.9 staff_space#);
-
- currentpicture := remember_pic;
-
- draw_staff (-2, 2, 0.5);
- fet_endchar;
-fi;
-
-
-fet_beginchar ("Double Sharp", "4");
+fet_beginchar ("Double Sharp", "doublesharp");
save klaverblad, klaversteel;
save pat;
path pat;
draw_staff (-2, 2, 0);
fet_endchar;
-
-if test > 0:
- fet_beginchar ("Double Sharp", "4");
- set_char_box (0, staff_space#,
- .5 staff_space#, .5 staff_space#);
-
- currentpicture := remember_pic;
-
- draw_staff (-2, 2, 0.5);
- fet_endchar;
-fi;
-
+draw_shifted_too;
def draw_paren =
save leftindent;
draw_staff (-2, 2, 0);
fet_endchar;
-
-if test > 0:
- fet_beginchar ("Right Parenthesis", "rightparen");
- draw_paren;
- penlabels (1, 2, 3);
-
- remember_pic := currentpicture;
-
- draw_staff (-2, 2, 0.5);
- fet_endchar;
-fi;
+draw_shifted_too;
fet_beginchar ("Left Parenthesis", "leftparen");
set_char_box (charwd, charbp, chardp, charht);
fet_endchar;
-
fet_endgroup ("accidentals");
str = re.sub ("([A-Za-z]+)\s*#'cautionary-style\s*=\s*#'smaller",
r"\1 #'font-size = #-2", str)
+ def sub_acc_name (m):
+ idx = int (m.group (1).replace ('M','-'))
+
+ return ["accidentals.doublesharp",
+ "accidentals.sharp.slashslash.stemstemstem",
+ "accidentals.sharp",
+ "accidentals.sharp.slashslash.stem",
+ "accidentals.natural",
+ "accidentals.mirroredflat",
+ "accidentals.flat",
+ "accidentals.mirroredflat.flat",
+ "accidentals.flatflat"][4-idx]
+
+ str = re.sub (r"accidentals[.](M?[-0-9]+)",
+ sub_acc_name, str)
+
return str
-conversions.append (((2, 11, 5), conv, """ly:clone-parser -> ly:parser-clone"""))
+conversions.append (((2, 11, 5), conv, """deprecate cautionary-style. Use AccidentalCautionary properties"""))
+
+
0.3
0.6)
(make-musicglyph-markup
- (format "accidentals.~a"
- (inexact->exact (* 4 alteration)))))))
+ (assoc-get alteration standard-alteration-glyph-name-alist "")))))
(define (accidental->markup alteration)
"Return accidental markup for ALTERATION."
(ly:add-interface
'trill-pitch-accidental-interface
"An accidental for trill pitch"
- '(accidentals))
+ '()
+ )
(ly:add-interface
'rhythmic-grob-interface
property.")
(gap ,ly:dimension? "Size of a gap in a variable symbol.")
(gap-count ,integer? "Number of gapped beams for tremolo.")
+ (glyph-name-alist ,list? "Alist of key-string pairs.")
(grow-direction ,ly:dir? "Crescendo or decrescendo?")
(hair-thickness ,number? "Thickness of the thin line in a bar line.")
(head-direction ,ly:dir? "Are the note heads left or right in a semitie?")
(Accidental
. (
(avoid-slur . inside)
+ (glyph-name-alist . ,standard-alteration-glyph-name-alist)
+ (alteration . ,accidental-interface::calc-alteration)
(stencil . ,ly:accidental-interface::print)
- (stencils . ,ly:accidental-interface::calc-stencils)
(after-line-breaking
. ,ly:accidental-interface::after-line-breaking)
(meta . ((class . Item)
. (
(avoid-slur . inside)
(parenthesized . #t)
+ (glyph-name-alist . ,standard-alteration-glyph-name-alist)
+ (alteration . ,accidental-interface::calc-alteration)
(stencil . ,ly:accidental-interface::print)
- (stencils . ,ly:accidental-interface::calc-stencils)
(after-line-breaking
. ,ly:accidental-interface::after-line-breaking)
(meta . ((class . Item)
,(ly:make-simple-closure (list ly:self-alignment-interface::x-aligned-on-self)))))
(self-alignment-X . ,CENTER)
(font-size . -2)
+ (glyph-name-alist . ,standard-alteration-glyph-name-alist)
+ (alteration . ,accidental-interface::calc-alteration)
(Y-offset . ,ly:side-position-interface::y-aligned-side)
(direction . ,UP)
(staff-padding . 0.25)
(outside-staff-priority . 0)
(script-priority . 0)
- (stencils . ,ly:accidental-interface::calc-stencils)
(side-axis . ,X)
(meta . ((class . Item)
(interfaces . (side-position-interface
(X-offset . ,ly:side-position-interface::x-aligned-side)
(direction . ,LEFT)
(stencil . ,ly:accidental-interface::print)
- (stencils . ,ly:accidental-interface::calc-stencils)
-
+ (glyph-name-alist . ,standard-alteration-glyph-name-alist)
(after-line-breaking . ,ly:accidental-interface::after-line-breaking)
(side-axis . ,X)
(meta . ((class . Item)
. (
(stencil . ,ly:key-signature-interface::print)
(avoid-slur . inside)
+ (glyph-name-alist . ,standard-alteration-glyph-name-alist)
(space-alist . (
(time-signature . (extra-space . 1.15))
(staff-bar . (extra-space . 1.1))
(font-size . -4)
(side-axis . ,X)
(stencil . ,ly:accidental-interface::print)
- (stencils . ,ly:accidental-interface::calc-stencils)
+ (glyph-name-alist . ,standard-alteration-glyph-name-alist)
(meta . ((class . Item)
(interfaces . (item-interface
trill-pitch-accidental-interface
(define-markup-command (doublesharp layout props) ()
"Draw a double sharp symbol."
- (interpret-markup layout props (markup #:musicglyph "accidentals.4")))
+ (interpret-markup layout props (markup #:musicglyph (assoc-get 1 standard-alteration-glyph-name-alist ""))))
(define-markup-command (sesquisharp layout props) ()
"Draw a 3/2 sharp symbol."
- (interpret-markup layout props (markup #:musicglyph "accidentals.3")))
+ (interpret-markup layout props (markup #:musicglyph (assoc-get 3/4 standard-alteration-glyph-name-alist ""))))
+
(define-markup-command (sharp layout props) ()
"Draw a sharp symbol."
- (interpret-markup layout props (markup #:musicglyph "accidentals.2")))
+ (interpret-markup layout props (markup #:musicglyph (assoc-get 1/2 standard-alteration-glyph-name-alist ""))))
(define-markup-command (semisharp layout props) ()
"Draw a semi sharp symbol."
- (interpret-markup layout props (markup #:musicglyph "accidentals.1")))
+ (interpret-markup layout props (markup #:musicglyph (assoc-get 1/4 standard-alteration-glyph-name-alist ""))))
(define-markup-command (natural layout props) ()
"Draw a natural symbol."
- (interpret-markup layout props (markup #:musicglyph "accidentals.0")))
+ (interpret-markup layout props (markup #:musicglyph (assoc-get 0 standard-alteration-glyph-name-alist ""))))
(define-markup-command (semiflat layout props) ()
"Draw a semiflat."
- (interpret-markup layout props (markup #:musicglyph "accidentals.M1")))
+ (interpret-markup layout props (markup #:musicglyph (assoc-get -1/4 standard-alteration-glyph-name-alist ""))))
(define-markup-command (flat layout props) ()
"Draw a flat symbol."
- (interpret-markup layout props (markup #:musicglyph "accidentals.M2")))
+ (interpret-markup layout props (markup #:musicglyph (assoc-get -1/2 standard-alteration-glyph-name-alist ""))))
(define-markup-command (sesquiflat layout props) ()
"Draw a 3/2 flat symbol."
- (interpret-markup layout props (markup #:musicglyph "accidentals.M3")))
+ (interpret-markup layout props (markup #:musicglyph (assoc-get -3/4 standard-alteration-glyph-name-alist ""))))
(define-markup-command (doubleflat layout props) ()
"Draw a double flat symbol."
- (interpret-markup layout props (markup #:musicglyph "accidentals.M4")))
+ (interpret-markup layout props (markup #:musicglyph (assoc-get -1 standard-alteration-glyph-name-alist ""))))
(define-markup-command (with-color layout props color arg) (color? markup?)
"Draw @var{arg} in color specified by @var{color}"
(define-markup-command (musicglyph layout props glyph-name) (string?)
"This is converted to a musical symbol, e.g. @code{\\musicglyph
-#\"accidentals.0\"} will select the natural sign from the music font.
+#\"accidentals.natural\"} will select the natural sign from the music font.
See @usermanref{The Feta font} for a complete listing of the possible glyphs."
(ly:font-get-glyph
(ly:paper-get-font layout (cons '((font-encoding . fetaMusic))
(define-public darkmagenta '(0.5 0.0 0.5))
(define-public darkyellow '(0.5 0.5 0.0))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; key signature
+
+
+(define-public (key-signature-interface::alteration-position step alter c0-position)
+ ;; TODO: memoize - this is mostly constant.
+
+ ;; fes, ges, as and bes typeset in lower octave
+ (define FLAT_TOP_PITCH 2)
+
+ ;; ais and bis typeset in lower octave
+ (define SHARP_TOP_PITCH 4)
+
+ (if (pair? step)
+ (+ (cdr step) (* (car step) 7) c0-position)
+ (let*
+ ((from-bottom-pos (modulo (+ 4 49 c0-position) 7))
+ (p step)
+ (c0 (- from-bottom-pos 4)))
+
+ (if
+ (or (and (< alter 0) (or (> p FLAT_TOP_PITCH) (> (+ p c0) 4)) (> (+ p c0) 1))
+ (and (> alter 0) (or (> p SHARP_TOP_PITCH) (> (+ p c0) 5)) (> (+ p c0) 2))
+ )
+
+ ;; Typeset below c_position
+ (set! p (- p 7)))
+
+ ;; Provide for the four cases in which there's a glitch
+ ;; it's a hack, but probably not worth
+ ;; the effort of finding a nicer solution.
+ ;; --dl.
+ (cond
+ ((and (= c0 2) (= p 3) (> alter 0))
+ (set! p (- p 7)))
+ ((and (= c0 -3) (= p -1) (> alter 0))
+ (set! p (+ p 7)))
+ ((and (= c0 -4) (= p -1) (< alter 0))
+ (set! p (+ p 7)))
+ ((and (= c0 -2) (= p -3) (< alter 0))
+ (set! p (+ p 7))))
+
+ (+ c0 p))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; accidentals
+
+(define-public (accidental-interface::calc-alteration grob)
+ (ly:pitch-alteration (ly:event-property (event-cause grob) 'pitch)))
+
+(define-public standard-alteration-glyph-name-alist
+ '((1 . "accidentals.doublesharp")
+ (3/4 . "accidentals.sharp.slashslash.stemstemstem")
+ (1/2 . "accidentals.sharp")
+ (1/4 . "accidentals.sharp.slashslash.stem")
+ (0 . "accidentals.natural")
+ (-1/4 . "accidentals.mirroredflat")
+ (-1/2 . "accidentals.flat")
+ (-3/4 . "accidentals.mirroredflat.flat")
+ (-1 . "accidentals.flatflat")
+ ))
+
+(define-public makam-alteration-glyph-name-alist
+ '((1 . "accidentals.doublesharp")
+ (8/9 . "accidentals.sharp.slashslashslash.stemstem")
+ (5/9 . "accidentals.sharp.slashslashslash.stem")
+ (4/9 . "accidentals.sharp")
+ (1/9 . "accidentals.sharp.slashslash.stem")
+ (0 . "accidentals.natural")
+ (-1/9 . "accidentals.mirroredflat")
+ (-4/9 . "accidentals.flat.slash")
+ (-5/9 . "accidentals.flat")
+ (-8/9 . "accidentals.flat.slashslash")
+ (-1 . "accidentals.flatflat")
+ ))
+
+(define-public alteration-hufnagel-glyph-name-alist
+ '((1/2 . "accidentals.hufnagel-1")
+ (0 . "accidentals.vaticana0")
+ (-1/2 . "accidentals.mensural1")))
+
+(define-public alteration-medicae-glyph-name-alist
+ '((1/2 . "accidentals.medicaea-1")
+ (0 . "accidentals.vaticana0")
+ (-1/2 . "accidentals.mensural1")))
+
+(define-public alteration-vaticana-glyph-name-alist
+ '((1/2 . "accidentals.vaticana-1")
+ (0 . "accidentals.vaticana0")
+ (-1/2 . "accidentals.mensural1")))
+
+(define-public alteration-mensural-glyph-name-alist
+ '((1/2 . "accidentals.mensural-1")
+ (0 . "accidentals.vaticana0")
+ (-1/2 . "accidentals.mensural1")))
+
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; * Pitch Trill Heads
;; * Parentheses
(define-public (parentheses-item::calc-parenthesis-stencils grob)
- (let* (
- (font (ly:grob-default-font grob))
+ (let* ((font (ly:grob-default-font grob))
(lp (ly:font-get-glyph font "accidentals.leftparen"))
- (rp (ly:font-get-glyph font "accidentals.rightparen"))
- )
+ (rp (ly:font-get-glyph font "accidentals.rightparen")))
(list lp rp)))