Skip to content

Commit

Permalink
Merge commit 'dfad299d4d6275ec985aada13ee1b262cd6006e7' into texrenam…
Browse files Browse the repository at this point in the history
…ingiii

* commit 'dfad299d4d6275ec985aada13ee1b262cd6006e7':
  Fixed manual custos at the end of lines by using the automatic custos code. Fixes gregorio-project#569.
  Considered automatic custos when setting the next custos. Recomputed the next custos if the clef change discretionary is printed. Fixes gregorio-project#569.
  Symlinked indentation profile into the vowel directory.
  • Loading branch information
rpspringuel committed Aug 21, 2015
2 parents 88675fe + dfad299 commit d279b1d
Show file tree
Hide file tree
Showing 14 changed files with 92 additions and 92 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.
As of v3.0.0 this project adheres to [Semantic Versioning](http://semver.org/). It follows [some conventions](http://keepachangelog.com/).

## [Unreleased][unreleased]
### Fixed
- Corrected the rendering of explicit automatic and manual custos at the end of lines when the clef change that follows it is pushed to the next line (see [#569](https://github.com/gregorio-project/gregorio/issues/569)).


## [4.0.0-beta] - 2015-08-01
Expand Down
12 changes: 10 additions & 2 deletions doc/Command_Index_gregorio.tex
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ \section{Gregorio Controls}
\macroname{\textbackslash GreCP...}{}{gregoriotex-main.tex}
A class of macros which point to the individual characters in a Gregoiro\TeX\ compatible font. This class of macros is dynamically mapped from the glyph names embedded in the \texttt{ttf} file via a Lua script to ensure that the code points match up with the installed font.

\macroname{\textbackslash GreCusto}{\#1}{gregoriotex-signs.tex}
\macroname{\textbackslash GreCustos}{\#1}{gregoriotex-signs.tex}
Typesets a custos.

\begin{argtable}
Expand Down Expand Up @@ -472,7 +472,7 @@ \section{Gregorio Controls}
& 1 & Choral sign occurs before last note of podatus, porrectus, or torculus resupinus.\\
\end{argtable}

\macroname{\textbackslash GreManualCusto}{\#1}{gregoriotex-signs.tex}
\macroname{\textbackslash GreManualCustos}{\#1}{gregoriotex-signs.tex}
Macro to typeset a custo manually.

\begin{argtable}
Expand Down Expand Up @@ -505,6 +505,14 @@ \section{Gregorio Controls}
\macroname{\textbackslash GreNewParLine}{}{gregoriotex-main.tex}
Same as \verb=\GreNewLine= except line is not justified.

\macroname{\textbackslash GreNextCustos}{\#1}{gregoriotex-signs.tex}
Sets the pitch to use for the next custos if it were to happen at the point
where this macro is called.

\begin{argtable}
\#1 & integer & Height number of the custos.\\
\end{argtable}

\macroname{\textbackslash GreNoInitial}{}{gregoriotex-main.tex}
Macro called when no initial is being set.

Expand Down
7 changes: 0 additions & 7 deletions doc/Command_Index_internal.tex
Original file line number Diff line number Diff line change
Expand Up @@ -914,13 +914,6 @@ \section{Gregorio\TeX{} Controls}
\macroname{\textbackslash gre@resizebox}{}{gregoriotex-main.tex}
Alias for \verb=\resizebox=.

\macroname{\textbackslash gre@typesetcusto}{\#1}{gregoriotex-signs.tex}
Macro to typeset a custo.

\begin{argtable}
\#1 & int & height of the custo\\
\end{argtable}

\subsection{Auxiliary File}
Gregorio\TeX\ creates it's own auxiliary file (extension \texttt{gaux}) which it uses to store information between successive typesetting runs. This allows for such features as the dynamic interline spacing. The following functions are used to interact with that auxiliary file.

Expand Down
10 changes: 6 additions & 4 deletions src/dump/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ static const char *dump_type(gregorio_type type)
return "GRE_END_OF_LINE";
case GRE_END_OF_PAR:
return "GRE_END_OF_PAR";
case GRE_CUSTO:
return "GRE_CUSTO";
case GRE_CUSTOS:
return "GRE_CUSTOS";
case GRE_SPACE:
return "GRE_SPACE";
case GRE_BAR:
Expand Down Expand Up @@ -689,11 +689,14 @@ void dump_write_score(FILE *f, gregorio_score *score)
element->type, dump_type(element->type));
}
switch (element->type) {
case GRE_CUSTO:
case GRE_CUSTOS:
if (element->u.misc.pitched.pitch) {
fprintf(f, " pitch %s\n",
dump_pitch(element->u.misc.pitched.pitch));
}
if (element->u.misc.pitched.force_pitch) {
fprintf(f, " force_pitch true\n");
}
break;
case GRE_SPACE:
if (element->u.misc.unpitched.info.space) {
Expand Down Expand Up @@ -795,7 +798,6 @@ void dump_write_score(FILE *f, gregorio_score *score)
case GRE_FLAT:
case GRE_NATURAL:
case GRE_SHARP:
case GRE_MANUAL_CUSTOS:
fprintf(f, " pitch %s\n",
dump_pitch(glyph->u.misc.pitched.pitch));
break;
Expand Down
6 changes: 0 additions & 6 deletions src/gabc/gabc-elements-determination.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,6 @@ static gregorio_element *gabc_det_elements_from_glyphs(

while (current_glyph) {
if (current_glyph->type != GRE_GLYPH) {
if (current_glyph->type == GRE_MANUAL_CUSTOS) {
first_element = current_element;
close_element(&current_element, &first_glyph, current_glyph);
current_glyph = current_glyph->next;
continue;
}
/* we ignore flats and naturals, except if they are alone */
if (current_glyph->type == GRE_NATURAL
|| current_glyph->type == GRE_FLAT
Expand Down
11 changes: 9 additions & 2 deletions src/gabc/gabc-glyphs-determination.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ gregorio_glyph *gabc_det_glyphs_from_notes(gregorio_note *current_note,
gregorio_type type = current_note->type;
char pitch = USELESS_VALUE;
bool flat = false;
bool force = false;
gregorio_sign sign = _NO_SIGN;

if (current_glyph_type != G_UNDETERMINED) {
Expand Down Expand Up @@ -698,11 +699,17 @@ gregorio_glyph *gabc_det_glyphs_from_notes(gregorio_note *current_note,
flat = true;
break;

case GRE_CUSTO:
case GRE_CUSTOS:
pitch = gabc_determine_custo_pitch(current_note->next,
*current_key);
break;

case GRE_MANUAL_CUSTOS:
pitch = current_note->u.note.pitch;
type = GRE_CUSTOS;
force = true;
break;

case GRE_BAR:
/* we calculate the signs of the bars */
if (current_note->signs == _V_EPISEMUS) {
Expand Down Expand Up @@ -735,7 +742,7 @@ gregorio_glyph *gabc_det_glyphs_from_notes(gregorio_note *current_note,
current_note->u.other, sign, current_note->texverb);
} else {
gregorio_add_pitched_element_as_glyph(&last_glyph, type, pitch,
flat, current_note->texverb);
flat, force, current_note->texverb);
}
current_glyph_first_note = current_note->next;
current_note->texverb = NULL;
Expand Down
20 changes: 12 additions & 8 deletions src/gabc/gabc-score-determination.y
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ static void gabc_fix_custos(gregorio_score *score_to_check)
while (current_syllable) {
current_element = (current_syllable->elements)[0];
while (current_element) {
if (current_element->type == GRE_CUSTO) {
if (current_element->type == GRE_CUSTOS) {
custo_element = current_element;
pitch = custo_element->u.misc.pitched.pitch;
/* we look for the key */
while (current_element) {
switch (current_element->type) {
Expand All @@ -138,7 +139,7 @@ static void gabc_fix_custos(gregorio_score *score_to_check)
newkey = gregorio_calculate_new_key(C_KEY,
current_element->u.misc.pitched.pitch - '0');
pitch_difference = (char) newkey - (char) current_key;
custo_element->u.misc.pitched.pitch = pitch - pitch_difference;
pitch -= pitch_difference;
current_key = newkey;
break;
case GRE_F_KEY_CHANGE:
Expand All @@ -148,17 +149,20 @@ static void gabc_fix_custos(gregorio_score *score_to_check)
newkey = gregorio_calculate_new_key(F_KEY,
current_element->u.misc.pitched.pitch - '0');
pitch_difference = (char) newkey - (char) current_key;
custo_element->u.misc.pitched.pitch = pitch - pitch_difference;
pitch -= pitch_difference;
current_key = newkey;
break;
default:
break;
}
while (custo_element->u.misc.pitched.pitch < LOWEST_PITCH) {
custo_element->u.misc.pitched.pitch += 7;
}
while (custo_element->u.misc.pitched.pitch > HIGHEST_PITCH) {
custo_element->u.misc.pitched.pitch -= 7;
if (!custo_element->u.misc.pitched.force_pitch) {
while (pitch < LOWEST_PITCH) {
pitch += 7;
}
while (pitch > HIGHEST_PITCH) {
pitch -= 7;
}
custo_element->u.misc.pitched.pitch = pitch;
}
assert(custo_element->u.misc.pitched.pitch >= LOWEST_PITCH
&& custo_element->u.misc.pitched.pitch
Expand Down
11 changes: 9 additions & 2 deletions src/gabc/gabc-write.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ static void gabc_write_key_change(FILE *f, char step, int line,
bool flatted_key)
{
if (flatted_key) {
fprintf(f, "%c%d", step, line);
} else {
fprintf(f, "%cb%d", step, line);
} else {
fprintf(f, "%c%d", step, line);
}
}

Expand Down Expand Up @@ -680,6 +680,13 @@ static void gabc_write_gregorio_element(FILE *f, gregorio_element *element)
case GRE_END_OF_LINE:
fprintf(f, "z");
break;
case GRE_CUSTOS:
if (element->u.misc.pitched.force_pitch) {
fprintf(f, "%c+", pitch_letter(element->u.misc.pitched.pitch));
} else {
fprintf(f, "z0");
}
break;
default:
gregorio_message(_("call with an argument which type is unknown"),
"gabc_write_gregorio_element", VERBOSITY_ERROR, 0);
Expand Down
32 changes: 13 additions & 19 deletions src/gregoriotex/gregoriotex-write.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ static gregorio_element *gregoriotex_syllable_is_clef_change(gregorio_syllable
}
element = syllable->elements[0];
/* we just detect the foud cases */
if (element->type == GRE_CUSTO && element->next
if (element->type == GRE_CUSTOS && element->next
&& (is_clef(element->next->type)) && !element->next->next) {
return element->next;
}
Expand All @@ -818,7 +818,7 @@ static gregorio_element *gregoriotex_syllable_is_clef_change(gregorio_syllable
if ((is_clef(element->type)) && !element->next) {
return element;
}
if (element->type == GRE_CUSTO && element->next
if (element->type == GRE_CUSTOS && element->next
&& element->next->type == GRE_BAR && element->next->next
&& (is_clef(element->next->next->type))
&& !element->next->next->next) {
Expand Down Expand Up @@ -2511,11 +2511,6 @@ static void gregoriotex_write_element(FILE *f, gregorio_syllable *syllable,
pitch_value(glyph->u.misc.pitched.pitch));
break;

case GRE_MANUAL_CUSTOS:
fprintf(f, "\\GreManualCusto{%d}%%\n",
pitch_value(glyph->u.misc.pitched.pitch));
break;

default:
/* at this point glyph->type is GRE_GLYPH */
assert(glyph->type == GRE_GLYPH);
Expand Down Expand Up @@ -2618,7 +2613,6 @@ static void handle_final_bar(FILE *f, const char *type, gregorio_syllable *sylla
/* first element will be the bar, which we just handled, so skip it */
for (element = (*syllable->elements)->next; element;
element = element->next) {
gregorio_glyph *glyph;
switch (element->type) {
case GRE_TEXVERB_ELEMENT:
if (element->texverb) {
Expand All @@ -2627,14 +2621,10 @@ static void handle_final_bar(FILE *f, const char *type, gregorio_syllable *sylla
}
break;

case GRE_ELEMENT:
for (glyph = element->u.first_glyph; glyph;
glyph = glyph->next) {
if (glyph->type == GRE_MANUAL_CUSTOS) {
fprintf(f, "\\GreManualCusto{%d}%%\n",
pitch_value(glyph->u.misc.pitched.pitch));
}
}
case GRE_CUSTOS:
assert(element->u.misc.pitched.force_pitch);
fprintf(f, "\\GreManualCustos{%d}%%\n",
pitch_value(element->u.misc.pitched.pitch));
break;

default:
Expand Down Expand Up @@ -2979,14 +2969,18 @@ static void gregoriotex_write_syllable(FILE *f, gregorio_syllable *syllable,
}
break;

case GRE_CUSTO:
case GRE_CUSTOS:
if (first_of_disc != 1) {
/*
* We don't print custos before a bar at the end of a line
*/
/* we also print an unbreakable larger space before the custo */
fprintf(f, "\\GreEndOfElement{1}{1}%%\n\\GreCusto{%d}%%\n",
pitch_value(element->u.misc.pitched.pitch));
fprintf(f, "\\GreEndOfElement{1}{1}%%\n\\Gre%sCustos{%d}"
"\\GreNextCustos{%d}%%\n",
element->u.misc.pitched.force_pitch? "Manual" : "",
pitch_value(element->u.misc.pitched.pitch),
pitch_value(gregorio_determine_next_pitch(syllable,
element, NULL)));
}
break;

Expand Down
Loading

0 comments on commit d279b1d

Please sign in to comment.