Skip to content

Commit

Permalink
Fixed incorrect offset determination for scandicus and fixed bridges …
Browse files Browse the repository at this point in the history
…on "below" episemae.

Fixes gregorio-project#419.
  • Loading branch information
henryso committed May 16, 2015
1 parent 9b11116 commit 381efca
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
6 changes: 5 additions & 1 deletion src/gregoriotex/gregoriotex-position.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,11 @@ static gregorio_vposition advise_positioning(const gregorio_glyph *const glyph,
break;
case 2:
low_high_set_lower(glyph, note);
note->gtex_offset_case = note_before_last_note_case(glyph, note);
if (note->u.note.pitch - note->previous->u.note.pitch == 1) {
note->gtex_offset_case = FinalPunctum;
} else {
note->gtex_offset_case = FinalConnectedPunctum;
}
h_episemus = VPOS_BELOW;
v_episemus = VPOS_BELOW;
break;
Expand Down
31 changes: 22 additions & 9 deletions src/gregoriotex/gregoriotex-write.c
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,7 @@ static inline char height_to_letter(char height)
static inline void write_single_hepisemus(FILE *const f, int hepisemus_case,
const gregorio_note *const note, bool connect, char height,
const grehepisemus_size size, const int i,
const gregorio_glyph *const glyph,
const int porrectus_long_episemus_index,
bool (*const is_episemus_shown)(const gregorio_note *))
{
Expand Down Expand Up @@ -1612,11 +1613,22 @@ static inline void write_single_hepisemus(FILE *const f, int hepisemus_case,
if (i - 1 != porrectus_long_episemus_index || !note->previous
|| !is_episemus_shown(note->previous)) {
height = height_to_letter(height);
if (connect && (!note->next
|| note->next->u.note.shape == S_PUNCTUM_INCLINATUM
|| note->next->u.note.shape == S_PUNCTUM_INCLINATUM_DEMINUTUS
|| note->next->u.note.shape == S_PUNCTUM_INCLINATUM_AUCTUS)) {
fprintf(f, "\\grehepisemusbridge{%c}{}{}%%\n", height);
if (connect && (
// not followed by a zero-width space
(!note->next
&& (!glyph->next
|| glyph->next->type != GRE_SPACE
|| glyph->next->u.misc.unpitched.info.space
!= SP_ZERO_WIDTH))
// is a punctum inclinatum of some sort
|| (note->next
&& (note->next->u.note.shape == S_PUNCTUM_INCLINATUM
|| note->next->u.note.shape
== S_PUNCTUM_INCLINATUM_DEMINUTUS
|| note->next->u.note.shape
== S_PUNCTUM_INCLINATUM_AUCTUS)))) {
fprintf(f, "\\grehepisemusbridge{%c}{%d}%%\n", height,
hepisemus_case);
}
fprintf(f, "\\grehepisemus{%c}{\\greoCase%s}{%d}{%d}{%c}{%c}%%\n",
height, note->gtex_offset_case, ambitus, hepisemus_case,
Expand All @@ -1630,7 +1642,8 @@ static inline void write_single_hepisemus(FILE *const f, int hepisemus_case,
* @param i The position of the note in the glyph.
*/
static void gregoriotex_write_hepisemus(FILE *const f,
const gregorio_note *const note, const int i, const gtex_type type)
const gregorio_note *const note, const int i, const gtex_type type,
const gregorio_glyph *const glyph)
{
int porrectus_long_episemus_index = -1;

Expand All @@ -1653,10 +1666,10 @@ static void gregoriotex_write_hepisemus(FILE *const f,
}

write_single_hepisemus(f, 1, note, note->h_episemus_below_connect,
note->h_episemus_below, note->h_episemus_below_size, i,
note->h_episemus_below, note->h_episemus_below_size, i, glyph,
porrectus_long_episemus_index, &gtex_is_h_episemus_below_shown);
write_single_hepisemus(f, 0, note, note->h_episemus_above_connect,
note->h_episemus_above, note->h_episemus_above_size, i,
note->h_episemus_above, note->h_episemus_above_size, i, glyph,
porrectus_long_episemus_index, &gtex_is_h_episemus_above_shown);
}

Expand Down Expand Up @@ -2157,7 +2170,7 @@ static void gregoriotex_write_signs(FILE *f, gtex_type type,
// we continue with the hepisemus
if (current_note->h_episemus_above || current_note->h_episemus_below) {
_found();
gregoriotex_write_hepisemus(f, current_note, i, type);
gregoriotex_write_hepisemus(f, current_note, i, type, glyph);
}
// write_rare also writes the vepisemus
if (current_note->special_sign) {
Expand Down
10 changes: 8 additions & 2 deletions tex/gregoriotex-signs.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1454,9 +1454,15 @@
\AddHEpisemusBridges%

% same but for a "bridge episemus" after the last note of a glyph (element, syllable) if the next episemus is at the same height
\def\grehepisemusbridge#1#2#3{%
% #1 is the height
% #2 is 0 for episemus above, 1 for episemus below
\def\grehepisemusbridge#1#2{%
\ifnum\greaddhepisemusbridges=1\relax %
\gre@calculate@glyphraisevalue{#1}{9}%
\ifcase#2 %
\gre@calculate@glyphraisevalue{#1}{9}%
\or %
\gre@calculate@glyphraisevalue{#1}{5}%
\fi %
\raise\gre@dimen@glyphraisevalue\hbox to 0pt{\gregoriofont\gre@char@he@punctum{f}\hss}%
\fi %
\relax %
Expand Down

0 comments on commit 381efca

Please sign in to comment.