On 1/22/11 5:38 PM, "Janek Warchoł" <lemniskata.bernoull...@gmail.com>
wrote:
> W dniu 22 stycznia 2011 19:06 użytkownik Carl Sorensen
> <c_soren...@byu.edu> napisał:
>> On 1/22/11 10:59 AM, "Janek Warchoł" <lemniskata.bernoull...@gmail.com>
>> wrote:
>>>>> Now i'm almost done. However i still don't know how to attach
>>>>> different versions of flags to the stems.
>>
>> Look in lily/stem.cc. Method Stem::calc_flag.
>> lines 643-662 are about where it's currently done.
>
> I see! That's exactly what i want.
> Now i ran into another problem. I wanted to insert this
>
> if (flag_style == "") // i'm preparing additional flags only for
> ordinary font style
> {
> if (length < 6.83)
> {
> if (length > 6.5) font_char += "1";
> // flags.u31 would be a 8th flag that is only a
> bit shorter than regular 8th flag (flags.u3)
> else if (length > 6.16) font_char += "2";
> // flags.u32 would be a 8th flag that is a bit
> shorter than flags.u31, and so on
> else if (length > 5.83) font_char += "3";
> else if (length > 5.5) font_char += "4";
> else if (length > 5.16) font_char += "5";
> else font_char += "6";
> }
> }
>
> into line 639 of stem.cc (just before Font_metric *fm =
> Font_interface::get_default_font (me);)
> but unfortunately length variable is local to Stem::calc_length. I've
> tried defining it in the top-level, but failed.
Well, you could call calc_length to get the stem length, since you have the
stem grob in the form of me, i.e.
Real length = robust_scm2double (me->calc_length (smob));
If you want to, you could try adding a saved value for the length so you
don't have to make this call twice.
That would involve modifying lily/include/stem.hh so that you had a private
variable Real length_, and then at the end of Stem::calc_length you would do
an assignment length_ = length; (just before return scm_from_double
(length);)
I would probably take the latter approach, since we have lots of stems in
the music and I think it would be significantly faster, but only make a
minor difference in storage space.
HTH,
Carl
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel