Skip to content

Commit

Permalink
Merge pull request #1232 from henryso/fix-1215
Browse files Browse the repository at this point in the history
Extending ledger lines through stems.
  • Loading branch information
eroux authored Sep 26, 2016
2 parents 5c7f5e0 + 50d8810 commit 73b0ba9
Show file tree
Hide file tree
Showing 15 changed files with 384 additions and 133 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,4 @@ gregorio-*
ctan
*.pyg
uninstall-gtex.sh
.agignore
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ As of v3.0.0 this project adheres to [Semantic Versioning](http://semver.org/).

## Changed
- Notes are now left-aligned as if all clefs had the same width as the largest clef in the score. You can get previous behavior back with `\grebolshiftcleftype{current}`, or temporary force alignment until the end of a score with `\grelocalbolshiftcleftype`. See Documentation of these functions and [#1189](https://github.com/gregorio-project/gregorio/issues/1189).
- A clef change immediately before a line break `(z)` will now typeset the new clef at the beginning of the next line. An explicit custos `(z0)` immediately before such a clef change (or separated by only a bar) will be suppressed. See [1190](https://github.com/gregorio-project/gregorio/issues/1190).
- A clef change immediately before a line break `(z)` will now typeset the new clef at the beginning of the next line. An explicit custos `(z0)` immediately before such a clef change (or separated by only a bar) will be suppressed. See [#1190](https://github.com/gregorio-project/gregorio/issues/1190).
- Ledger lines are now extended through notes on either side of a ledger line that crosses a stem, as long as the notes are within the same "element." If the algorithm doesn't produce the result you want, you can use `[oll:0]` to suppress an over-the-staff ledger line on a note, `[ull:0]` to suppress an under-the-staff ledger line on a note, `[oll:1]` to force an over-the-line ledger line on a note, or [ull:1] to force an under-the-staff ledger line on a note. Please note that other forms of `[oll:...]` and `[ull:...]` can interfere with these new settings. See [UPGRADE.md](UPGRADE.md) and [#1215](https://github.com/gregorio-project/gregorio/issues/1215) for details.

### Added
- More cavum shapes are now available. To use them, simply add `r` in gabc to any note in a glyph. See [#844](https://github.com/gregorio-project/gregorio/issues/844).
Expand Down
17 changes: 16 additions & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,29 @@

This file contains instructions to upgrade to a new release of Gregorio.

## Next version
## 5.0

### Gregorio and Grana Padano fonts

The gregorio and granapadano fonts, as well as their "-op" Dominican variants, will now be available as separate downloads. If you were using these fonts, either download and install them or switch to greciliae, which continues to be distributed along with Gregorio by default.

*** NOTE: put the logistics of these downloads here once they've been determined ***

### Ledger lines

As of version 5.0, ledger lines are extended through notes on either side of a ledger line that crosses a stem, as long as the notes are within the same element.

The algorithm for this is simple so it can be predictable, and it cannot take into account spacing adjustments made it TeX. This means it may not produce the exactly desired results. In order to get the results you want, you can override the automatic behavior in gabc:

- `[oll:1]` will force an over-the-staff ledger line on a note.
- `[oll:0]` will suppress an over-the-staff ledger line on a note.
- `[ull:1]` will force an under-the-staff ledger line on a note.
- `[ull:0]` will suppress an under-the-staff ledger line on a note.

The other `oll` and `ull` forms take precendence over and will interfere with the above settings, so if you are using them, you may need to adjust them to get the output you want.

Note: You may need to use a construct such as `/!` to keep notes that are separated in the same element. For example, `abcV` is two elements (`ab` and `cV`), so the ledger line on `b` is not extended to `cV`. In contrast, `ab/!cV` is one element, so the ledger line on `b` is extended to `cV`.

## 4.2

### Executable file name
Expand Down
10 changes: 7 additions & 3 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ gregorio___FILENAME_VERSION__SOURCES = \
@MK@else
@MK@ ifneq ($(wildcard ../.hg/git),)
@MK@ _gitnode_ = $(shell hg log --template='{gitnode}' -r .)
@MK@ _tag_ = $(shell git --git-dir=../.hg/git describe --exact-match $(_gitnode_) 2>/dev/null)
@MK@ ifeq ($(_tag_),)
@MK@ DEFS += -DBRANCH_VERSION='"$(shell cat ../.hg/bookmarks.current)-$(shell git --git-dir=../.hg/git rev-parse --short '$(_gitnode_)')-$(shell git --git-dir=../.hg/git rev-list '$(_gitnode_)' --count)"'
@MK@ ifeq ($(_gitnode_),)
@MK@ DEFS += -DBRANCH_VERSION='"$(shell hg log --template='{activebookmark}-hg:{manifest}' -r .)"'
@MK@ else
@MK@ _tag_ = $(shell git --git-dir=../.hg/git describe --exact-match '$(_gitnode_)' 2>/dev/null)
@MK@ ifeq ($(_tag_),)
@MK@ DEFS += -DBRANCH_VERSION='"$(shell hg log --template='{activebookmark}' -r .)-$(shell git --git-dir=../.hg/git rev-parse --short '$(_gitnode_)')-$(shell git --git-dir=../.hg/git rev-list '$(_gitnode_)' --count)"'
@MK@ endif
@MK@ endif
@MK@ endif
@MK@endif
Expand Down
32 changes: 28 additions & 4 deletions src/dump/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,37 @@ void dump_write_score(FILE *f, gregorio_score *score)
dump_hepisema_adjustment(f, note, SO_OVER, "above");
dump_hepisema_adjustment(f, note, SO_UNDER,
"below");
if (note->explicit_high_ledger_line) {
switch (note->high_ledger_specificity) {
case LEDGER_SUPPOSED:
break;
case LEDGER_EXPLICIT:
fprintf(f, " explicit high line %s\n",
dump_bool(note->supposed_high_ledger_line));
dump_bool(note->high_ledger_line));
break;
case LEDGER_DRAWN:
fprintf(f, " drawn high line %s\n",
dump_bool(note->high_ledger_line));
break;
case LEDGER_EXPLICITLY_DRAWN:
fprintf(f, " forced drawn high line %s\n",
dump_bool(note->high_ledger_line));
break;
}
if (note->explicit_low_ledger_line) {
switch (note->low_ledger_specificity) {
case LEDGER_SUPPOSED:
break;
case LEDGER_EXPLICIT:
fprintf(f, " explicit low line %s\n",
dump_bool(note->supposed_low_ledger_line));
dump_bool(note->low_ledger_line));
break;
case LEDGER_DRAWN:
fprintf(f, " drawn low line %s\n",
dump_bool(note->low_ledger_line));
break;
case LEDGER_EXPLICITLY_DRAWN:
fprintf(f, " forced drawn low line %s\n",
dump_bool(note->low_ledger_line));
break;
}
}
}
Expand Down
54 changes: 37 additions & 17 deletions src/gabc/gabc-notes-determination.l
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,18 @@ static char *before_ledger_length = NULL;
static unsigned short ledger_var[2] = { 0, 0 };
static unsigned char staff_lines;
static signed char highest_pitch;
static signed char high_ledger_line_pitch;
static bool legacy_oriscus_orientation;
static unsigned short he_adjustment_index[2] = { 0, 0 };
static signed char bracket_low_pitch, bracket_high_pitch;
static unsigned short left_bracket_texverb = 0;

#define LEDGER(WHICH, SPECIFICITY, VALUE) \
if (LEDGER_##SPECIFICITY > current_note->WHICH##_ledger_specificity) { \
current_note->WHICH##_ledger_line = VALUE; \
current_note->WHICH##_ledger_specificity = LEDGER_##SPECIFICITY; \
}

typedef struct slur_info {
unsigned short var;
char shift;
Expand Down Expand Up @@ -130,21 +137,25 @@ static gregorio_shape punctum_inclinatum(const char orientation)
static __inline void lex_add_note(int i, gregorio_shape shape, char signs,
char liquescentia)
{
signed char height = pitch_letter_to_height(tolower(
(unsigned char)gabc_notes_determination_text[i]));

nbof_isolated_episema = 0;
gregorio_add_note(&current_note, pitch_letter_to_height(
tolower((unsigned char)gabc_notes_determination_text[i])),
shape, signs, liquescentia, NULL, &notes_lloc);
gregorio_add_note(&current_note, height, shape, signs, liquescentia, NULL,
&notes_lloc);
current_note->he_adjustment_index[SO_OVER] = he_adjustment_index[SO_OVER];
current_note->he_adjustment_index[SO_UNDER] = he_adjustment_index[SO_UNDER];

if (ledger_var[SO_OVER]) {
current_note->supposed_high_ledger_line = true;
current_note->explicit_high_ledger_line = true;
if (height >= high_ledger_line_pitch) {
LEDGER(high, DRAWN, true);
} else if (ledger_var[SO_OVER]) {
LEDGER(high, EXPLICIT, true);
}

if (ledger_var[SO_UNDER]) {
current_note->supposed_low_ledger_line = true;
current_note->explicit_low_ledger_line = true;
if (height <= LOW_LEDGER_LINE_PITCH) {
LEDGER(low, DRAWN, true);
} else if (ledger_var[SO_UNDER]) {
LEDGER(low, EXPLICIT, true);
}
}

Expand Down Expand Up @@ -1035,6 +1046,12 @@ void gabc_det_notes_finish(void)
gregorio_add_space_as_note(&current_note, SP_AD_HOC_SPACE_NB,
gregorio_strdup(gabc_notes_determination_text), &notes_lloc);
}
<INITIAL>\[oll:1\] {
LEDGER(high, EXPLICITLY_DRAWN, true);
}
<INITIAL>\[oll:0\] {
LEDGER(high, EXPLICITLY_DRAWN, false);
}
<INITIAL>\[oll:\}\] {
end_variable_ledger(SO_OVER);
}
Expand All @@ -1053,6 +1070,12 @@ void gabc_det_notes_finish(void)
add_variable_ledger(SO_OVER, gabc_notes_determination_text);
BEGIN(endledger);
}
<INITIAL>\[ull:1\] {
LEDGER(low, EXPLICITLY_DRAWN, true);
}
<INITIAL>\[ull:0\] {
LEDGER(low, EXPLICITLY_DRAWN, false);
}
<INITIAL>\[ull:\}\] {
end_variable_ledger(SO_UNDER);
}
Expand Down Expand Up @@ -1383,20 +1406,16 @@ s {
legacy_oriscus_orientation);
}
\[hl:1\] {
current_note->supposed_high_ledger_line = true;
current_note->explicit_high_ledger_line = true;
LEDGER(high, EXPLICIT, true);
}
\[hl:0\] {
current_note->supposed_high_ledger_line = false;
current_note->explicit_high_ledger_line = true;
LEDGER(high, EXPLICIT, false);
}
\[ll:1\] {
current_note->supposed_low_ledger_line = true;
current_note->explicit_low_ledger_line = true;
LEDGER(low, EXPLICIT, true);
}
\[ll:0\] {
current_note->supposed_low_ledger_line = false;
current_note->explicit_low_ledger_line = true;
LEDGER(low, EXPLICIT, false);
}
.|\n {
gregorio_messagef("det_notes_from_string", VERBOSITY_ERROR, 0,
Expand All @@ -1423,6 +1442,7 @@ gregorio_note *gabc_det_notes_from_string(char *str, char *newmacros[10],

staff_lines = score->staff_lines;
highest_pitch = score->highest_pitch;
high_ledger_line_pitch = score->high_ledger_line_pitch;
legacy_oriscus_orientation = score->legacy_oriscus_orientation;

/* a small optimization could uccur here: we could do it only once at the
Expand Down
Loading

0 comments on commit 73b0ba9

Please sign in to comment.