Skip to content

Commit

Permalink
Merge pull request #1211 from henryso/fix-1205
Browse files Browse the repository at this point in the history
Suppressed \GreLastOfScore if only no-element syllables follow it.
  • Loading branch information
henryso authored Aug 20, 2016
2 parents c53e341 + 6937266 commit ba1fb79
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ As of v3.0.0 this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- When the note after an oriscus is at the same pitch, the oriscus will now point downwards by default (see [#1177](https://github.com/gregorio-project/gregorio/issues/1177)).
- With thanks to Claudio Beccari (@OldClaudio), adding a commentary no longer generates a bad `\hbox` during TeX processing (see [#1202](https://github.com/gregorio-project/gregorio/issues/1202)).
- When the last note in a score is not in the last syllable, it no longer merges into the (no-note) syllable(s) that follow (see [#1205](https://github.com/gregorio-project/gregorio/issues/1205)).

### Changed
- In order to facilitate installation alongside TeX Live, the version number is now appended to the gregorio executable file name. If you are running the executable directly in your custom scripts, you will need to change them to include the version number. If you are not using the TeX-Live-packaged version of Gregorio, you will probably need to use the `--shell-escape` option when compiling your `.tex` files. Note that in TeX Live 2016, which includes Gregorio 4.1.1, the executable filename does not include the version number, though that will change starting with TeX Live 2017. See UPGRADE.md and [#1197](https://github.com/gregorio-project/gregorio/issues/1197) for more information.
Expand Down
27 changes: 23 additions & 4 deletions src/gregoriotex/gregoriotex-write.c
Original file line number Diff line number Diff line change
Expand Up @@ -3601,11 +3601,30 @@ static __inline unsigned int count_note_units(const gregorio_element *element)
}

static __inline void handle_last_of_voice(FILE *const f,
const gregorio_syllable *syllable,
const gregorio_element *const element,
const gregorio_element *const last_of_voice)
{
if (element == last_of_voice) {
fprintf(f, "\\GreLastOfScore");
if (syllable->next_syllable) {
/* check for no-element syllables that follow */
for (syllable = syllable->next_syllable;
syllable && (!syllable->elements || !*(syllable->elements));
syllable = syllable->next_syllable) {
/* just loop */
}
/* if syllable is NULL here, then all syllables that follow
* have no elements */
}
/* emit GreLastOfScore if we are either on the last syllable (and
* thus the loop above is not executed, leaving syllable at the
* current syllable) or if a syllable which follows the current
* syllable has an element of some sort (and thus the loop above
* stopped before running out of syllables); in any case, the check
* is that syllable, at this point, is not NULL */
if (syllable) {
fprintf(f, "\\GreLastOfScore");
}
}
}

Expand Down Expand Up @@ -3906,7 +3925,7 @@ static void write_syllable(FILE *f, gregorio_syllable *syllable,
* We don't print custos before a bar at the end of a line
*/
/* we also print an unbreakable larger space before the custo */
handle_last_of_voice(f, element, *last_of_voice);
handle_last_of_voice(f, syllable, element, *last_of_voice);
next_note_pitch = gregorio_determine_next_pitch(syllable,
element, NULL, &next_note_alteration);
if (!element->u.misc.pitched.force_pitch) {
Expand All @@ -3920,7 +3939,7 @@ static void write_syllable(FILE *f, gregorio_syllable *syllable,
break;

case GRE_BAR:
handle_last_of_voice(f, element, *last_of_voice);
handle_last_of_voice(f, syllable, element, *last_of_voice);
write_bar(f, score, syllable, element, first_of_disc);
break;

Expand All @@ -3942,7 +3961,7 @@ static void write_syllable(FILE *f, gregorio_syllable *syllable,
default:
/* here current_element->type is GRE_ELEMENT */
assert(element->type == GRE_ELEMENT);
handle_last_of_voice(f, element, *last_of_voice);
handle_last_of_voice(f, syllable, element, *last_of_voice);
note_unit_count += write_element(f, syllable, element, status,
score);
if (element->next && (element->next->type == GRE_ELEMENT
Expand Down

0 comments on commit ba1fb79

Please sign in to comment.