Skip to content

Commit

Permalink
Merge pull request #1511 from rpspringuel/visibility
Browse files Browse the repository at this point in the history
Visibility
  • Loading branch information
rpspringuel authored Feb 5, 2021
2 parents 1b977d1 + 6587eab commit 148a270
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ As of v3.0.0 this project adheres to [Semantic Versioning](http://semver.org/).

### Added
- GregorioTeX will now look in additional places for scores using. Users can specify paths to look in using `\gresetgregpath`. If scores are not found in the current working directory or the list of provided paths, we fall back on kpse to try and find them. See [#1395](https://github.com/gregorio-project/gregorio/issues/1395).
- Added the ability to toggle the visibility of the translation and above lines text. See [user request on mailing list](https://groups.google.com/g/gregorio-users/c/J-V0dkBMevY).


## [5.2.1] - 2019-04-06
Expand Down
16 changes: 16 additions & 0 deletions doc/Command_Index_User.tex
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,22 @@ \subsubsection{Text Elements}
& \texttt{invisible} & Lyrics are not visible.\\
\end{argtable}

\macroname{\textbackslash gresettranslation}{\{\#1\}}{gregoriotex-main.tex}
Sets the visibility of the translations.

\begin{argtable}
\#1 & \texttt{visible} & Translations are visible (default).\\
& \texttt{invisible} & Translations are not visible.\\
\end{argtable}

\macroname{\textbackslash gresetabovelinestext}{\{\#1\}}{gregoriotex-main.tex}
Sets the visibility of the above lines text.

\begin{argtable}
\#1 & \texttt{visible} & Above lines text are visible (default).\\
& \texttt{invisible} & Above lines text are not visible.\\
\end{argtable}


\subsubsection{Text Alignment}
Gregorio\TeX\ allows you to manipulate the global alignment behavior of some text elements using the following commands.
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 @@ -1926,6 +1926,12 @@ \subsection{Flags}
\macroname{\textbackslash ifgre@showlyrics}{}{gregoriotex-syllable.tex}
Boolean indicating whether the lyrics should be shown.
\macroname{\textbackslash ifgre@showtranslation}{}{gregoriotex-main.tex}
Boolean indicating whether the translation should be shown.
\macroname{\textbackslash ifgre@showabovelinestext}{}{gregoriotex-main.tex}
Boolean indicating whether the above lines text should be shown.
\macroname{\textbackslash gre@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.
Expand Down
84 changes: 58 additions & 26 deletions tex/gregoriotex-main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -730,14 +730,28 @@
% - typeset the text above the lines if relevant, and making sure we execute it only once
% - not do anything else

\newif\ifgre@showabovelinestext%
\gre@showabovelinestexttrue%

\def\gresetabovelinestext#1{%
\IfStrEqCase{#1}{%
{visible}{\gre@showabovelinestexttrue}%
{invisible}{\gre@showabovelinestextfalse}%
}[% all other cases
\gre@error{Unknown option, "#1" for \protect\gresetabovelinestext\MessageBreak Possible options are: 'visible' and 'invisible'}%
]%
}%

\xdef\gre@currenttextabovelines{}%

\def\GreSetTextAboveLines#1{%
\gdef\gre@currenttextabovelines{%
\gre@typesettextabovelines{#1}{0}%
\gdef\gre@currenttextabovelines{}%
\relax %
}%
\ifgre@showabovelinestext%
\gdef\gre@currenttextabovelines{%
\gre@typesettextabovelines{#1}{0}%
\gdef\gre@currenttextabovelines{}%
\relax %
}%
\fi%
}%

% typesets the text or nabc neumes above the line
Expand Down Expand Up @@ -1017,37 +1031,55 @@
]%
}%

\newif\ifgre@showtranslation%
\gre@showtranslationtrue%

\def\gresettranslation#1{%
\IfStrEqCase{#1}{%
{visible}{\gre@showtranslationtrue}%
{invisible}{\gre@showtranslationfalse}%
}[% all other cases
\gre@error{Unknown option, "#1" for \protect\gresettranslation\MessageBreak Possible options are: 'visible' and 'invisible'}%
]%
}%

\def\GreWriteTranslation#1{%
\ifgre@translationcentering %
\setbox\gre@box@temp@width=\hbox{#1}%
\gre@dimen@temp@five=\dimexpr((\wd\gre@box@syllabletext - \wd\gre@box@temp@width) / 2)\relax%
\gre@mark@translation %
\kern\gre@dimen@temp@five %
\raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}}%
\kern-\gre@dimen@temp@five %
\else %
\gre@mark@translation %
\raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}}%
\fi %
\ifgre@showtranslation%
\ifgre@translationcentering %
\setbox\gre@box@temp@width=\hbox{#1}%
\gre@dimen@temp@five=\dimexpr((\wd\gre@box@syllabletext - \wd\gre@box@temp@width) / 2)\relax%
\gre@mark@translation %
\kern\gre@dimen@temp@five %
\raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}}%
\kern-\gre@dimen@temp@five %
\else %
\gre@mark@translation %
\raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}}%
\fi %
\fi%
}%

\def\GreWriteTranslationWithCenterBeginning#1{%
\ifgre@breakintranslation\else%
\GreBeginNLBArea{0}{1}%
\fi %
\gre@attr@center=1\relax %
\gre@mark@translation %
\raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\kern 0pt\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}\kern 0pt}%
\unsetluatexattribute{\gre@attr@center}%
\relax %
\ifgre@showtranslation%
\ifgre@breakintranslation\else%
\GreBeginNLBArea{0}{1}%
\fi %
\gre@attr@center=1\relax %
\gre@mark@translation %
\raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\kern 0pt\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}\kern 0pt}%
\unsetluatexattribute{\gre@attr@center}%
\relax %
\fi%
}%

\newif\ifgre@mustdotranslationcenterend%
\gre@mustdotranslationcenterendfalse%

\def\GreTranslationCenterEnd{%
\gre@mustdotranslationcenterendtrue%
\relax %
\ifgre@showtranslation%
\gre@mustdotranslationcenterendtrue%
\relax %
\fi%
}%

\def\gre@dotranslationcenterend{%
Expand Down

0 comments on commit 148a270

Please sign in to comment.