bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue 1688 in lilypond: New half-closed hihat symbol for drum mode


From: lilypond
Subject: Re: Issue 1688 in lilypond: New half-closed hihat symbol for drum mode
Date: Sun, 12 Jun 2011 05:02:39 +0000


Comment #1 on issue 1688 by address@hidden: New half-closed hihat symbol for drum mode
http://code.google.com/p/lilypond/issues/detail?id=1688

In trying to make this work, I encountered a problem with metafont.

Here's the code that was used for the old half-closed symbol:


fet_beginchar ("halfopen (unstopped)", "halfopen");
        save thin, height, width, thick, factor, slash;

        factor = 5/4;
        height# = 5/4 width#;
        height# = staff_space#;
        thin = 0.6 linethickness + 0.06 staff_space;
        slash# = 1.05 linethickness#;

        set_char_box (width# / 2, width# / 2, height# / 2, height# / 2);

        define_pixels (width, height, slash);

        2 thick + 0.6 (height - 2 thin) = width;

        penpos1 (thick, 0);
        penpos2 (thin, 90);
        penpos3 (thick, 180);
        penpos4 (thin, 270);
        z1r = (w, 0);
        z2r = (0, h);
        z3r = (-w, 0);
        z4r = (0, -h);

        penlabels (1, 2, 3, 4);

        penstroke z1e{up}
                  .. z2e{left}
                  .. z3e{down}
                  .. z4e{right}
                  .. cycle;

        draw_brush ((-w * factor, -h * factor), slash,
                    (w * factor, h * factor), slash);
fet_endchar;


I tried to move the slash to vertical:

fet_beginchar ("bad halfopen hi hat", "badhihathalfopen");
        save thin, height, width, thick, factor, slash;

        factor := 5/4 * sqrt(1 + 25/16);
        height# = 5/4 width#;
        height# = staff_space#;
        thin = 0.6 linethickness + 0.06 staff_space;
        slash# = 1.05 linethickness#;

        set_char_box (width# / 2, width# / 2, height# / 2, height# / 2);

        define_pixels (width, height, slash);

        2 thick + 0.6 (height - 2 thin) = width;

        penpos1 (thick, 0);
        penpos2 (thin, 90);
        penpos3 (thick, 180);
        penpos4 (thin, 270);
        z1r = (w, 0);
        z2r = (0, h);
        z3r = (-w, 0);
        z4r = (0, -h);

        penlabels (1, 2, 3, 4);

        penstroke z1e{up}
                  .. z2e{left}
                  .. z3e{down}
                  .. z4e{right}
                  .. cycle;

        draw_brush ((0, -h * factor), slash,
                    (0, h * factor), slash);
fet_endchar;


When I did so, one of the curves had an end with a negative tangency. See bad hihat.png. The outer curve on the bottom left has a tangency pointing straight down, instead of straight up.

So I tried to put a small amount of slant in the line. If the slant is more than 0.5 pixel, then everything seems to work out right:

 fet_beginchar ("halfopen hi hat", "hihathalfopen");
        save thin, height, width, thick, factor, slash;
        save epsilon;

        factor := 5/4 * sqrt(1 + 25/16);
        height# = 5/4 width#;
        height# = staff_space#;
        thin = 0.6 linethickness + 0.06 staff_space;
        slash# = 1.05 linethickness#;
        epsilon := .08;

        set_char_box (width# / 2, width# / 2, height# / 2, height# / 2);

        define_pixels (width, height, slash);

        2 thick + 0.6 (height - 2 thin) = width;

        penpos1 (thick, 0);
        penpos2 (thin, 90);
        penpos3 (thick, 180);
        penpos4 (thin, 270);
        z1r = (w, 0);
        z2r = (0, h);
        z3r = (-w, 0);
        z4r = (0, -h);

        penlabels (1, 2, 3, 4);

        penstroke z1e{up}
                  .. z2e{left}
                  .. z3e{down}
                  .. z4e{right}
                  .. cycle;

        draw_brush ((-epsilon, -h * factor), slash,
                    (epsilon, h * factor), slash);
fet_endchar;


See good-hihat.png for this result.

Does anybody have an explanation for why the tangency reverses, or what I could do to fix it?

Thanks,

Carl



Attachments:
        bad hihat.png  11.8 KB
        good-hihat.png  12.4 KB




reply via email to

[Prev in Thread] Current Thread [Next in Thread]