[Top][All Lists]

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

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

From: Han-Wen Nienhuys
Subject: Fwd: [PATCH] Re: Re: not-so-ancient flags
Date: Thu, 21 Aug 2008 22:52:04 -0300

[+ mailing list.]

On Thu, Aug 21, 2008 at 6:56 PM, Reinhold Kainhofer
<address@hidden> wrote:
>> 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.
+  LY_ASSERT_TYPE (scm_is_number, spos, 1);
+  Grob *g = unsmob_grob (sg);
+  Grob *st = Staff_symbol_referencer::get_staff_symbol (g);

what happens if st is null?

@@ -580,68 +580,41 @@ Stem::flag (Grob *me)

  if (!is_normal_stem (me))
    return Stencil ();

Stem::flag after this rewrite should just look like

Stem::flag(Grob *g)
 if (Stencil *flag = unsmob_stencil (get_property("flag"))) {
   return *flag;
 return Stencil();

then there should be Stem::calc_flag which contains logic for deciding
which font symbol to get, and constructing the stencil.

Overrides are done with

 \override Stem #'flag = #my-stencil-creation-function

(default for this prop is ly:stem::calc-flag )

Do we have a 'style in the stem grob?  If no, please use the existing
'style property rather than flag-style.

+;; (define-public (straight-flag flag-thickness flag-spacing
+;;                        upflag-angle upflag-length
+;;                        downflag-angle downflag-length)
+;;   (lambda (stem-grob)

you can write this as

 (define ((f inner-arg inner-arg2) outer-arg1 outer-arg2)

+           "flag-styles.scm"

Looks like overkill - I would suggest a section in output-lib.scm

> 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...

could be.

> 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.

I think the existing code should remain C++ as it is executed a lot,
so there is a speed advantage.

> 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?

see above

Han-Wen Nienhuys - address@hidden -

Han-Wen Nienhuys - address@hidden -

reply via email to

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