Skip to content

Commit

Permalink
Merge pull request gregorio-project#1608 from davidweichiang/parshape
Browse files Browse the repository at this point in the history
Use \parshape for multiline initials
  • Loading branch information
rpspringuel authored Feb 10, 2025
2 parents 458f658 + 82a3390 commit 5970432
Show file tree
Hide file tree
Showing 11 changed files with 386 additions and 363 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ As of v3.0.0 this project adheres to [Semantic Versioning](http://semver.org/).
- Fixed the loss of ongoing styles when a syllable starts with a forced center. See [#1551](https://github.com/gregorio-project/gregorio/issues/1551).
- Fixed first syllables of one letter with a style causing a segfault. See [#1585](https://github.com/gregorio-project/gregorio/issues/1585).
- Fixed a bug that caused a custos to sometimes change into a clef. See [#1373](https://github.com/gregorio-project/gregorio/issues/1373).
- Fixed the alignment of 2-line initials so that an initial's baseline more exactly aligns with the baseline of the lowest line it appears next to.
- When fancyhdr and GregorioTeX are used together, GregorioTeX's disabling of hyphenation and its `post_linebreak` modification of the `post_linebreak_filter` interfere with multiline headers. Using the `fancyhdr/before` and `fancyhdr/after` hooks we temporarily reenable hyphenation and disable our `post_linebreak` modification while headers and footers are being processed in the middle of a score. See [#1603](https://github.com/gregorio-project/gregorio/issues/1603).

### Changed
Expand All @@ -21,6 +22,7 @@ As of v3.0.0 this project adheres to [Semantic Versioning](http://semver.org/).
- Added a configurable setting `\gresetunisonbreakbehavior` to control automatic line breaks between unison notes above a syllable. Defaults to `breakable` for backwards compatibility, but may be set to `unbreakable` if that behavior is desired. See [#1504](https://github.com/gregorio-project/gregorio/issues/1504).
- Added the ability to fuse upwards to a virga. See [#1558](https://github.com/gregorio-project/gregorio/issues/1558)
- Added the ability to use the "stroke" form of a clivis instead of the default two-notes form by specifying `[shape:stroke]` after the clivis to change. See [#1558](https://github.com/gregorio-project/gregorio/issues/1558)
- Allow `\gresetinitiallines{n}` where `n` is any number of lines (a non-negative integer). The manual linebreaks (`z`) that used to be required for 2-line initials are no longer required. See [#1488](https://github.com/gregorio-project/gregorio/issues/1488). Added new options `\gresetinitialanchor` and `\gresetinitialposition` to control the placement of initials.
- Added new alterations: soft flat (X) and sharp (##), which appear when there is no previous flat or sharp (respectively) in effect, and soft natural (Y), which appears when there is a previous flat or sharp in effect. A new option `\gresetalterationeffect` determines what the "effect" of an alteration is. It defaults to `line`, which is useful for Dominican chant. See [#157](https://github.com/gregorio-project/gregorio/issues/157) and also [#1575](https://github.com/gregorio-project/gregorio/issues/1575).
- 9 new St. Gall neume glyphs have been added to the `gregall` font.

Expand Down
2 changes: 2 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This file contains instructions to upgrade to a new release of Gregorio. These

## [Unreleased][develop]

Initial letters that are 2 lines high used to require manual linebreaks (`z`), but no longer do. The alignment of 2-line initial letters has changed slightly and may need to be adjusted.

GABC now has some new alterations: soft flat (`X`) and sharp (`##`), which appear when there is no previous flat or sharp (respectively) in effect, and soft natural (`Y`), which appears when there is a previous flat or sharp in effect. A new option `\gresetalterationeffect` determines what the "effect" of an alteration is. It defaults to `line`, meaning that an alteration's effect extends to the end of the line. Thus, for Dominican chant, type a soft flat (`X`) in front of _every_ note that is to be sung a half-step flat; naturals should also be soft (`Y`), but only naturals that cancel flats need to be typed.

## 6.0
Expand Down
33 changes: 30 additions & 3 deletions doc/Command_Index_User.tex
Original file line number Diff line number Diff line change
Expand Up @@ -903,13 +903,40 @@ \subsubsection{Text Elements}
\textbf{Nota Bene:} Usually the argument of this command should be an \verb=\includegraphics= command, but you may use what ever you want as the illuminated initial.

\macroname{\textbackslash gresetinitiallines}{\{\#1\}}{gregoriotex-syllable.tex}
Sets the number of lines the score initial requires.
Sets the number of lines the score initial requires (any non-negative integer).

\begin{argtable}
\#1 & number & The number of lines required by the initial. If \texttt{0}, the score will have no separated initial.\\
\end{argtable}

\textbf{Nota Bene:} As currently implemented, you cannot set an initial which is larger than 2 lines and in order to do so you must set manual line breaks in the gabc for the first two lines.
\macroname{\textbackslash gresetinitialanchor}{\{\#1\}}{gregoriotex-main.tex}
Macro to specify which part of the initial letter is aligned with the setting of \verb|\gresetinitialposition|.

\begin{argtable}
\#1 & \texttt{top} & The initial letter is aligned using its top. \\
& \texttt{baseline} & The initial letter is aligned using its baseline (default). \\
& \texttt{bottom} & The initial letter is aligned using its baseline. \\
\end{argtable}

\macroname{\textbackslash gresetinitialposition}{\{\#1\}}{gregoriotex-main.tex}

Macro to specify which part of the staff the initial letter's anchor (\verb|\gresetinitialanchor|) is aligned with.

\begin{argtable}
\#1 & \texttt{firsttop} & The initial letter's anchor is aligned with the top staff-line of the first line. \\
& \texttt{firstbaseline} & The initial letter's anchor is aligned with the baseline of the lyrics of the first line. \\
& \texttt{lastbaseline} & The initial letter's anchor is aligned with the baseline of the lyrics of the last line next to the initial (default). \\
& \texttt{lastbottom} & The initial letter's anchor is aligned with the bottom of the last line next to the initial. \\
\end{argtable}

\textbf{Nota Bene:} The \texttt{top} of a line is its top staff-line, excluding notes or text above the staff (the same position that the annotation is aligned to). But the \texttt{bottom} of the line is the very bottom, including lyrics and translations.

The alignment specified by the above two macros is performed before \texttt{initialraise} is applied. When \verb|\gresetinitiallines| is set to 2 or more, the following settings may be preferable to the defaults:
\begin{verbatim}
\gresetinitialanchor{top}%
\gresetinitialposition{firsttop}%
\grechangedim{initialraise}{0.5cm}{scalable}%
\end{verbatim}

\macroname{\textbackslash gresetmodenumbersystem}{\{\#1\}}{gregoriotex-main.tex}
Sets the number system used for the mode number.
Expand Down Expand Up @@ -1794,7 +1821,7 @@ \subsection{Distances}\label{distances}
\end{gdimension}

\begin{gdimension}{initialraise}
Distance the initial will be raised above its default baseline. The default baseline for the initial coincides with the baseline for the text below the staff.
Distance the initial will be raised above its default baseline. The default baseline for the initial coincides with the baseline for the text below the staff, on the lowest line that the initial appears next to.
\end{gdimension}

\begin{gdimension}{overslurshift}
Expand Down
39 changes: 1 addition & 38 deletions doc/Command_Index_internal.tex
Original file line number Diff line number Diff line change
Expand Up @@ -474,27 +474,12 @@ \section{Gregorio\TeX{} Controls}
& \textit{empty} & The custos should not have an alteration.\\
\end{argtable}
\macroname{\textbackslash gre@beginnotes}{}{gregoriotex-main.tex}
Macro to draw the staff lines. Comes after the initial but before the clef.
\macroname{\textbackslash gre@noinitial}{}{gregoriotex-main.tex}
Macro called when no initial is being set.
\macroname{\textbackslash gre@setbiginitial}{}{gregoriotex-main.tex}
Macro which indicates that a 2-line initial is desired.
\macroname{\textbackslash gre@setinitial}{\#1}{gregoriotex-main.tex}
Macro to set the initial in the score.
\macroname{\textbackslash gre@adjustsecondline}{}{gregoriotex.tex}
Macro to call before first syllable, but after \verb=\GreSetInitialClef=.
\macroname{\textbackslash gre@adjustthirdline}{}{gregoriotex-main.tex}
Macro to call during the second line.
\macroname{\textbackslash gre@adjustlineifnecessary}{}{gregoriotex-main.tex}
Macro that calls \verb=\gre@adjustthirdline= if indicated by \verb=\ifgre@thirdlineadjustmentnecessary=.
\macroname{\textbackslash gre@addspaceabove}{}{gregoriotex-main.tex}
Macro to increase the space above the lines to account for above lines text.
Expand Down Expand Up @@ -551,18 +536,9 @@ \section{Gregorio\TeX{} Controls}
\macroname{\textbackslash gre@dotranslationcenterend}{}{gregoriotex-main.tex}
Macro to typeset a centered translation.
\macroname{\textbackslash gre@drawfirstlines}{}{gregoriotex-main.tex}
Macro to draw the first set of lines in a score (when shortened by an initial).
\macroname{\textbackslash gre@generatelines}{}{gregoriotex-main.tex}
Macro to (re)populate the box containing the lines.
\macroname{\textbackslash gre@updatelinewidth}{}{gregoriotex-main.tex}
Macro to shorten the lines to account for the presence of the initial.
\macroname{\textbackslash gre@knownline}{}{gregoriotex-main.tex}
A count which keeps track of which line of the score we’re on.
\macroname{\textbackslash gre@lastoflinecount}{}{gregoriotex-main.tex}
Count to track where on the line we are. Values are \texttt{0} (we are not near the end of a line), \texttt{1} (we’re at the last syllable of the line), and \texttt{2} (we just set the last syllable of the line and so are at the first syllable of a new line).
Expand Down Expand Up @@ -747,9 +723,6 @@ \section{Gregorio\TeX{} Controls}
\macroname{\textbackslash gre@newglyphcommon}{}{gregoriotex-syllable.tex}
Macro called before each glyph.
\macroname{\textbackslash gre@normalinitial}{}{gregoriotex-main.tex}
Macro called at the end of the score to ensure that a big initial setting doesn’t carry into the next score.
\macroname{\textbackslash greoldcatcode}{}{gregoriotex.tex}
Macro to store the catcode for ``@'' so that we can use said symbol in function names under Plain \TeX\ and then restore the original catcode after the package is done loading.
Expand Down Expand Up @@ -1764,9 +1737,6 @@ \subsection{Flags}
Boolean used to specify whether divisio braces should be drawn by \MP{} as
opposed to rendered via the score font.
\macroname{\textbackslash gre@biginitial}{}{gregoriotex-main.tex}
Count to track whether the initial is big (2-lines) or normal (1-line).
\macroname{\textbackslash ifgre@boxing}{}{gregoriotex-syllable.tex}
Boolean to track whether we’re placing the contents of syllable notes into their box or actually printing that box (helps prevent spurious spaces from occurring when the box is being filled but not printed).
Expand Down Expand Up @@ -1902,9 +1872,6 @@ \subsection{Flags}
\macroname{\textbackslash ifgre@possibleluahyphenafterthissyllable}{}{gregoriotex-syllable.tex}
Boolean set by \verb=\GreSyllable= indicating if the Lua pass may add an hyphen after the syllable, used by \verb=\gre@calculate@eolshift= for protrusion calculation.
\macroname{\textbackslash ifgre@thirdlineadjustmentnecessary}{}{gregoriotex-syllable.tex}
Boolean which indicates that a third-line adjustment to staff line width is necessary.
\macroname{\textbackslash ifgre@scale@stafflinefactor}{}{gregoriotex-spaces.tex}
Boolean indicating whether the stafflinefactor should scale with changes of \texttt{grefactor}, or not.
Expand Down Expand Up @@ -1995,7 +1962,7 @@ \subsection{Flags}
\macroname{\textbackslash ifgre@showabovelinestext}{}{gregoriotex-main.tex}
Boolean indicating whether the above lines text should be shown.
\macroname{\textbackslash gre@initiallines}{}{gregoriotex-syllable.tex}
\macroname{\textbackslash gre@count@initiallines}{}{gregoriotex-syllable.tex}
Number of lines the initial takes up. Currently limited to 0, 1, or 2. Not currently a count, but will be changed to one in 5.0.
\macroname{\textbackslash ifgre@rewritethissyllable}{}{gregoriotex-syllable.tex}
Expand Down Expand Up @@ -2136,10 +2103,6 @@ \subsection{Distances}
a syllable to the middle of the middle letters. Used for lining up
neumes and syllables.
\macroname{\textbackslash gre@dimen@additionalleftspace}{}{gregoriotex-spaces.tex}
Dimension representing the additional space that has to be added to
the localleftbox for a big initial (one taking two lines).
\macroname{\textbackslash gre@dimen@initialwidth}{}{gregoriotex-spaces.tex}
Dimension representing the width of the initial (and the space after).
Expand Down
33 changes: 16 additions & 17 deletions doc/GregorioRef.tex
Original file line number Diff line number Diff line change
Expand Up @@ -186,23 +186,22 @@
\large Version \textbf{6.0.0}, 13 March 2021 %% PARSE_VERSION_DATE

\vspace{1.5cm}
\end{center}
\gresetlinecolor{gregoriocolor}
\grechangestyle{lowchoralsign}{\cminfamily\small}%
\grechangestyle{highchoralsign}{\cminfamily\small}%
\def\GreStar{\greheightstar}%
\greannotation{\scriptsize Comm.}%
\greannotation{\scriptsize VII}%
\begingroup%
\color{black!60}%
\setmainfont[SmallCapsFont=AlegreyaSC]{Alegreya}%
\newlength{\mini}%
\setlength{\mini}{\hsize}%
\addtolength{\mini}{-4cm}%
\setlength{\fboxsep}{5mm}%
\hfill\fbox{\parbox{\mini}{\gregorioscore[f]{factus}}}\hfill%
\endgroup
\begin{center}
\gresetlinecolor{gregoriocolor}
\grechangestyle{lowchoralsign}{\cminfamily\small}%
\grechangestyle{highchoralsign}{\cminfamily\small}%
\def\GreStar{\greheightstar}%
\greannotation{\scriptsize Comm.}%
\greannotation{\scriptsize VII}%
\begingroup%
\color{black!60}%
\setmainfont[SmallCapsFont=AlegreyaSC]{Alegreya}%
\newlength{\mini}%
\setlength{\mini}{\hsize}%
\addtolength{\mini}{-4cm}%
\setlength{\fboxsep}{5mm}%
\fbox{\parbox{\mini}{\gregorioscore[f]{factus}}}%
\endgroup

\vspace{1.5cm}%
\href{http://gregorio-project.github.io/}{Homepage}

Expand Down
7 changes: 3 additions & 4 deletions doc_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ sed -i.temp 's:.*DEPRECATED.*::' $CODEFILE
sed -i.temp 's/%.*$//' $CODEFILE

#remove whitespace
sed -i.temp 's/^[ \t]*//;s/[ \t]*$//' $CODEFILE
sed -i.temp 's/^[[:space:]]*//;s/[[:space:]]*$//' $CODEFILE

#remove new and trailing code
sed -i.temp 's:.*\\new[a-z]*{*\(\\*[a-zA-Z@]*\)[\\}]*.*:\1:' $CODEFILE
Expand Down Expand Up @@ -148,7 +148,7 @@ grep -h '\\gre@deprecated.*' *.tex | grep -v '\\def\\' >> $DOCFILE
grep -h '\\gre@obsolete.*' *.tex | grep -v '\\def\\' >> $DOCFILE

#remove whitespace
sed -i.temp 's/^[ \t]*//;s/[ \t]*$//' $DOCFILE
sed -i.temp 's/^[[:space:]]*//;s/[[:space:]]*$//' $DOCFILE

sed -i.temp 's:.*\\gre@deprecated{.*::' $DOCFILE
sed -i.temp 's:.*\\gre@obsolete{.*::' $DOCFILE
Expand All @@ -175,5 +175,4 @@ rm $CODEFILE.temp
rm $CODEFILE
rm $DIFFFILE

#open result
open $RESFILE
cat $RESFILE
Loading

0 comments on commit 5970432

Please sign in to comment.