lilypond-user
[Top][All Lists]
Advanced

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

Re: not-so-ancient flags


From: Werner LEMBERG
Subject: Re: not-so-ancient flags
Date: Thu, 19 Jun 2008 22:27:15 +0200 (CEST)

> Attached is a first attempt to do this, plus a sample file showing
> the new "straight", the "mensural" and the default flag styles.

Attached is a patch which fixes the metrics and glyph shapes so that
the straight flags convert nicely to PS outlines.  IMHO, the shapes
are ready for inclusion now into lilypond.  However, the rest is
untested, and I don't have time to write the documentation.

> 1) The glyph "flags.straightd3" is not found by lilypond (although
> it exists and appears in the PDF!), so it cannot be properly
> positioned... The error message is:
> test_straight_flags.ly:13:9: Warnung: Fähnchen »straightd3« nicht
> gefunden

No time to test this.

> 2) I'm using y_mirror_char; to create the flags for downwards stems,
> but it seems that in this case the outlines are not properly merged
> (i.e. the stem and the flags are not AND'ed), but instead XOR'ed, as
> the attached screenshot of the glyph shows (I opened the otf file in
> fontforge). If I don't use y_mirror_char, all the outlines are
> properly merged...

With the changed outline now everything seems to be fine (but I
haven't had problems before either).


    Werner

--- ./parmesan-macros.mf.old    2007-08-17 00:13:51.000000000 +0200
+++ ./parmesan-macros.mf        2008-06-19 21:53:16.000000000 +0200
@@ -70,27 +70,6 @@
 
 
 %
-% Get subpath specified by `dir_in' and `dir_out' of `curve'
-% which is then shifted by `offset'.  Assure that result has
-% the same orientation as `curve'.
-%
-def get_subpath (expr curve, dir_in, dir_out, offset) =
-       begingroup;
-       save t_in, t_out;
-
-       t_in := directiontime dir_in of curve;
-       t_out := directiontime dir_out of curve;
-
-       if t_in > t_out:
-               t_out := t_out + length curve;
-       fi;
-
-       (subpath (t_in, t_out) of curve) shifted offset
-       endgroup
-enddef;
-
-
-%
 % Get point specified by `dir_' of `curve' which is then
 % shifted by `offset'.
 %
--- ./feta-banier.mf.old        2007-10-18 17:08:23.000000000 +0200
+++ ./feta-banier.mf    2008-06-19 22:24:45.000000000 +0200
@@ -468,4 +468,123 @@
        y_mirror_char;
 fet_endchar;
 
+
+%%%%%%%%
+%
+% Straight flags (old, but not ancient, style)
+%
+
+save straight_flag_angle, straight_upflag_length;
+save straight_downflag_length, straight_flag_thickness;
+
+straight_flag_angle = -37;
+straight_upflag_length# = .65 black_notehead_width# + stemthickness# / 2;
+straight_downflag_length# = .833 black_notehead_width# + stemthickness# / 2;
+straight_flag_thickness# = 0.5 staff_space#;
+
+define_pixels (straight_upflag_length, straight_downflag_length);
+define_pixels (straight_flag_thickness);
+
+save straight_flag_path;
+path straight_flag_path;
+
+def draw_straight_flag (expr center, len, angle, thickness) =
+       clearxy;
+
+       save ellipse, T;
+       path ellipse;
+       transform T;
+
+       T := identity xscaled blot_diameter
+                     yscaled thickness;
+       pickup pencircle transformed T;
+       ellipse := reverse fullcircle transformed T;
+
+       z1 = center;
+       z2 = z1 + len * dir (angle);
+
+       fill top z1
+            -- get_subpath (ellipse, z2 - z1, z1 - z2, z2)
+            -- bot z1
+            -- cycle;
+enddef;
+
+
+def create_straight_flag_char (expr flag_count, len, lenhash) = 
+begingroup
+       save flagspace, depth, width;
+       flagspace# = 0.9 staff_space#;
+       define_pixels (flagspace);
+
+       (width#, depth#) = lenhash * dir (-straight_flag_angle)
+                          + (blot_diameter# / 2, straight_flag_thickness#)
+                          + (0, flagspace# * (flag_count - 1));
+
+       set_char_box (0, width#, depth#, stemthickness# / 2);
+
+       for n = 1 upto flag_count:
+               draw_straight_flag ((0, -flagspace * (n - 1)
+                                         - straight_flag_thickness / 2),
+                                   len,
+                                   straight_flag_angle,
+                                   straight_flag_thickness);
+       endfor
+
+       draw_square_block ((-0.5 stemthickness_rounded,
+                            -flag_count * flagspace), (0, 0));
+endgroup
+enddef;
+
+
+fet_beginchar ("straight 8th Flag (up)", "straightu3");
+       create_straight_flag_char (1, straight_upflag_length,
+                                  straight_upflag_length#);
+fet_endchar;
+
+
+fet_beginchar ("straight 16th Flag (up)", "straightu4");
+       create_straight_flag_char (2, straight_upflag_length,
+                                  straight_upflag_length#);
+fet_endchar;
+
+
+fet_beginchar ("straight 32nd Flag (up)", "straightu5");
+       create_straight_flag_char (3, straight_upflag_length,
+                                  straight_upflag_length#);
+fet_endchar;
+
+
+fet_beginchar ("straight 64th Flag (up)", "straightu6");
+       create_straight_flag_char (4, straight_upflag_length,
+                                  straight_upflag_length#);
+fet_endchar;
+
+
+fet_beginchar ("straight 8th (down)", "straightd3");
+       create_straight_flag_char (1, straight_downflag_length,
+                                  straight_downflag_length#);
+       y_mirror_char;
+fet_endchar;
+
+
+fet_beginchar ("straight 16th (down)", "straightd4");
+       create_straight_flag_char (2, straight_downflag_length,
+                                  straight_downflag_length#);
+       y_mirror_char;
+fet_endchar;
+
+
+fet_beginchar ("straight 32nd (down)", "straightd5");
+       create_straight_flag_char (3, straight_downflag_length,
+                                  straight_downflag_length#);
+       y_mirror_char;
+fet_endchar;
+
+
+fet_beginchar ("straight 64th (down)", "straightd6");
+       create_straight_flag_char (4, straight_downflag_length,
+                                  straight_downflag_length#);
+       y_mirror_char;
+fet_endchar;
+
 fet_endgroup ("flags");
--- ./feta-macros.mf.old        2007-10-18 17:10:25.000000000 +0200
+++ ./feta-macros.mf    2008-06-19 21:53:15.000000000 +0200
@@ -476,6 +476,27 @@
 enddef;
 
 
+%
+% Get subpath specified by `dir_in' and `dir_out' of `curve'
+% which is then shifted by `offset'.  Assure that result has
+% the same orientation as `curve'.
+%
+def get_subpath (expr curve, dir_in, dir_out, offset) =
+       begingroup;
+       save t_in, t_out;
+
+       t_in := directiontime dir_in of curve;
+       t_out := directiontime dir_out of curve;
+
+       if t_in > t_out:
+               t_out := t_out + length curve;
+       fi;
+
+       (subpath (t_in, t_out) of curve) shifted offset
+       endgroup
+enddef;
+
+
 pi := 3.14159;
 
 

reply via email to

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