From 7e53de92a5f04d33773f61e72eb3dd3daceb347e Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Sat, 30 Jul 2016 15:07:12 +0200 Subject: [PATCH 1/5] #1189: TeX part --- tex/gregoriotex-main.tex | 1 + tex/gregoriotex-signs.tex | 38 ++++++++++++------- tex/gregoriotex-spaces.tex | 75 ++++++++++++++++++++++++++++++++++++-- 3 files changed, 96 insertions(+), 18 deletions(-) diff --git a/tex/gregoriotex-main.tex b/tex/gregoriotex-main.tex index c6dddb4d9..be87d683b 100644 --- a/tex/gregoriotex-main.tex +++ b/tex/gregoriotex-main.tex @@ -1300,6 +1300,7 @@ \unsetluatexattribute{\gre@attr@glyph@top}% \unsetluatexattribute{\gre@attr@glyph@bottom}% \unsetluatexattribute{\gre@attr@dash}% + \xdef\gre@bolshiftcleftypelocal{\gre@bolshiftcleftypeglobal}% \ifgre@justifylastline% \parfillskip=\gre@save@parfillskip\relax% \fi % diff --git a/tex/gregoriotex-signs.tex b/tex/gregoriotex-signs.tex index 1f99ef394..e002c319c 100644 --- a/tex/gregoriotex-signs.tex +++ b/tex/gregoriotex-signs.tex @@ -142,7 +142,6 @@ ]% }% - %% marcro to define the clef that will appear at the beginning of the lines % the first argument is the type : f or c, and the second is the height % the third argument is whether we must type a space after or not (0 if not, 1 if yes) @@ -166,6 +165,12 @@ \relax% }% +\def\GreSetLargestClef#1#2#3#4#5#6#7{% + \gre@boxclef{#1}{#2}{0}{#3}{#4}{#5}{#6}{#7}% + \gre@update@clefwidth@max{\wd\gre@box@temp@width}% + \relax% +}% + \def\gre@save@clef#1#2#3#4#5#6{% \global\let\gre@clef=#1\relax% \xdef\gre@clefheight{#2}% @@ -183,18 +188,9 @@ \newbox\gre@box@temp@clef% \newbox\gre@box@temp@cleftwo% -% macro that typesets the clef -% arguments are : -%% #1: the type of the clef : c or f -%% #2: the line of the clef (1 is the lowest) -%% #3: if we must use small clef characters (inside a line) or not 0: if not inside, 1 if inside -%% #4: 0: no space after, 1: normal space after, 2: short space after -%% #5: if 3, it means that we must not put a flat after the clef, otherwise it's the height of the flat -%% #6: the type of the secondary clef : c or f -%% #7: the line of the secondary clef (1 is the lowest) -%% #8: if 3, it means that we must not put a flat after the secondary clef, otherwise it's the height of the flat -\def\gre@typeclef#1#2#3#4#5#6#7#8{% - \setbox\gre@box@temp@width=\hbox{% + +\def\gre@boxclef#1#2#3#4#5#6#7#8{% + \global\setbox\gre@box@temp@width=\hbox{% \ifcase#7% \gre@typesingleclef{#1}{#2}{#3}{#5}% \else % @@ -214,8 +210,22 @@ \fi % \fi % }% +} + +% macro that typesets the clef +% arguments are : +%% #1: the type of the clef : c or f +%% #2: the line of the clef (1 is the lowest) +%% #3: if we must use small clef characters (inside a line) or not 0: if not inside, 1 if inside +%% #4: 0: no space after, 1: normal space after, 2: short space after +%% #5: if 3, it means that we must not put a flat after the clef, otherwise it's the height of the flat +%% #6: the type of the secondary clef : c or f +%% #7: the line of the secondary clef (1 is the lowest) +%% #8: if 3, it means that we must not put a flat after the secondary clef, otherwise it's the height of the flat +\def\gre@typeclef#1#2#3#4#5#6#7#8{% + \gre@boxclef{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}% \ifcase#3% - \global\gre@dimen@clefwidth=\wd\gre@box@temp@width % + \gre@update@clefwidth@current{\wd\gre@box@temp@width}% \fi % \copy\gre@box@temp@width % \ifcase#4 % diff --git a/tex/gregoriotex-spaces.tex b/tex/gregoriotex-spaces.tex index 503257145..7c78e736c 100644 --- a/tex/gregoriotex-spaces.tex +++ b/tex/gregoriotex-spaces.tex @@ -396,6 +396,9 @@ \else% \global\advance\gre@skip@temp@three by \gre@dimen@bolextra\relax% \fi% + \gre@debugmsg{bolshift}{ clefwidthcurrent = \the\gre@dimen@clefwidth@current}% + \gre@debugmsg{bolshift}{ clefwidthbol = \the\gre@dimen@clefwidth@bol}% + \global\advance\gre@skip@temp@three by \dimexpr(\gre@dimen@clefwidth@current-\gre@dimen@clefwidth@bol)\relax % \ifdim#1>0pt\relax% % no additional shift is needed if the notes start before the text \global\gre@dimen@bolshift = \gre@skip@temp@three\relax% @@ -407,7 +410,7 @@ % we don't want to kern more than clefwidth + spaceafterlineclef - minimalspaceatlinebeginning % violating this would mean that either the notes are closer than (clefwidth + spaceafterlineclef) % or that the lyrics are closer than minimalspaceatlinebeginning - \gre@skip@temp@one = \glueexpr(\gre@dimen@clefwidth % + \gre@skip@temp@one = \glueexpr(\gre@dimen@clefwidth@bol % + \gre@space@skip@spaceafterlineclef % - \gre@space@dimen@minimalspaceatlinebeginning)\relax % \ifdim\gre@skip@temp@three < \gre@skip@temp@one % @@ -420,6 +423,73 @@ \relax % } +% the width of the current +\newdimen\gre@dimen@clefwidth@current\relax% +% the width of the max clef +\newdimen\gre@dimen@clefwidth@max\relax% +% the width to compute bolshift with +\newdimen\gre@dimen@clefwidth@bol\relax% + +\def\gre@update@clefwidth@current#1{% + \gre@debugmsg{bolshift}{ updating clefwidthcurrent to \the\gre@dimen@clefwidth@current}% + \global\gre@dimen@clefwidth@current=#1\relax % + \ifnum\gre@bolshiftcleftypelocal=2\relax % + \global\gre@dimen@clefwidth@bol=#1\relax % + \fi % + \relax % +} + +\def\gre@update@clefwidth@max#1{% + \global\gre@dimen@clefwidth@max=#1\relax % + \ifnum\gre@bolshiftcleftypelocal=1\relax % + \global\gre@dimen@clefwidth@bol=#1\relax % + \fi % +} + +\def\gre@update@clefwidth@forced#1{% + \global\gre@dimen@clefwidth@bol=#1\relax % +} + +% 1 for max, 2 for current and 3 for forced +\xdef\gre@bolshiftcleftypeglobal{1} +\xdef\gre@bolshiftcleftypelocal{1} + +\def\grebolshiftcleftype#1{ + \IfStrEqCase{#1}{% + {max}% + {\xdef\gre@bolshiftcleftypeglobal{1}\xdef\gre@bolshiftcleftypelocal{1}}% + {current}% + {\xdef\gre@bolshiftcleftypeglobal{2}\xdef\gre@bolshiftcleftypelocal{2}}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\grebolshiftcleftype\MessageBreak Possible options are: 'max' and 'current'.}% + ]% +} + +\def\grelocalbolshiftcleftype#1{ + \IfStrEqCase{#1}{% + {max}% + {\xdef\gre@bolshiftcleftypelocal{1}% + \global\gre@dimen@clefwidth@bol=\gre@dimen@clefwidth@max\relax }% + {current}% + {\xdef\gre@bolshiftcleftypelocal{2}% + \global\gre@dimen@clefwidth@bol=\gre@dimen@clefwidth@current\relax }% + {c}% + {\gre@boxclef{c}{4}{0}{3}{c}{0}{3}{1}% + \xdef\gre@bolshiftcleftypelocal{3}% + \gre@update@clefwidth@forced{\wd\gre@box@temp@width}}% + {f}% + {\gre@boxclef{f}{3}{0}{1}{3}{c}{0}{3}% + \xdef\gre@bolshiftcleftypelocal{3}% + \gre@update@clefwidth@forced{\wd\gre@box@temp@width}}% + {cb}% + {\global\let\GreHyph\gre@char@zerohyph}% + {fb}% + {\global\let\GreHyph\gre@char@zerohyph}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\grelocalbolshiftcleftype\MessageBreak Possible options are: 'max', 'current', 'c', 'f', 'cb' and 'fb'.}% + ]% +} + % dimen keeping the shift computed with next function \newdimen\gre@dimen@eolshift \newcount\gre@count@protrusion@hyphen@eol % @@ -1212,9 +1282,6 @@ % begindifference is the difference between the beginning of the text and the beginning of the notes. Warning : it can be negative. \newdimen\gre@dimen@begindifference\relax% -% the width of the clef -\newdimen\gre@dimen@clefwidth\relax% - % the width of the last glyph \newdimen\gre@dimen@lastglyphwidth\relax% From f64c6cb6d7c7aa021e9d52d58a0a7775f055ed92 Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Sat, 30 Jul 2016 16:53:09 +0200 Subject: [PATCH 2/5] #1189: doc --- CHANGELOG.md | 3 +++ doc/Command_Index_User.tex | 20 ++++++++++++++++++++ doc/Command_Index_gregorio.tex | 7 ++++++- tex/gregoriotex-signs.tex | 18 ++++++++++++------ tex/gregoriotex-spaces.tex | 30 +++++++++++++++++------------- 5 files changed, 58 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a05d30e5..30b9491a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ 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] +## 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). + ### Added - More cavum shapes are now available. To use them, simply add `r` in gabc to any note in a glyph. See [#844](https://github.com/gregorio-project/gregorio/issues/844). - Square brackets can be placed around notes by using `[[` and `]]` to surround said notes in gabc (see [#844](https://github.com/gregorio-project/gregorio/issues/844)). diff --git a/doc/Command_Index_User.tex b/doc/Command_Index_User.tex index 097840f6c..3224f6649 100644 --- a/doc/Command_Index_User.tex +++ b/doc/Command_Index_User.tex @@ -1008,6 +1008,26 @@ \subsubsection{End of Line Behavior} & \texttt{disable} & The shifts are not applied. \end{argtable} +\macroname{\textbackslash grebolshiftcleftype}{\{\#1\}}{gregoriotex-spaces.tex} +Macro to determine how notes should be left aligned in the case where clefs of different widths appear in the same score. + +\begin{argtable} + \#1 & \texttt{largest} & The notes are aligned as if all clefs had the width of the largest clef (default)\\ + & \texttt{current} & The notes are aligned on the current clef, which leads to unaligned notes. This was the default of Gregorio < \texttt{5.0}. +\end{argtable} + +\macroname{\textbackslash grelocalbolshiftcleftype}{\{\#1\}}{gregoriotex-spaces.tex} +Equivalent of \verb=\grebolshiftcleftype= but valid only until the next end of a score, and with more options. This can be used inside gabc for corner cases like different alignment on a score taking two pages. + +\begin{argtable} + \#1 & \texttt{largest} & same as in \verb=\grebolshiftcleftype=\\ + & \texttt{current} & idem\\ + & \texttt{f} & force left alignment of notes as if all clef were f clef\\ + & \texttt{c} & idem with c clef\\ + & \texttt{fb} & idem with flatted f clef\\ + & \texttt{cb} & idem with flatted c clef\\ +\end{argtable} + \macroname{\textbackslash gresetlastline}{\{\#1\}}{gregoriotex-main.tex} Macro to determine whether the last line of the score should be justified or not. diff --git a/doc/Command_Index_gregorio.tex b/doc/Command_Index_gregorio.tex index d08a61a58..dfca1b640 100644 --- a/doc/Command_Index_gregorio.tex +++ b/doc/Command_Index_gregorio.tex @@ -802,7 +802,7 @@ \section{Gregorio Controls} \#7 & integer & \texttt{0} if clef and first note are far enough to use a shorter space, 1 otherwise.\\ \end{argtable} -\macroname{\textbackslash GreSetLinesClef}{\#1\#2\#3\#4\#5\#6\#7}{gregoriotex-main.tex} +\macroname{\textbackslash GreSetLinesClef}{\#1\#2\#3\#4\#5\#6\#7}{gregoriotex-signs.tex} Macro to define the clef that will appear at the beginning of the lines. \begin{argtable} @@ -816,6 +816,11 @@ \section{Gregorio Controls} \#7 & integer & Height of flat in secondary clef (\texttt{3} for no flat).\\ \end{argtable} +\macroname{\textbackslash GreSetLargestClef}{\#1\#2\#3\#4\#5\#6}{gregoriotex-signs.tex} +Macro defining the largest clef of the score (for notes left alignment). +The arguments are the same as \verb=\GreSetInitialClef= without the \#7th one, which is always considered +to be \texttt{1}. + \macroname{\textbackslash GreSetNabcAboveLines}{\#1}{gregoriotex-main.tex} Macro to place argument containing Nabc neumes above the lines and empty \verb=\gre@currenttextabovelines= when done. diff --git a/tex/gregoriotex-signs.tex b/tex/gregoriotex-signs.tex index e002c319c..e6bf50f1e 100644 --- a/tex/gregoriotex-signs.tex +++ b/tex/gregoriotex-signs.tex @@ -143,9 +143,11 @@ }% %% marcro to define the clef that will appear at the beginning of the lines -% the first argument is the type : f or c, and the second is the height -% the third argument is whether we must type a space after or not (0 if not, 1 if yes) -% if the fourth argument is 3, it means that we must not put a flat after the key, otherwise it's the height of the flat +%% #1 c or f: type of first clef +%% #2 int: line of first clef +%% #3 int: 0 if not space, 1 if normal space, 2 for short space +%% #4 int: height of the flat of first clef, 3 for no flat +%% #5, #6, #7 = #1, #2, #3 for second clef \def\GreSetLinesClef#1#2#3#4#5#6#7{% \gre@localleftbox{% \gre@skip@temp@four = \gre@dimen@additionalleftspace\relax% @@ -165,9 +167,12 @@ \relax% }% -\def\GreSetLargestClef#1#2#3#4#5#6#7{% - \gre@boxclef{#1}{#2}{0}{#3}{#4}{#5}{#6}{#7}% - \gre@update@clefwidth@max{\wd\gre@box@temp@width}% +% defines the largest clef of the score +% arguments are the same as \GreSetLinesClef except that the #3 of +% \GreSetLineClef is removed (always 1) +\def\GreSetLargestClef#1#2#3#4#5#6{% + \gre@boxclef{#1}{#2}{0}{1}{#3}{#4}{#5}{#6}% + \gre@update@clefwidth@largest{\wd\gre@box@temp@width}% \relax% }% @@ -189,6 +194,7 @@ \newbox\gre@box@temp@clef% \newbox\gre@box@temp@cleftwo% +% sets \gre@box@temp@width with the clef, the arguments are the same as \gre@typeclef \def\gre@boxclef#1#2#3#4#5#6#7#8{% \global\setbox\gre@box@temp@width=\hbox{% \ifcase#7% diff --git a/tex/gregoriotex-spaces.tex b/tex/gregoriotex-spaces.tex index 7c78e736c..3cda35fd2 100644 --- a/tex/gregoriotex-spaces.tex +++ b/tex/gregoriotex-spaces.tex @@ -410,7 +410,7 @@ % we don't want to kern more than clefwidth + spaceafterlineclef - minimalspaceatlinebeginning % violating this would mean that either the notes are closer than (clefwidth + spaceafterlineclef) % or that the lyrics are closer than minimalspaceatlinebeginning - \gre@skip@temp@one = \glueexpr(\gre@dimen@clefwidth@bol % + \gre@skip@temp@one = \glueexpr(\gre@dimen@clefwidth@current % + \gre@space@skip@spaceafterlineclef % - \gre@space@dimen@minimalspaceatlinebeginning)\relax % \ifdim\gre@skip@temp@three < \gre@skip@temp@one % @@ -426,7 +426,7 @@ % the width of the current \newdimen\gre@dimen@clefwidth@current\relax% % the width of the max clef -\newdimen\gre@dimen@clefwidth@max\relax% +\newdimen\gre@dimen@clefwidth@largest\relax% % the width to compute bolshift with \newdimen\gre@dimen@clefwidth@bol\relax% @@ -439,8 +439,8 @@ \relax % } -\def\gre@update@clefwidth@max#1{% - \global\gre@dimen@clefwidth@max=#1\relax % +\def\gre@update@clefwidth@largest#1{% + \global\gre@dimen@clefwidth@largest=#1\relax % \ifnum\gre@bolshiftcleftypelocal=1\relax % \global\gre@dimen@clefwidth@bol=#1\relax % \fi % @@ -450,31 +450,31 @@ \global\gre@dimen@clefwidth@bol=#1\relax % } -% 1 for max, 2 for current and 3 for forced +% 1 for largest, 2 for current and 3 for forced \xdef\gre@bolshiftcleftypeglobal{1} \xdef\gre@bolshiftcleftypelocal{1} \def\grebolshiftcleftype#1{ \IfStrEqCase{#1}{% - {max}% + {largest}% {\xdef\gre@bolshiftcleftypeglobal{1}\xdef\gre@bolshiftcleftypelocal{1}}% {current}% {\xdef\gre@bolshiftcleftypeglobal{2}\xdef\gre@bolshiftcleftypelocal{2}}% }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\grebolshiftcleftype\MessageBreak Possible options are: 'max' and 'current'.}% + \gre@error{Unrecognized option "#1" for \protect\grebolshiftcleftype\MessageBreak Possible options are: 'largest' and 'current'.}% ]% } \def\grelocalbolshiftcleftype#1{ \IfStrEqCase{#1}{% - {max}% + {largest}% {\xdef\gre@bolshiftcleftypelocal{1}% - \global\gre@dimen@clefwidth@bol=\gre@dimen@clefwidth@max\relax }% + \global\gre@dimen@clefwidth@bol=\gre@dimen@clefwidth@largest\relax }% {current}% {\xdef\gre@bolshiftcleftypelocal{2}% \global\gre@dimen@clefwidth@bol=\gre@dimen@clefwidth@current\relax }% {c}% - {\gre@boxclef{c}{4}{0}{3}{c}{0}{3}{1}% + {\gre@boxclef{c}{3}{0}{1}{3}{c}{0}{3}% \xdef\gre@bolshiftcleftypelocal{3}% \gre@update@clefwidth@forced{\wd\gre@box@temp@width}}% {f}% @@ -482,11 +482,15 @@ \xdef\gre@bolshiftcleftypelocal{3}% \gre@update@clefwidth@forced{\wd\gre@box@temp@width}}% {cb}% - {\global\let\GreHyph\gre@char@zerohyph}% + {\gre@boxclef{c}{3}{0}{1}{8}{c}{0}{3}% + \xdef\gre@bolshiftcleftypelocal{3}% + \gre@update@clefwidth@forced{\wd\gre@box@temp@width}}% {fb}% - {\global\let\GreHyph\gre@char@zerohyph}% + {\gre@boxclef{f}{3}{0}{1}{8}{c}{0}{3}% + \xdef\gre@bolshiftcleftypelocal{3}% + \gre@update@clefwidth@forced{\wd\gre@box@temp@width}}% }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\grelocalbolshiftcleftype\MessageBreak Possible options are: 'max', 'current', 'c', 'f', 'cb' and 'fb'.}% + \gre@error{Unrecognized option "#1" for \protect\grelocalbolshiftcleftype\MessageBreak Possible options are: 'largest', 'current', 'c', 'f', 'cb' and 'fb'.}% ]% } From b7e1a5d79a09fe82f42657b963051d05a0ec3a4b Mon Sep 17 00:00:00 2001 From: "Henry So, Jr." Date: Sat, 30 Jul 2016 13:10:14 -0400 Subject: [PATCH 3/5] Added code to emit \GreSetLargestClef at the top of the score. Part of the fix for #1189. --- src/gregoriotex/gregoriotex-write.c | 85 +++++++++++++++++++++++++++++ src/struct.h | 4 +- 2 files changed, 87 insertions(+), 2 deletions(-) diff --git a/src/gregoriotex/gregoriotex-write.c b/src/gregoriotex/gregoriotex-write.c index 2154fefe6..5b8d3e5f5 100644 --- a/src/gregoriotex/gregoriotex-write.c +++ b/src/gregoriotex/gregoriotex-write.c @@ -4110,6 +4110,90 @@ static int first_note_near_clef(const gregorio_score *const score) { return 1; } +static int clef_size(const gregorio_clef_info *const clef) +{ + /* this is a heuristic clef size approximation: + * C-clef = 1 + * F-clef = 2 + * flatted = +2 + * unstacked double-clef = +1 (plus the clef size) + */ + /* purposely making line signed */ + int line_diff = clef->line - clef->secondary_line; + int size; + if (clef->clef == CLEF_F) { + size = 2; + } else { + size = 1; + } + if (clef->flatted) { + size += 2; + } + if (clef->secondary_line) { + if (line_diff < -1 || line_diff > 1) { /* stacked */ + int secondary_size; + if (clef->secondary_clef == CLEF_F) { + secondary_size = 2; + } else { + secondary_size = 1; + } + if (clef->secondary_flatted) { + secondary_size += 2; + } + if (secondary_size > size) { + size = secondary_size; + } + } else { /* unstacked */ + size += 1; + if (clef->secondary_clef == CLEF_F) { + size += 2; + } else { + size += 1; + } + if (clef->secondary_flatted) { + size += 2; + } + } + } + return size; +} + +static void write_largest_clef(FILE *const f, gregorio_score *const score) +{ + const gregorio_syllable *syllable; + const gregorio_element *element; + gregorio_clef_info clef = gregorio_default_clef; + int size; + + if (score->first_voice_info) { + clef = score->first_voice_info->initial_clef; + } + size = clef_size(&clef); + + for (syllable = score->first_syllable; syllable; + syllable = syllable->next_syllable) { + if (syllable->elements) { + for (element = *syllable->elements; element; + element = element->next) { + if (element->type == GRE_CLEF) { + const int this_size = clef_size(&element->u.misc.clef); + if (this_size > size) { + clef = element->u.misc.clef; + size = this_size; + } + } + } + } + } + + fprintf(f, "\\GreSetLargestClef{%c}{%d}{%d}{%c}{%d}{%d}%%\n", + gregorio_clef_to_char(clef.clef), clef.line, + clef_flat_height(clef.clef, clef.line, clef.flatted), + gregorio_clef_to_char(clef.secondary_clef), clef.secondary_line, + clef_flat_height(clef.secondary_clef, clef.secondary_line, + clef.secondary_flatted)); +} + void gregoriotex_write_score(FILE *const f, gregorio_score *const score, const char *const point_and_click_filename) { @@ -4192,6 +4276,7 @@ void gregoriotex_write_score(FILE *const f, gregorio_score *const score, } /* LCOV_EXCL_STOP */ + write_largest_clef(f, score); fprintf(f, "\\GreScoreOpening{%%\n"); /* GreScoreOpening#1 */ if (score->first_voice_info) { gregoriotex_write_voice_info(f, score->first_voice_info); diff --git a/src/struct.h b/src/struct.h index ab59f0b00..71a8a74a0 100644 --- a/src/struct.h +++ b/src/struct.h @@ -384,8 +384,8 @@ typedef struct gregorio_extra_info { } gregorio_extra_info; typedef struct gregorio_clef_info { - unsigned char line; - unsigned char secondary_line; + signed char line; + signed char secondary_line; ENUM_BITFIELD(gregorio_clef) clef:1; bool flatted:1; ENUM_BITFIELD(gregorio_clef) secondary_clef:1; From d45a36bf59ecca6be928f4d1f342ac76355ada72 Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Sun, 31 Jul 2016 12:40:53 +0200 Subject: [PATCH 4/5] fix bug with first clef when initial --- tex/gregoriotex-spaces.tex | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tex/gregoriotex-spaces.tex b/tex/gregoriotex-spaces.tex index 3cda35fd2..860bae7c0 100644 --- a/tex/gregoriotex-spaces.tex +++ b/tex/gregoriotex-spaces.tex @@ -398,7 +398,12 @@ \fi% \gre@debugmsg{bolshift}{ clefwidthcurrent = \the\gre@dimen@clefwidth@current}% \gre@debugmsg{bolshift}{ clefwidthbol = \the\gre@dimen@clefwidth@bol}% - \global\advance\gre@skip@temp@three by \dimexpr(\gre@dimen@clefwidth@current-\gre@dimen@clefwidth@bol)\relax % + % we ignore the current-bol adjustment if the clef is the first of the score and there is an initial on one line: + \ifnum\gre@initiallines=1\ifgre@beginningofscore\else % + \global\advance\gre@skip@temp@three by \dimexpr(\gre@dimen@clefwidth@current-\gre@dimen@clefwidth@bol)\relax % + \fi\else % + \global\advance\gre@skip@temp@three by \dimexpr(\gre@dimen@clefwidth@current-\gre@dimen@clefwidth@bol)\relax % + \fi % \ifdim#1>0pt\relax% % no additional shift is needed if the notes start before the text \global\gre@dimen@bolshift = \gre@skip@temp@three\relax% From c37eb8a503567755aa4291e4d827522d10fe0643 Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Sun, 31 Jul 2016 15:54:23 +0200 Subject: [PATCH 5/5] fix docs --- doc/Command_Index_User.tex | 14 +++++++------- doc/Command_Index_internal.tex | 12 +++++++++++- tex/gregoriotex-signs.tex | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/doc/Command_Index_User.tex b/doc/Command_Index_User.tex index 3224f6649..6f9bf27cc 100644 --- a/doc/Command_Index_User.tex +++ b/doc/Command_Index_User.tex @@ -1017,15 +1017,15 @@ \subsubsection{End of Line Behavior} \end{argtable} \macroname{\textbackslash grelocalbolshiftcleftype}{\{\#1\}}{gregoriotex-spaces.tex} -Equivalent of \verb=\grebolshiftcleftype= but valid only until the next end of a score, and with more options. This can be used inside gabc for corner cases like different alignment on a score taking two pages. +Equivalent of \verb=\grebolshiftcleftype= but valid only until the next end of a score, and with more options. This can be used before a score or even inside a \verb=verbatim= in gabc for corner cases like different alignment on a score taking two pages. \begin{argtable} - \#1 & \texttt{largest} & same as in \verb=\grebolshiftcleftype=\\ - & \texttt{current} & idem\\ - & \texttt{f} & force left alignment of notes as if all clef were f clef\\ - & \texttt{c} & idem with c clef\\ - & \texttt{fb} & idem with flatted f clef\\ - & \texttt{cb} & idem with flatted c clef\\ + \#1 & \texttt{largest} & The notes are aligned as if all clefs had the width of the largest clef (default)\\ + & \texttt{current} & The notes are aligned on the current clef, which leads to unaligned notes\\ + & \texttt{f} & Force left alignment of notes as if all clef were f clef\\ + & \texttt{c} & Idem with c clef\\ + & \texttt{fb} & Idem with flatted f clef\\ + & \texttt{cb} & Idem with flatted c clef\\ \end{argtable} \macroname{\textbackslash gresetlastline}{\{\#1\}}{gregoriotex-main.tex} diff --git a/doc/Command_Index_internal.tex b/doc/Command_Index_internal.tex index 8176679db..8b4a28f6f 100644 --- a/doc/Command_Index_internal.tex +++ b/doc/Command_Index_internal.tex @@ -790,6 +790,10 @@ \section{Gregorio\TeX{} Controls} \#8 & integer & if \texttt{3}, it means that we must not put a flat after the secondary clef, otherwise it’s the height of the flat\\ \end{argtable} +\macroname{\textbackslash gre@boxclef}{\#1\#2\#3\#4\#5\#6\#7\#8\#9}{gregoriotex-signs.tex} +Macro filling \verb=\gre@box@temp@width= with a clef. The arguments are the same as \verb=gre@typeclef=. + + \macroname{\textbackslash gre@typesingleclef}{\#1\#2\#3\#4}{gregoriotex-signs.tex} Macro which typesets a single clef. @@ -1810,9 +1814,15 @@ \subsection{Distances} \macroname{\textbackslash gre@dimen@morawidth}{}{gregoriotex-spaces.tex} Width of a punctum mora (reinitialized at each score, lazily recomputed). -\macroname{\textbackslash gre@dimen@clefwidth}{}{gregoriotex-spaces.tex} +\macroname{\textbackslash gre@dimen@clefwidth@current}{}{gregoriotex-spaces.tex} Width of the current clef. +\macroname{\textbackslash gre@dimen@clefwidth@largest}{}{gregoriotex-spaces.tex} +Width of the largest clef in the score. + +\macroname{\textbackslash gre@dimen@clefwidth@bol}{}{gregoriotex-spaces.tex} +Width of the clef used to compute bolshift. + \macroname{\textbackslash gre@dimen@constantglyphraise}{}{gregoriotex-spaces.tex} Dimension representing the space between the 0 of the gregorian fonts and the effective 0 of the TeX score. diff --git a/tex/gregoriotex-signs.tex b/tex/gregoriotex-signs.tex index e6bf50f1e..0caf74b17 100644 --- a/tex/gregoriotex-signs.tex +++ b/tex/gregoriotex-signs.tex @@ -142,7 +142,7 @@ ]% }% -%% marcro to define the clef that will appear at the beginning of the lines +%% macro to define the clef that will appear at the beginning of the lines %% #1 c or f: type of first clef %% #2 int: line of first clef %% #3 int: 0 if not space, 1 if normal space, 2 for short space