Skip to content

Commit

Permalink
Corrected fusion of punctum initio debilis and puncta inclinata.
Browse files Browse the repository at this point in the history
Part of the implementation for gregorio-project#679, gregorio-project#687, and gregorio-project#692.
  • Loading branch information
henryso committed Dec 20, 2015
1 parent 0586fe4 commit 5f7fba8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 10 deletions.
14 changes: 13 additions & 1 deletion src/gabc/gabc-glyphs-determination.c
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,8 @@ gregorio_glyph *gabc_det_glyphs_from_notes(gregorio_note *current_note,
} else {
/* only handle the multi-note case here; the single-note
* case will be added normally by the state machine */
if (is_tail_liquescentia(current_note->u.note.liquescentia)) {
if (is_tail_liquescentia(current_note->u.note.liquescentia)
&& current_glyph_type > G_PUNCTA_INCLINATA) {
/* once we hit a liquescent, that's the end of a string of
* fused notes */
liquescentia |= current_note->u.note.liquescentia;
Expand All @@ -923,6 +924,17 @@ gregorio_glyph *gabc_det_glyphs_from_notes(gregorio_note *current_note,
case S_QUADRATUM:
case S_QUILISMA_QUADRATUM:
/* these are fusable */
if (current_glyph_type <= G_PUNCTA_INCLINATA) {
/* if we had some puncta inclinata, then end them */
close_glyph(&last_glyph, current_glyph_type,
&current_glyph_first_note,
liquescentia, current_note->previous);
if (!(current_note->u.note.liquescentia
& L_INITIO_DEBILIS)) {
current_note->u.note.liquescentia |= L_FUSED;
liquescentia |= L_FUSED;
}
}
next_glyph_type = current_glyph_type = G_FUSED;
add = false;
break;
Expand Down
34 changes: 26 additions & 8 deletions src/gregoriotex/gregoriotex-write.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,10 @@ static grestyle_style gregoriotex_next_ignore_style = ST_NO_STYLE;
*/

static const char *gregoriotex_determine_liquescentia(
gtex_glyph_liquescentia type, gregorio_liquescentia liquescentia)
gtex_glyph_liquescentia type, const gregorio_glyph *const glyph)
{
gregorio_liquescentia liquescentia = glyph->u.notes.liquescentia;

switch (type) {
case LG_ALL:
break;
Expand All @@ -270,6 +272,12 @@ static const char *gregoriotex_determine_liquescentia(
case LG_ONLY_DEMINUTUS:
liquescentia &= L_INITIO_DEBILIS | L_DEMINUTUS;
break;
case LG_FUSIBLE_INITIO:
if (glyph->u.notes.fuse_to_next_glyph) {
liquescentia &= L_INITIO_DEBILIS;
break;
}
/* else fall through to next case */
case LG_NONE:
liquescentia = L_NO_LIQUESCENTIA;
break;
Expand Down Expand Up @@ -325,8 +333,7 @@ static const char *compute_glyph_name(const gregorio_glyph *const glyph,
{
static char buf[BUFSIZE];

const char *liquescentia = gregoriotex_determine_liquescentia(ltype,
glyph->u.notes.liquescentia);
const char *liquescentia = gregoriotex_determine_liquescentia(ltype, glyph);
gregorio_note *current_note;
int ambitus1, ambitus2, ambitus3, fuse_ambitus = 0;
const char *fuse_head = "", *fuse_tail = "";
Expand Down Expand Up @@ -404,8 +411,11 @@ static const char *compute_glyph_name(const gregorio_glyph *const glyph,

current_note = glyph->u.notes.first_note;
if (is_single_note) {
gregorio_snprintf(buf, BUFSIZE, "%s%s%s%s", fuse_head, shape,
tex_ambitus[fuse_ambitus], fuse_tail);
if (liquescentia == LIQ_Nothing) {
liquescentia = "";
}
gregorio_snprintf(buf, BUFSIZE, "%s%s%s%s%s", fuse_head, shape,
tex_ambitus[fuse_ambitus], liquescentia, fuse_tail);
return buf;
}
if (!current_note->next) {
Expand Down Expand Up @@ -494,7 +504,7 @@ static const char *gregoriotex_determine_note_glyph_name(gregorio_note *note,
case S_PUNCTUM_INCLINATUM_AUCTUS:
return SHAPE_PunctumInclinatumAuctus;
case S_PUNCTUM:
return compute_glyph_name(glyph, SHAPE_Punctum, LG_NONE, true);
return compute_glyph_name(glyph, SHAPE_Punctum, LG_FUSIBLE_INITIO, true);
case S_PUNCTUM_AUCTUS_ASCENDENS:
return SHAPE_PunctumAscendens;
case S_PUNCTUM_AUCTUS_DESCENDENS:
Expand Down Expand Up @@ -1989,8 +1999,12 @@ static void gregoriotex_write_note(FILE *f, gregorio_note *note,
case L_AUCTUS_DESCENDENS:
note->u.note.shape = S_PUNCTUM_AUCTUS_DESCENDENS;
break;
case L_DEMINUTUS:
case L_INITIO_DEBILIS:
if (glyph->u.notes.fuse_to_next_glyph > 0) {
break;
}
/* else fall through to next case */
case L_DEMINUTUS:
note->u.note.shape = S_PUNCTUM_DEMINUTUS;
default:
break;
Expand Down Expand Up @@ -2580,8 +2594,12 @@ static void gregoriotex_write_glyph(FILE *f, gregorio_syllable *syllable,
glyph->u.notes.first_note->u.note.shape =
S_PUNCTUM_AUCTUS_DESCENDENS;
break;
case L_DEMINUTUS:
case L_INITIO_DEBILIS:
if (glyph->u.notes.fuse_to_next_glyph > 0) {
break;
}
/* else fall through to next case */
case L_DEMINUTUS:
glyph->u.notes.first_note->u.note.shape = S_PUNCTUM_DEMINUTUS;
default:
break;
Expand Down
3 changes: 2 additions & 1 deletion src/gregoriotex/gregoriotex.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ typedef enum gtex_glyph_liquescentia {
LG_ALL = 0, /* for glyphs that accept all liquecentiae */
LG_NO_INITIO, /* for glyphs that don't accept initio debilis */
LG_NONE, /* for glyphs that don't accept liquescentia */
LG_ONLY_DEMINUTUS
LG_ONLY_DEMINUTUS,
LG_FUSIBLE_INITIO
} gtex_glyph_liquescentia;

typedef enum gtex_sign_type {
Expand Down

0 comments on commit 5f7fba8

Please sign in to comment.