Re: Does the center of the staff need to be zero?

2007-03-19 Thread Kevin Dalley
Juergen Reuter <[EMAIL PROTECTED]> writes:

> You are right, but this is not the issue I was trying to point out.
> The problem is neither of musical nor notational kind, but of
> typographical kind.  Maybe I should have chosen the bass clef as a
> more evident example:
>
> No, unfortunately, the clefPosition property does not help here at
> all, since it shifts the clef by an integer multiple of staffline
> space, while, in the case of an even number of stafflines, it would
> need to be shifted by an odd integer multiple of half a staffline
> space.
>
> In other words, a clef is typographical designed to be always aligned
> with a staffline, but not to be aligned with the space between two
> stafflines. The only exception that I know of is the drum clef, which
> is typically always centered, regardless of the number of stafflines.
>
> Greetings,
> Juergen

I'm not quite sure that I understand the issue, but I'm coming
closing.  Could you try something like the example included below.
There may be a cleaner way of coming up with this solution, but I
moved the F clef to 1 staff line below the top staff line, and put
middle C on the first ledger line about the staff.  As I said, it
looks a bit ugly, and there is probably a better way of writing it,
but it does seem to work.

If you move the F note to a space, shouldn't the F clef follow it?  It
looks odd, but the standards for staff lines with different numbers of
lines is not clear.

\version "2.10"

notes = {
  \time 4/4
  c1
  d
  e1 f1 g a1
  b c'
}

\new Staff \with {
  middleCPosition = #6
  clefPosition = #2
  clefGlyph = #"clefs.F"
}
{
%odd line count
  \override Staff.StaffSymbol #'line-count = 5
  \notes
}
\new Staff \with {
  middleCPosition = #5
  clefPosition = #1
  clefGlyph = #"clefs.F"
}
{
%even line count
  \override Staff.StaffSymbol #'line-count = 4
  \notes
}





___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Does the center of the staff need to be zero?

2007-03-19 Thread Juergen Reuter

On Mon, 19 Mar 2007, Kevin Dalley wrote:


...
The G clef is correct, if you change your interpretation a bit.  It
confused me for quite a while also.  The documentation needs to be
improved, but I haven't figured out exactly how.

The G-clef is centered around the G note.  The center of the staff at
B above middle C, however many lines there are.

So a 4-line G-clef leaves the G-clef centered around a space,
rather than around a bar.

If you typeset a G note, it will be in the same position on the G
clef.



You are right, but this is not the issue I was trying to point out.  The 
problem is neither of musical nor notational kind, but of typographical 
kind.  Maybe I should have chosen the bass clef as a more evident example:


If you reduce the number of stafflines to 4, the bass clef will always be 
set in such a way, that the two dots of the bass clef glyph collide with 
the stafflines.  The problem is, that the typograhical design of the bass 
clef assumes that the f pitch (the f which the bass clef references) is 
always typeset on a staffline, but not in the space between two 
stafflines, such that the bass clef's two dots are always printed between 
stafflines.  Similar typographical aspects hold for other clefs.


If the y origin of a staff would always be on, say, the lowest staffline 
rather than on the center of the staff, then the bass clef would be 
aligned correctly even on a staff with 4 stafflines.



\new Staff \with {
 middleCPosition = #-2
 clefGlyph = #"clefs.G"
 clefPosition = #2
}


No, unfortunately, the clefPosition property does not help here at all, 
since it shifts the clef by an integer multiple of staffline space, while, 
in the case of an even number of stafflines, it would need to be shifted 
by an odd integer multiple of half a staffline space.


In other words, a clef is typographical designed to be always aligned with 
a staffline, but not to be aligned with the space between two stafflines. 
The only exception that I know of is the drum clef, which is typically 
always centered, regardless of the number of stafflines.


Greetings,
Juergen


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Does the center of the staff need to be zero?

2007-03-19 Thread Kevin Dalley
I misread your G clef comment the first time I read it.

The G clef is correct, if you change your interpretation a bit.  It
confused me for quite a while also.  The documentation needs to be
improved, but I haven't figured out exactly how.

The G-clef is centered around the G note.  The center of the staff at
B above middle C, however many lines there are.

So a 4-line G-clef leaves the G-clef centered around a space,
rather than around a bar.

If you typeset a G note, it will be in the same position on the G
clef.

There are variables to tweak if you want to change the default
values.  middleCPosition and clefPosition.  Something like this will
create a staff

\new Staff \with {
  middleCPosition = #-2
  clefGlyph = #"clefs.G"
  clefPosition = #2
}
{
  \time 4/4
  \notes
}


