lilypond-devel
[Top][All Lists]
Advanced

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

[PATCH] Re: Re: not-so-ancient flags


From: Reinhold Kainhofer
Subject: [PATCH] Re: Re: not-so-ancient flags
Date: Thu, 21 Aug 2008 23:56:29 +0200
User-agent: KMail/1.9.9

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Dienstag, 5. August 2008 schrieb Han-Wen Nienhuys:
> On Sat, Jul 26, 2008 at 3:53 PM, Werner LEMBERG <address@hidden> wrote:
> >> > Below is my patch of feta-banier.mf.
> >>
> >> While I don't strictly oppose to adding new glyphs, I am wondering
> >> why you are creating them.  It would be more flexible to have a new
> >> function to do this, since you can vary thickness and slant
> >> dynamically.
> >
> > I don't oppose.  However, I can program MF, but I have problems to do
> > such things in Scheme.
>
> Lookup::round_filled_polygon() will setup the required scheme code if
> called from C++.
>
> Probably, we'd need to transform Stem::flag() into a Scheme callback
> to be able to override it.

I've now done that part with the attached patch. The flag-style can be set to 
either (), a symbol like 'no-flag, 'mensural or samething else (same behavior 
as now: looks up a glyph from the feta font), or a scheme function of the 
signature (my-flag stem-grob) that needs to return the full stencil for the 
flag, including a possible grace slash.

I've also created a regression test file, which is basically the same as I 
sent this afternoon. I just added one more custom style: inverted-flag, where 
the flags all point to the left. For this I simply create the default flag 
for the opposite stem direction and rotate it by 180 degrees. 
If you don't want to rebuild lilypond, here's the file and the output as png:
http://www.fam.tuwien.ac.at/~reinhold/temp/flags-in-scheme.png
http://www.fam.tuwien.ac.at/~reinhold/temp/flags-in-scheme.ly

All flags are now done in scheme, so you have the full functionality available 
for your own flag styles. You can draw your complete own flags 
(think "hand-written style"....) or modify existing styles (like my 
inverted-flag, which can be useful for tutorials on how not to write 
notes ;-) ).

I have only three small points/questions:

1) I have the impression that ly:stencil-rotate (which is not used anywhere 
else in lilypond) does not correctly rotate the stencil extents. In 
particular, look at the inverted-normal-flag style in the example above and 
you'll notice the large white space between the staff and the mark. I also 
printed out the stencil extents to the console and they seemed pretty strange 
to me...

2) I've moved the whole functionality to create flags to scheme. The advantage 
is that you can call the built-in flag styles from your own styles. The other 
possibility would be to handle 'mensural and 'no-flag with the current C++ 
code and only use scheme if the flag-style property is set to a function 
(i.e. if get_property already returns a stencil, use that, otherwise continue 
with the C++ code in current master). The drawback of that approach is that 
there would either be some code duplication between C++ and scheme, or that 
you would not be able to modify existing flag styles easily. The output will 
be exactly the same in both cases.

3) In define-grob-properties.scm, the type of flag-style is set to symbol?, 
which is not correct for functions. However, procedure? is also not correct 
if we want to keep allowing symbols like 'no-flag or 'mensural. I couldn't 
find the correct predicate to allow both symbols and procedures.
Lilypond runs just fine and produces correct output, but when running the 
regression tests, the file prints out several warnings about a wrong property 
type...

What do you think about these? And what do you think about the patch?

The straight flags style is yet to be implemented (raw skeleton is already in 
flag-styles.scm, but commented out for now).

Cheers,
Reinhold

- -- 
- ------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: address@hidden, http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
 * K Desktop Environment, http://www.kde.org, KOrganizer maintainer
 * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIreSTTqjEwhXvPN0RAku0AJ9utwxLiO4PKc+6zxU2BhQWWzrZFgCdH26R
epeAxLpEX1mIVcRa6mz2P2E=
=x817
-----END PGP SIGNATURE-----

Attachment: 0001-Feature-Implement-flags-being-generated-in-Scheme.patch
Description: Text Data


reply via email to

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