Skip to content

Commit

Permalink
Merge commit '1e32cf0ea5c84ee3561078c501d1b0be2941cf0f' into fix-1029
Browse files Browse the repository at this point in the history
* commit '1e32cf0ea5c84ee3561078c501d1b0be2941cf0f':
  Prevented \GreForceHyphen from forcing a hyphen in the previous syllable. Fixes #1255.
  Fixed truncation/memory leak of translation after a protruding character. Fixes #1254.
  Removed the shebang from the generated uninstall-gtex.sh file. Removed display of '--no-uninstall', which was inaccurate.
  Made the generated uninstall-gtex.sh TDS-zip-friendly. Fixes #1223.
  • Loading branch information
rpspringuel committed Nov 25, 2016
2 parents 7c77009 + 1e32cf0 commit fbcd4f4
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 46 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,4 @@ res.txt
gregorio-*
ctan
*.pyg
uninstall-gtex.sh
.agignore
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ As of v3.0.0 this project adheres to [Semantic Versioning](http://semver.org/).
- Horizontal episemata bridge spaces more correctly. As mentioned earlier, you can prevent this by appending `2` to the `_` on the note before the space you do not want bridged. See [#1216](https://github.com/gregorio-project/gregorio/issues/1216).
- A rising note after an oriscus flexus will no longer generate a porrectus (see [#1220](https://github.com/gregorio-project/gregorio/issues/1220)).
- The Scribus external tool script now uses latexmk in order to handle the multi-pass features of Gregorio (see [#1236](https://github.com/gregorio-project/gregorio/issues/1236)).
- Translation text in a syllable with a trailing (forced) hyphen is no longer truncated to its first character (see [#1254](https://github.com/gregorio-project/gregorio/issues/1254)).
- A trailing (forced) hyphen in a syllable no longer generates a forced hyphen in the previous syllable (see [#1255](https://github.com/gregorio-project/gregorio/issues/1255)).

## 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).
Expand Down
6 changes: 6 additions & 0 deletions doc/Command_Index_internal.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,9 @@ \section{Gregorio\TeX{} Controls}
\#2 & integer & the second value to compare\\
\end{argtable}
\macroname{\textbackslash gre@evaluatenextsyllable}{\#1}{gregoriotex-syllable.tex}
Evaluates its first argument as an advance computation against the next syllable. Twiddles the \verb=ifgre@evaluatingnextsyllable= flag around evaluation of the macro argument.
\subsection{Auxiliary File}
Gregorio\TeX\ creates its 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 Expand Up @@ -1822,6 +1825,9 @@ \subsection{Flags}
\macroname{\textbackslash ifgre@textcleared}{}{gregoriotex-syllable.tex}
Boolean indicating that the text of this syllable should not overlap any previous syllable.
\macroname{\textbackslash ifgre@evaluatingnextsyllable}{}{gregoriotex-syllable.tex}
Boolean indicating that some aspect of the next syllable is being evaluated in advance.
\subsection{Boxes}
Boxes are used to store elements of the score before they are printed for the purposes of reusing them and/or measuring them in order to determine their appropriate placement.
Expand Down
47 changes: 29 additions & 18 deletions install-gtex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ case "$arg" in
tds)
TDS_ZIP="${NAME}.tds.zip"
TEXMFROOT=./tmp-texmf
GENERATE_UNINSTALL=false
;;
var:*)
TEXMFROOT=`${KPSEWHICH} -expand-path "\$${arg#var:}"`
Expand Down Expand Up @@ -146,12 +145,18 @@ esac

if [ "$TEXMFROOT" = "" ]
then
echo "Usage: $0 [--no-uninstall] var:{tex-variable}"
echo " $0 [--no-uninstall] dir:{directory}"
echo " $0 [--no-uninstall] system|user|tds"
echo "Usage: $0 var:{tex-variable}"
echo " $0 dir:{directory}"
echo " $0 system|user|tds"
echo
echo "Please read the documentation in the script for additional options"
exit 1
fi

UNINSTALL_SCRIPT_DIR="scripts/gregoriotex"
UNINSTALL_SCRIPT_FILE="uninstall-gtex.sh"
UNINSTALL_SCRIPT="${TEXMFROOT}/${UNINSTALL_SCRIPT_DIR}/${UNINSTALL_SCRIPT_FILE}"

function die {
echo 'Failed.'
exit 1
Expand All @@ -167,10 +172,10 @@ function install_to {
then
for name in "$@"
do
echo '$RM'" $dir/$(basename $name)" >> uninstall-gtex.sh
echo '$RM'" $dir/$(basename $name)" >> "${UNINSTALL_SCRIPT}"
done
echo "rmdir -p $dir 2> /dev/null || true" >> uninstall-gtex.sh
echo >> uninstall-gtex.sh
echo "rmdir -p $dir 2> /dev/null || true" >> "${UNINSTALL_SCRIPT}"
echo >> "${UNINSTALL_SCRIPT}"
fi
}

Expand All @@ -191,22 +196,24 @@ function not_installing {

if ${GENERATE_UNINSTALL}
then
if [ -e "uninstall-gtex.sh" ]
if [ -e "${UNINSTALL_SCRIPT}" ]
then
echo "uninstall-gtex.sh exists; delete it to continue"
echo "${UNINSTALL_SCRIPT} exists; delete it to continue"
exit 1
fi

echo '#!/usr/bin/env bash' > uninstall-gtex.sh
echo >> uninstall-gtex.sh
echo 'RM=${RM:-rm}' >> uninstall-gtex.sh
echo 'TEXHASH=${TEXHASH:-texhash}' >> uninstall-gtex.sh
echo >> uninstall-gtex.sh
echo "cd '${TEXMFROOT}'" >> uninstall-gtex.sh
echo >> uninstall-gtex.sh
mkdir -p "${TEXMFROOT}/${UNINSTALL_SCRIPT_DIR}" || die
echo '# This script uninstalls GregorioTeX.' > "${UNINSTALL_SCRIPT}"
echo '# Run it with "bash /path/to/uninstall-gtex.sh".' >> "${UNINSTALL_SCRIPT}"
echo >> "${UNINSTALL_SCRIPT}"
echo 'RM=${RM:-rm}' >> "${UNINSTALL_SCRIPT}"
echo 'TEXHASH=${TEXHASH:-texhash}' >> "${UNINSTALL_SCRIPT}"
echo >> "${UNINSTALL_SCRIPT}"
echo 'cd $(dirname ${BASH_SOURCE[0]})/../..' >> "${UNINSTALL_SCRIPT}"
echo >> "${UNINSTALL_SCRIPT}"
elif [ "$arg" != 'tds' ]
then
echo "Not generating uninstall-gtex.sh"
echo "Not generating "${UNINSTALL_SCRIPT}""
fi

echo "Removing old files"
Expand Down Expand Up @@ -241,7 +248,11 @@ ${skip_install[font-sources]:-false} && not_installing font sources ||

if ${GENERATE_UNINSTALL}
then
echo '${TEXHASH}' >> uninstall-gtex.sh
echo '$RM'" ${UNINSTALL_SCRIPT_DIR}/${UNINSTALL_SCRIPT_FILE}" >> "${UNINSTALL_SCRIPT}"
echo "rmdir -p ${UNINSTALL_SCRIPT_DIR} 2> /dev/null || true" >> "${UNINSTALL_SCRIPT}"
echo >> "${UNINSTALL_SCRIPT}"

echo '${TEXHASH}' >> "${UNINSTALL_SCRIPT}"
fi

if [ "$arg" = 'tds' ]
Expand Down
79 changes: 58 additions & 21 deletions src/gabc/gabc-score-determination.y
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ gregorio_element *current_element;
static char *macros[10];
/* other variables that we will have to use */
static gregorio_character *current_character;
static gregorio_character *suspended_character;
static gregorio_character *first_text_character;
static gregorio_character *first_translation_character;
static gregorio_tr_centering translation_type;
Expand Down Expand Up @@ -159,6 +160,7 @@ static void initialize_variables(bool point_and_click)
number_of_voices = 1;
voice = 0; /* first (and only) voice */
current_character = NULL;
suspended_character = NULL;
first_translation_character = NULL;
first_text_character = NULL;
translation_type = TR_NORMAL;
Expand Down Expand Up @@ -342,9 +344,9 @@ static __inline void save_text(void)
* the translation pointer instead of the text pointer */
static void start_translation(unsigned char asked_translation_type)
{
save_text();
suspended_character = current_character;
/* the middle letters of the translation have no sense */
center_is_determined = CENTER_FULLY_DETERMINED;
/*center_is_determined = CENTER_FULLY_DETERMINED;*/
current_character = NULL;
translation_type = asked_translation_type;
}
Expand All @@ -353,6 +355,7 @@ static void end_translation(void)
{
ready_characters();
first_translation_character = current_character;
current_character = suspended_character;
}

/*
Expand Down Expand Up @@ -542,6 +545,7 @@ static void close_syllable(YYLTYPE *loc)
}
center_is_determined = CENTER_NOT_DETERMINED;
current_character = NULL;
suspended_character = NULL;
first_text_character = NULL;
first_translation_character = NULL;
translation_type = TR_NORMAL;
Expand Down Expand Up @@ -862,23 +866,6 @@ style_beginning:
| SP_BEGIN {
add_style(ST_SPECIAL_CHAR);
}
| ELISION_BEGIN {
add_style(ST_ELISION);
}
| CENTER_BEGIN {
if (center_is_determined) {
gregorio_message(
"syllable already has center; ignoring additional center",
"det_score", VERBOSITY_WARNING, 0);
} else if (has_protrusion) {
gregorio_message(
"center not allowed after protrusion; ignored",
"det_score", VERBOSITY_WARNING, 0);
} else {
add_style(ST_FORCED_CENTER);
center_is_determined = CENTER_HALF_DETERMINED;
}
}
;

style_end:
Expand Down Expand Up @@ -906,7 +893,30 @@ style_end:
| SP_END {
end_style(ST_SPECIAL_CHAR);
}
| ELISION_END {
;

special_style_beginning:
ELISION_BEGIN {
add_style(ST_ELISION);
}
| CENTER_BEGIN {
if (center_is_determined) {
gregorio_message(
"syllable already has center; ignoring additional center",
"det_score", VERBOSITY_WARNING, 0);
} else if (has_protrusion) {
gregorio_message(
"center not allowed after protrusion; ignored",
"det_score", VERBOSITY_WARNING, 0);
} else {
add_style(ST_FORCED_CENTER);
center_is_determined = CENTER_HALF_DETERMINED;
}
}
;

special_style_end:
ELISION_END {
end_style(ST_ELISION);
}
| CENTER_END {
Expand Down Expand Up @@ -955,6 +965,8 @@ character:
}
| style_beginning
| style_end
| special_style_beginning
| special_style_end
| linebreak_area
| euouae
| CLEAR {
Expand All @@ -974,6 +986,25 @@ text:
| text character
;

translation_character:
CHARACTERS {
add_text($1.text);
}
| style_beginning
| style_end
| HYPHEN {
add_text(gregorio_strdup("-"));
}
| PROTRUDING_PUNCTUATION {
add_text($1.text);
}
;

translation_text:
translation_character
| translation_text translation_character
;

translation_beginning:
TRANSLATION_BEGIN {
start_translation(TR_NORMAL);
Expand All @@ -984,11 +1015,12 @@ translation:
translation_beginning TRANSLATION_END {
end_translation();
}
| translation_beginning text TRANSLATION_END {
| translation_beginning translation_text TRANSLATION_END {
end_translation();
}
| TRANSLATION_CENTER_END {
start_translation(TR_WITH_CENTER_END);
end_translation();
}
;

Expand Down Expand Up @@ -1028,26 +1060,31 @@ syllable_with_notes:
close_syllable(&@1);
}
| text translation OPENING_BRACKET notes {
save_text();
close_syllable(&@1);
}
| HYPHEN translation OPENING_BRACKET notes {
add_style(ST_VERBATIM);
add_text(gregorio_strdup("\\GreForceHyphen"));
end_style(ST_VERBATIM);
save_text();
close_syllable(&@1);
}
| text HYPHEN translation OPENING_BRACKET notes {
add_style(ST_VERBATIM);
add_text(gregorio_strdup("\\GreForceHyphen"));
end_style(ST_VERBATIM);
save_text();
close_syllable(&@1);
}
| PROTRUDING_PUNCTUATION translation OPENING_BRACKET notes {
add_auto_protrusion($1.text);
save_text();
close_syllable(&@1);
}
| text PROTRUDING_PUNCTUATION translation OPENING_BRACKET notes {
add_auto_protrusion($2.text);
save_text();
close_syllable(&@1);
}
;
Expand Down
27 changes: 21 additions & 6 deletions tex/gregoriotex-syllable.tex
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
% clivis alignment
\gre@widthof{\gre@endsyllablepart}%
\else%
\gre@widthof{\gre@nextendsyllablepart}%
\gre@widthof{\gre@evaluatenextsyllable{\gre@nextendsyllablepart}}%
\fi%
\gre@debugmsg{ifdim}{ temp@three > clivisalignmentmin}%
\ifdim\gre@dimen@temp@three >\gre@space@dimen@clivisalignmentmin\relax%
Expand Down Expand Up @@ -664,8 +664,23 @@
]%
}%

\newif\ifgre@evaluatingnextsyllable%
\gre@evaluatingnextsyllablefalse%
\def\gre@evaluatenextsyllable#1{%
\gre@evaluatingnextsyllabletrue%
#1%
\gre@evaluatingnextsyllablefalse%
}%

\newif\ifgre@showhyphenafterthissyllable%
\def\GreForceHyphen{\global\gre@showhyphenafterthissyllabletrue\gre@debugmsg{hyphen}{Forcing hyphen in gabc}}
\def\GreForceHyphen{%
\ifgre@evaluatingnextsyllable%
-%
\else%
\global\gre@showhyphenafterthissyllabletrue%
\gre@debugmsg{hyphen}{Forcing hyphen in gabc}%
\fi%
}%
\def\GreEmptyFirstSyllableHyphen{\ifgre@forceemptyfirstsyllablehyphen\GreForceHyphen\fi}%

% if an hyphen maybe be added by lua for this syllable. When syllable is not end of word and
Expand Down Expand Up @@ -880,7 +895,7 @@
% by default, gre@attr@dash will be 2
\gre@attr@dash=2\relax %
#5%
\gre@calculate@nextbegindifference{\gre@emit@endsyllablepartfornextsyllable}{\gre@nextfirstsyllablepart}{\gre@nextmiddlesyllablepart}{\gre@nextendsyllablepart}{#7}%
\gre@calculate@nextbegindifference{\gre@emit@endsyllablepartfornextsyllable}{\gre@evaluatenextsyllable{\gre@nextfirstsyllablepart}}{\gre@evaluatenextsyllable{\gre@nextmiddlesyllablepart}}{\gre@evaluatenextsyllable{\gre@nextendsyllablepart}}{#7}%
\gre@unsetfixednexttextformat %
\ifgre@showlyrics%
\setbox\gre@box@syllabletext=\hbox{%
Expand Down Expand Up @@ -966,7 +981,7 @@
\fi%
\fi %
% recomputing end difference and final skip with the final hyphen
\gre@calculate@nextbegindifference{\gre@emit@endsyllablepartfornextsyllable}{\gre@nextfirstsyllablepart}{\gre@nextmiddlesyllablepart}{\gre@nextendsyllablepart}{#7}%
\gre@calculate@nextbegindifference{\gre@emit@endsyllablepartfornextsyllable}{\gre@evaluatenextsyllable{\gre@nextfirstsyllablepart}}{\gre@evaluatenextsyllable{\gre@nextmiddlesyllablepart}}{\gre@evaluatenextsyllable{\gre@nextendsyllablepart}}{#7}%
\gre@calculate@enddifference{\wd\gre@box@syllablenotes}{\wd\gre@box@syllabletext}{\gre@dimen@textaligncenter}{\gre@dimen@notesaligncenter}{0}%
\gre@calculate@syllablefinalskip{#4}{\gre@count@temp@one}%
\else %
Expand Down Expand Up @@ -1034,7 +1049,7 @@
\GreNoBreak %
\fi%
% we call end of syllable
\gre@syllable@end{#7}{\gre@nextfirstsyllablepart\gre@nextmiddlesyllablepart\gre@nextendsyllablepart}{#4}%
\gre@syllable@end{#7}{\gre@evaluatenextsyllable{\gre@nextfirstsyllablepart\gre@nextmiddlesyllablepart\gre@nextendsyllablepart}}{#4}%
\gre@push@endsyllable{#6}\relax %
\global\gre@dimen@notesaligncenter=0pt\relax% very important, see flat and natural
\gre@unsetfixedtextformat %
Expand Down Expand Up @@ -1226,7 +1241,7 @@
\gre@dimen@begindifference=\dimexpr(\gre@dimen@notesaligncenter - \gre@dimen@textaligncenter)\relax%
\gre@calculate@enddifference{\wd\gre@box@syllablenotes}{\wd\gre@box@syllabletext}{\gre@dimen@textaligncenter}{\gre@dimen@notesaligncenter}{1}%
#5%
\gre@calculate@nextbegindifference{\gre@emit@endsyllablepartfornextsyllable}{\gre@nextfirstsyllablepart}{\gre@nextmiddlesyllablepart}{\gre@nextendsyllablepart}{#7}%
\gre@calculate@nextbegindifference{\gre@emit@endsyllablepartfornextsyllable}{\gre@evaluatenextsyllable{\gre@nextfirstsyllablepart}}{\gre@evaluatenextsyllable{\gre@nextmiddlesyllablepart}}{\gre@evaluatenextsyllable{\gre@nextendsyllablepart}}{#7}%
\gre@unsetfixednexttextformat %
\gre@debugmsg{barspacing}{previousenddifference: \the\gre@dimen@previousenddifference}%
\gre@debugmsg{barspacing}{begindifference: \the\gre@dimen@begindifference}%
Expand Down

0 comments on commit fbcd4f4

Please sign in to comment.