Skip to content

Commit

Permalink
Merge pull request #1168 from gregorio-project/fix-1146
Browse files Browse the repository at this point in the history
attempt to fix #1146
  • Loading branch information
eroux authored Jun 29, 2016
2 parents 4632b02 + 3d45326 commit ea5f3e6
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ As of v3.0.0 this project adheres to [Semantic Versioning](http://semver.org/).
- Space at the end of line was not always correct when a line is cut in the middle of a word (see [#1155](https://github.com/gregorio-project/gregorio/issues/1155)).
- In rare cases, the very last bar or glyph of a score could appear alone at the beginning of the final line (see [#1152](https://github.com/gregorio-project/gregorio/issues/1152)).
- In cases of a syllable without note, the space between notes of the previous and next syllables was sometimes not enough (see [#1137](https://github.com/gregorio-project/gregorio/issues/1137)).
- `moraadjustment` and `moraadjustmentbar` did not scale when changing factor, they do now.

### Changed
- When the clef and the first note are at a reasonable vertical distance, `shortspaceafterlineclef` is used instead of `spaceafterlineclef` (make them equal if you don't want this feature). This is used only on the first line, when there is an initial on one line. See [#1138](https://github.com/gregorio-project/gregorio/issues/1138).
- When an alteration follows a bar, it is not completely taken into consideration in the new bar spacing algorithm (similarly to the punctum mora), this behavior can be tuned with the newly introduced space `alterationadjustmentbar`. See [#1146](https://github.com/gregorio-project/gregorio/issues/1146).
- Very small improvement in the design of the porrectus auctus and torculus resupinus auctus (see [#1169](https://github.com/gregorio-project/gregorio/issues/1169)).

## [4.2.0-rc1] - 2016-05-31
Expand Down
3 changes: 3 additions & 0 deletions doc/Command_Index_User.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1774,6 +1774,9 @@ \subsubsection{Bar distances}
Same as \texttt{maxbaroffsettextleft@eol} but when the center of the text goes right of the center of the bar.
\end{gdimension}

\begin{gdimension}{alterationadjustmentbar}
In the case of an alteration after a bar, the alteration will go a bit left of this value. This can be compared to \texttt{moraadjustmentbar}.
\end{gdimension}

\subsection{Penalties}\label{penalties}
Penalties are used by \TeX\ to determine where line and page breaks should occur. Gregorio\TeX\ modifies or defines a few of its own to help with that process in scores. With the exception of \texttt{emergencystretch} (which should be changed using \verb=\grechangedim=) these should be changed using \verb=\grechangecount=, described above.
Expand Down
3 changes: 3 additions & 0 deletions doc/Command_Index_internal.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1887,6 +1887,9 @@ \subsection{Distances}
\macroname{\textbackslash gre@skip@nextbegindifference}{}{gregoriotex-spaces.tex}
The difference between the start of the notes and the start of the text for the next syllable. Positive when when text begins first, negative in other case.
\macroname{\textbackslash gre@dimen@adjustednextbegindifference}{}{gregoriotex-spaces.tex}
Only used in new bar spacing algorithm. It is \verb=grebegindifference= adjusted with \verb=alterationadjustmentbar= if relevant.
\macroname{\textbackslash gre@dimen@begindifference}{}{gregoriotex-spaces.tex}
The difference between the start of the notes and the start of the text for the current syllable. Positive when when text begins first, negative in other case. This means that \verb=\kern\gre@dimen@begindifference= will take you from the start of the notes to the start of the text.
Expand Down
35 changes: 31 additions & 4 deletions tex/gregoriotex-spaces.tex
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,9 @@
\newskip\gre@skip@text@allocation% amount of space allocated to the text
\newdimen\gre@dimen@text@shift% displacement from center of the text’s position
\newdimen\gre@dimen@adjustedpreviousenddifference% previousenddifference adjusted to account for the presence of a punctum mora at the end of the pervious syllable
\newdimen\gre@skip@adjustednextbegindifference% idem, nextbegindifference taking into account the presence of an alteration at the beginning of next syllable
\newskip\gre@skip@punctummorashift% displacement of whole syllable to account for the presence of a punctum mora at the end of the previous syllable
\newskip\gre@skip@alterationshift % idem for alteration at the beginning of next syllable

%
% New bar spacing algorithm
Expand All @@ -947,6 +949,8 @@
\gre@debugmsg{barspacing}{calculate available space}%
% first, recomputing \gre@dimen@previousenddifference into \gre@dimen@adjustedpreviousenddifference
\gre@punctummoraadjustment%
% recomputing \gre@dimen@nextbegindifference into \gre@dimen@adjustednextdifference
\gre@alterationadjustment{#2}%
\ifdim\gre@dimen@adjustedpreviousenddifference > 0pt\relax%
% the notes ended after the text in the previous syllable
\gre@skip@text@allocation = \gre@dimen@adjustedpreviousenddifference\relax%
Expand All @@ -956,14 +960,14 @@
\gre@skip@text@allocation = 0pt\relax%
\gre@skip@bar@allocation = -\gre@dimen@adjustedpreviousenddifference\relax%
\fi%
\ifdim\gre@skip@nextbegindifference > 0pt\relax%
\ifdim\gre@skip@adjustednextbegindifference > 0pt\relax%
% the text began after the notes in the next syllable
\advance\gre@skip@text@allocation by \gre@skip@nextbegindifference\relax%
\advance\gre@skip@text@allocation by \gre@skip@adjustednextbegindifference\relax%
\advance\gre@skip@bar@allocation by 0pt\relax%
\else%
% the notes begin after the text in the next syllable
\advance\gre@skip@text@allocation by 0pt\relax%
\advance\gre@skip@bar@allocation by -\gre@skip@nextbegindifference\relax%
\advance\gre@skip@bar@allocation by -\gre@skip@adjustednextbegindifference\relax%
\fi%
\gre@debugmsg{barspacing}{space available to text: \the\gre@skip@text@allocation}%
\gre@debugmsg{barspacing}{spacing available to notes: \the\gre@skip@bar@allocation}%
Expand Down Expand Up @@ -1133,11 +1137,24 @@
\gre@debugmsg{barspacing}{syllablefinalskip: \the\gre@skip@syllablefinalskip}%
}%

% alteration adjustment calculations
\def\gre@alterationadjustment#1{%
% taking into account the punctum mora shift
\global\gre@skip@adjustednextbegindifference=\gre@skip@nextbegindifference %
% gre@skip@alterationshift is 0 or the punctum mora shift
\global\gre@skip@alterationshift=0pt\relax %
\ifnum#1>19\ifnum\gre@insidediscretionary=0\relax % next is a flat, we're not in a clef change
\advance\gre@skip@adjustednextbegindifference by -\gre@space@dimen@alterationadjustmentbar %
\global\gre@skip@alterationshift=\gre@space@dimen@alterationadjustmentbar\relax %
\gre@debugmsg{barspacing}{adjustment for alteration: \gre@space@dimen@alterationadjustmentbar}%
\gre@debugmsg{barspacing}{adjusted next begindifference (for alteration): \the\gre@skip@adjustednextbegindifference}%
\fi\fi %
}

%punctum mora adjustment calculations
\def\gre@punctummoraadjustment{%
% taking into account the punctum mora shift
\gre@dimen@adjustedpreviousenddifference=\gre@dimen@previousenddifference %
\global\gre@dimen@adjustedpreviousenddifference=\gre@dimen@previousenddifference %
% gre@skip@punctummorashift is 0 or the punctum mora shift
\gre@skip@punctummorashift=0pt\relax %
\ifgre@lastendswithmora %
Expand Down Expand Up @@ -1495,6 +1512,7 @@
{spaceporrectuspunctummorashift}{\gre@rubberfalse}%
{raresignshift}{\gre@rubberfalse}%
{divisiofinalissep}{\gre@rubberfalse}%
{alterationadjustmentbar}{\gre@rubberfalse}%
}[\gre@rubbertrue]%
}%

Expand Down Expand Up @@ -1883,6 +1901,15 @@
\ifgre@scale@bar@rubber%
\gre@changeonedimenfactor{bar@rubber}{#1}{#2}%
\fi%
\ifgre@scale@moraadjustment%
\gre@changeonedimenfactor{moraadjustment}{#1}{#2}%
\fi%
\ifgre@scale@moraadjustmentbar%
\gre@changeonedimenfactor{moraadjustment}{#1}{#2}%
\fi%
\ifgre@scale@alterationadjustmentbar%
\gre@changeonedimenfactor{alterationadjustmentbar}{#1}{#2}%
\fi%
\ifgre@scale@divisiofinalissep%
\gre@changeonedimenfactor{divisiofinalissep}{#1}{#2}%
\fi%
Expand Down
2 changes: 2 additions & 0 deletions tex/gregoriotex-syllable.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,8 @@
\kern\gre@dimen@enddifference%
\GreNoBreak%
\fi%
% adjustment for alterations:
\kern-\gre@skip@alterationshift %
%move to the beginning of the notes of the next syllable
\gre@hskip\glueexpr(-\wd\gre@box@syllablenotes/2% back up to middle of notes
-\gre@dimen@bar@shift% go back from actual middle to nominal middle of bar line
Expand Down
3 changes: 3 additions & 0 deletions tex/gsp-default.tex
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@
\grecreatedim{interwordspacetext@bars@notext@euouae}{0.7ex}{fixed}%
% rubber length that will be added around bars in new bar spacing algorithm
\grecreatedim{bar@rubber}{0 cm plus 0.22787 cm minus 0.02 cm}{scalable}%
% in the case of an alteration after a bar, the alteration will "protrude" left of this value
% think of it as some kind of moraadjustmentbar
\grecreatedim{alterationadjustmentbar}{0.07 cm}{scalable}%
% additional space that will appear around bars that are preceded by a custos and followed by a key.
\grecreatedim{spacearoundclefbars}{0.03645 cm plus 0.00455 cm minus 0.0009 cm}{scalable}%
% space between the text of previous syllable and text associated with a bar (old bar spacing algorithm only)
Expand Down

0 comments on commit ea5f3e6

Please sign in to comment.