Juergen Reuter <[EMAIL PROTECTED]> writes:

> Hi, all!
>
> Just a few comments:
>
> Actually, binding the origin to a staff line (e.g. the most lower
> staff line) rather than to the center of the origin (as we currently
> do) would solve the current problem that you have to design clefs
> explicitly either for staves with an even number of staff lines or for
> staves with an odd number of staff lines.  In this sense, I would
> really welcome such a change (even though some of the ancient clefs
> would then have to be shifted by 1/2 staff line in the metafont code)!
>
> If you do not understand what I mean, then just try to apply the
> ordinary G clef to a score with 4 staff lines or 6 staff lines instead
> of the ordinary 5 staff lines.  You will see that the clef will always
> be off 1/2 staff line (unless you do some y-offset trickery with
> backend properties).
>
> However, the drum clef will suffer from such a change, since the drum
> clef is usually always centered on the staff, regardles of the number
> of staff lines.  I think, the drum clef is the only clef for which
> this problem will arise.  Also, I am not sure if there are some
> serious implications of such a change for the pitch squash engraver.


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Does the center of the staff need to be zero?

2007-03-18 Thread Kevin Dalley
Here's my patch for the bar line.  The ledgers definitely need some
work for staffs which are not centered at zero.

>From ca021c722d6f74690d189c99eff0ccefe420a3b3 Mon Sep 17 00:00:00 2001
From: Kevin Dalley <[EMAIL PROTECTED]>
Date: Sun, 18 Mar 2007 09:30:57 -0700
Subject: [PATCH] Draw bar lines correctly when staff is not centered at zero.

---
 input/regression/non-centered-bar-lines.ly |8 
 lily/bar-line.cc   |   20 +---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 input/regression/non-centered-bar-lines.ly

