[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Re: not-so-ancient flags
From: |
Werner LEMBERG |
Subject: |
Re: [PATCH] Re: not-so-ancient flags |
Date: |
Fri, 25 Jul 2008 08:58:48 +0200 (CEST) |
> Attached is a patch to implement straight flags (in modern style,
> i.e. slanted only ~20 degrees). I think the angles (different angles
> for up/down stems!) and the lengths are okay, although they might
> still be fine-tuned a bit more.
Below is my patch of feta-banier.mf.
> However, I didn't find the exact cause of my second problem, where
> the flags do not start at the very end of the stem, but are shifted
> a little inwards... To see this problem, look at the attached sample
> file: In the second line (the down stems) the flags do not line up
> exactly with the end of the stem :(
The reason is simple: Note stems are drawn with rounded edges; normal
up-flags are designed to attach directly below the rounded edge.
Obviously, this doesn't work for straight up-flags. My solution
(which is tested only for optical appearance but not within a lilypond
build) is to set the height of the straight flag to zero and retain
the small `stem' of the flag, which serves two purposes:
. Overwrite the upper right rounded stem with a straight edge.
. Assure that there isn't a single empty vertical pixel line between
the attached flag and the stem (caused by rounding, for example).
The same applies (mirrored) to down-flags.
Everything else looks fine (I've removed the height of the grace
slash, but this is just a cosmetic change).
Werner
PS: For rapid lilypond font development, simply copy the `mf'
directory to a separate place. Then for example, to test feta20,
say
mf '\mode:=proof; input feta20'
gftodvi feta20.2602gf && mv feta20.dvi feta20.proof.dvi
to get proof sheets,
FONTFORGE=foo mf2pt1 --rounding=0.0001 feta20.mf
to get raw Type 1 fonts, and
mf2pt1 --rounding=0.0001 feta20.mf
to get the final Type 1 font versions.
--- feta-banier.mf.old 2007-10-18 17:08:23.000000000 +0200
+++ feta-banier.mf 2008-07-25 08:55:10.000000000 +0200
@@ -468,4 +468,189 @@
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_upflag_angle = -18;
+straight_downflag_angle = 22;
+straight_upflag_length# = .95 black_notehead_width# + stemthickness# / 2;
+straight_downflag_length# = 1.0 black_notehead_width# + stemthickness# / 2;
+straight_flag_thickness# = 0.55 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, angle) =
+begingroup
+ save flagspace, depth, width;
+ flagspace# = 0.9 staff_space#;
+ define_pixels (flagspace);
+
+ (width#, depth#) = lenhash * dir (-angle)
+ + (blot_diameter# / 2, straight_flag_thickness#)
+ + (0, flagspace# * (flag_count - 1));
+
+ set_char_box (0, width#, depth#, 0);
+
+ for n = 1 upto flag_count:
+ draw_straight_flag ((0, -flagspace * (n - 1)
+ - straight_flag_thickness / 2),
+ len,
+ 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#,
+ straight_upflag_angle);
+fet_endchar;
+
+
+fet_beginchar ("straight 16th Flag (up)", "straightu4");
+ create_straight_flag_char (2, straight_upflag_length,
+ straight_upflag_length#,
+ straight_upflag_angle);
+fet_endchar;
+
+
+fet_beginchar ("straight 32nd Flag (up)", "straightu5");
+ create_straight_flag_char (3, straight_upflag_length,
+ straight_upflag_length#,
+ straight_upflag_angle);
+fet_endchar;
+
+
+fet_beginchar ("straight 64th Flag (up)", "straightu6");
+ create_straight_flag_char (4, straight_upflag_length,
+ straight_upflag_length#,
+ straight_upflag_angle);
+fet_endchar;
+
+
+fet_beginchar ("straight 8th (down)", "straightd3");
+ create_straight_flag_char (1, straight_downflag_length,
+ straight_downflag_length#,
+ -straight_downflag_angle);
+ y_mirror_char;
+fet_endchar;
+
+
+fet_beginchar ("straight 16th (down)", "straightd4");
+ create_straight_flag_char (2, straight_downflag_length,
+ straight_downflag_length#,
+ -straight_downflag_angle);
+ y_mirror_char;
+fet_endchar;
+
+
+fet_beginchar ("straight 32nd (down)", "straightd5");
+ create_straight_flag_char (3, straight_downflag_length,
+ straight_downflag_length#,
+ -straight_downflag_angle);
+ y_mirror_char;
+fet_endchar;
+
+
+fet_beginchar ("straight 64th (down)", "straightd6");
+ create_straight_flag_char (4, straight_downflag_length,
+ straight_downflag_length#,
+ -straight_downflag_angle);
+ y_mirror_char;
+fet_endchar;
+
+
+%%%%%%%%
+%
+% Single Stroke for Short Appogiatura
+%
+
+def create_straight_grace_dash =
+begingroup
+ save width_ratio, pre_depth_ratio, width, depth, tmpd;
+
+ pre_depth_ratio = .4;
+ width_ratio = 0.85;
+
+ (width#, tmpd#) =
+ straight_downflag_length# * dir (straight_downflag_angle)
+ + (blot_diameter# / 2, straight_flag_thickness#);
+
+ depth# = 2 staff_space#;
+
+ define_pixels (width, depth);
+
+ set_char_box (width# * pre_depth_ratio + blot_diameter# / 2,
+ width# * width_ratio + blot_diameter# / 2,
+ depth# + blot_diameter# / 2, 0)
+
+ pickup pencircle scaled 1.5 stemthickness;
+
+ z1 = (-b, -d);
+ z2 = (w, h);
+
+ penpos1 (1.5 stemthickness, angle (z2 - z1) - 90);
+ penpos2 (1.5 stemthickness, angle (z2 - z1) - 90);
+
+ fill z1l
+ -- z2l
+ .. top z2
+ .. rt z2
+ .. z2r
+ -- z1r
+ .. bot z1
+ .. lft z1
+ .. cycle;
+endgroup
+enddef;
+
+
+fet_beginchar ("straight grace dash (up)", "straightugrace");
+ create_straight_grace_dash;
+ penlabels (1, 2);
+fet_endchar;
+
+
+fet_beginchar ("straight grace dash (down)", "straightdgrace");
+ create_straight_grace_dash;
+ y_mirror_char;
+fet_endchar;
+
fet_endgroup ("flags");