diff --git a/input/regression/non-centered-bar-lines.ly 
b/input/regression/non-centered-bar-lines.ly
new file mode 100644
index 000..5f8814d
--- /dev/null
+++ b/input/regression/non-centered-bar-lines.ly
@@ -0,0 +1,8 @@
+\version "2.10"
+\new Staff \with {
+}
+{
+  \override Staff.StaffSymbol #'line-positions = #'(1 3 5 7 9)
+  \time 4/4
+  c''1 | c'' \bar "" | c'' \bar "|."
+}
diff --git a/lily/bar-line.cc b/lily/bar-line.cc
index 0a1c0d9..996eaac 100644
--- a/lily/bar-line.cc
+++ b/lily/bar-line.cc
@@ -69,13 +69,25 @@ Bar_line::compound_barline (Grob *me, string str, Real h,
   colon.translate_axis (-dist / 2, Y_AXIS);
 
   Stencil m;
+  Grob *staff = Staff_symbol_referencer::get_staff_symbol (me);
+  Real center = 0;
+  if (staff){
+Interval staff_extent = staff->extent (staff, Y_AXIS);
+center = staff_extent.center();
+  }
+  
   if (str == "||:")
 str = "|:";
 
-  if (str == "")
-return Lookup::blank (Box (Interval (0, 0), Interval (-h / 2, h / 2)));
-  else if (str == "|")
+  if (str == ""){
+Stencil empty = Lookup::blank (Box (Interval (0, 0), Interval (-h / 2, h / 
2)));
+empty.translate_axis(center, Y_AXIS);
+return empty;
+  }
+  else if (str == "|") {
+thin.translate_axis(center, Y_AXIS);
 return thin;
+  }
   else if (str == "|." || (h == 0 && str == ":|"))
 {
   m.add_at_edge (X_AXIS, LEFT, thick, 0, 0);
@@ -140,6 +152,8 @@ Bar_line::compound_barline (Grob *me, string str, Real h,
 {
   m = dot;
 }
+  
+  m.translate_axis(center, Y_AXIS);
   return m;
 }
 
-- 
1.5.0.3



___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Does the center of the staff need to be zero?

2007-03-18 Thread Kevin Dalley
Thanks.  I'll post my patch shortly.

Thanks for the comments on my previous patch.  I appreciate the
difficulty to merging in patches.  If you have suggestions for a
different place to put the changes, I'm quite willing to give it a
try. 

"Han-Wen Nienhuys" <[EMAIL PROTECTED]> writes:

> As far as I can see there is no strict need, fot it to be zero, so if
> you have a sensible patch to change it, go ahead and post it.
>
>
> BTW I know that you have an interesting patch for Lily to make line
> configurations more flexible. I'll try to review it this week.
>
> regards,
>
> Han-Wen
>
>
> 2007/3/15, Kevin Dalley <[EMAIL PROTECTED]>:
>> In LilyPond, using line-positions, the center is required to be at 0,
>> otherwise there are problems with the created score.  There are a
>> couple of possibilities.
>>
>> One is to make the documentations more clear that staffs must be
>> centered at 0.
>>
>> The other possibility is to modify LilyPond to take staffs which are
>> not centered at 0.
>>
>> I notice 2 areas which need to be modified.  I have a small patch for
>> bar-line.cc, which otherwise draws the bar line of the correct size,
>> but centered around 0 rather than centered around the real center.
>>
>> Ledger lines need some work as well, though there are problems even if
>> the staff is centered, particularly if the top and bottom lines are on
>> even positions.
>>
>> Should I post my patch for bar lines for staffs which are not centered
>> at 0?
>
>
> -- 
> Han-Wen Nienhuys - [EMAIL PROTECTED] - http://www.xs4all.nl/~hanwen


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Does the center of the staff need to be zero?

2007-03-18 Thread Kevin Dalley
Thanks for the comments.

I have run across the problem with the ledger lines, and tried to
understand it, but failed.

What I noticed is that there is sometimes a problem when either the
uppermost or lowermost line is odd, where I have good ledger lines
above, but bad ones below.  I wondered whether the drum could be done
in a manner similar to what I used for the chromatic staff.  Perhaps
I'll give it another look.  I would like to get fix this problem.

Here are my sample file.

\version "2.10"
notes = {
  \time 4/4
  c'1 d' e' f' g' a'1 b' c'' | e''  | g'' | a'' | \bar "|."
}

\new Staff \with {
}
{
%bad ledger lines
  #(define mylines '(-1 0 1))
  \override Staff.StaffSymbol #'line-positions = #mylines

  \override Staff.StaffSymbol #'line-count = #(length mylines)
  \notes
}

\new Staff \with {
}
{
%good ledger lines
  #(define mylines '(-2 0 2))
  \override Staff.StaffSymbol #'line-positions = #mylines

  \override Staff.StaffSymbol #'line-count = #(length mylines)
  \notes
}
\new Staff \with {
}
{
%lower bad, upper good
  #(define mylines '(-1 0 2))
  \override Staff.StaffSymbol #'line-positions = #mylines

  \override Staff.StaffSymbol #'line-count = #(length mylines)
  \notes
}


Juergen Reuter <[EMAIL PROTECTED]> writes:

> Hi, all!
>
> Just a few comments:
>
> Actually, binding the origin to a staff line (e.g. the most lower
> staff line) rather than to the center of the origin (as we currently
> do) would solve the current problem that you have to design clefs
> explicitly either for staves with an even number of staff lines or for
> staves with an odd number of staff lines.  In this sense, I would
> really welcome such a change (even though some of the ancient clefs
> would then have to be shifted by 1/2 staff line in the metafont code)!
>
> If you do not understand what I mean, then just try to apply the
> ordinary G clef to a score with 4 staff lines or 6 staff lines instead
> of the ordinary 5 staff lines.  You will see that the clef will always
> be off 1/2 staff line (unless you do some y-offset trickery with
> backend properties).
>
> However, the drum clef will suffer from such a change, since the drum
> clef is usually always centered on the staff, regardles of the number
> of staff lines.  I think, the drum clef is the only clef for which
> this problem will arise.  Also, I am not sure if there are some
> serious implications of such a change for the pitch squash engraver.
>
> Greetings,
> Juergen
>
> On Sat, 17 Mar 2007, Han-Wen Nienhuys wrote:
>
>> As far as I can see there is no strict need, fot it to be zero, so if
>> you have a sensible patch to change it, go ahead and post it.
>>
>>
>> BTW I know that you have an interesting patch for Lily to make line
>> configurations more flexible. I'll try to review it this week.
>>
>> regards,
>>
>> Han-Wen
>>
>>
>> 2007/3/15, Kevin Dalley <[EMAIL PROTECTED]>:
>>> In LilyPond, using line-positions, the center is required to be at 0,
>>> otherwise there are problems with the created score.  There are a
>>> couple of possibilities.
>>>
>>> One is to make the documentations more clear that staffs must be
>>> centered at 0.
>>>
>>> The other possibility is to modify LilyPond to take staffs which are
>>> not centered at 0.
>>>
>>> I notice 2 areas which need to be modified.  I have a small patch for
>>> bar-line.cc, which otherwise draws the bar line of the correct size,
>>> but centered around 0 rather than centered around the real center.
>>>
>>> Ledger lines need some work as well, though there are problems even if
>>> the staff is centered, particularly if the top and bottom lines are on
>>> even positions.
>>>
>>> Should I post my patch for bar lines for staffs which are not centered
>>> at 0?
>>
>>
>>


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Does the center of the staff need to be zero?

2007-03-17 Thread Juergen Reuter

Hi, all!

Just a few comments:

Actually, binding the origin to a staff line (e.g. the most lower staff 
line) rather than to the center of the origin (as we currently do) would 
solve the current problem that you have to design clefs explicitly either 
for staves with an even number of staff lines or for staves with an odd 
number of staff lines.  In this sense, I would really welcome such a 
change (even though some of the ancient clefs would then have to be 
shifted by 1/2 staff line in the metafont code)!


If you do not understand what I mean, then just try to apply the ordinary 
G clef to a score with 4 staff lines or 6 staff lines instead of the 
ordinary 5 staff lines.  You will see that the clef will always be off 1/2 
staff line (unless you do some y-offset trickery with backend properties).


However, the drum clef will suffer from such a change, since the drum clef 
is usually always centered on the staff, regardles of the number of staff 
lines.  I think, the drum clef is the only clef for which this problem 
will arise.  Also, I am not sure if there are some serious implications 
of such a change for the pitch squash engraver.


Greetings,
Juergen

On Sat, 17 Mar 2007, Han-Wen Nienhuys wrote:


As far as I can see there is no strict need, fot it to be zero, so if
you have a sensible patch to change it, go ahead and post it.


BTW I know that you have an interesting patch for Lily to make line
configurations more flexible. I'll try to review it this week.

regards,

Han-Wen


2007/3/15, Kevin Dalley <[EMAIL PROTECTED]>:

In LilyPond, using line-positions, the center is required to be at 0,
otherwise there are problems with the created score.  There are a
couple of possibilities.

One is to make the documentations more clear that staffs must be
centered at 0.

The other possibility is to modify LilyPond to take staffs which are
not centered at 0.

I notice 2 areas which need to be modified.  I have a small patch for
bar-line.cc, which otherwise draws the bar line of the correct size,
but centered around 0 rather than centered around the real center.

Ledger lines need some work as well, though there are problems even if
the staff is centered, particularly if the top and bottom lines are on
even positions.

Should I post my patch for bar lines for staffs which are not centered
at 0?







___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Does the center of the staff need to be zero?

2007-03-17 Thread Han-Wen Nienhuys

As far as I can see there is no strict need, fot it to be zero, so if
you have a sensible patch to change it, go ahead and post it.


BTW I know that you have an interesting patch for Lily to make line
configurations more flexible. I'll try to review it this week.

regards,

Han-Wen


2007/3/15, Kevin Dalley <[EMAIL PROTECTED]>:

In LilyPond, using line-positions, the center is required to be at 0,
otherwise there are problems with the created score.  There are a
couple of possibilities.

One is to make the documentations more clear that staffs must be
centered at 0.

The other possibility is to modify LilyPond to take staffs which are
not centered at 0.

I notice 2 areas which need to be modified.  I have a small patch for
bar-line.cc, which otherwise draws the bar line of the correct size,
but centered around 0 rather than centered around the real center.

Ledger lines need some work as well, though there are problems even if
the staff is centered, particularly if the top and bottom lines are on
even positions.

Should I post my patch for bar lines for staffs which are not centered
at 0?



--
Han-Wen Nienhuys - [EMAIL PROTECTED] - http://www.xs4all.nl/~hanwen


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Does the center of the staff need to be zero?

2007-03-15 Thread Kevin Dalley
In LilyPond, using line-positions, the center is required to be at 0,
otherwise there are problems with the created score.  There are a
couple of possibilities.

One is to make the documentations more clear that staffs must be
centered at 0.

The other possibility is to modify LilyPond to take staffs which are
not centered at 0.

I notice 2 areas which need to be modified.  I have a small patch for
bar-line.cc, which otherwise draws the bar line of the correct size,
but centered around 0 rather than centered around the real center.

Ledger lines need some work as well, though there are problems even if
the staff is centered, particularly if the top and bottom lines are on
even positions.

Should I post my patch for bar lines for staffs which are not centered
at 0?

Here's a comment from the documentation about zero being the center.

The center (i.e. middle line or space) is position 0.
http://lilypond.org/doc/v2.11/Documentation/user/lilypond-internals/staff_002dsymbol_002dinterface

Here's a example of a bad bar position.

\version "2.10"
\new Staff \with {
}
{
  \override Staff.StaffSymbol #'line-positions = #'(1 3 5 7 9)
  \time 4/4
  c''1 | c'' \bar "" | c'' \bar "|."
}


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel