Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name font calibration distances #1526

Merged
merged 4 commits into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion tex/gregoriotex-main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1787,6 +1787,14 @@
\gre@trace@end%
}%

%% font calibration distances
\newdimen\gre@dimen@stafflinethicknessbase%
\newdimen\gre@dimen@glyphraisebase%
\newdimen\gre@dimen@interstafflinedistancebase%
\newdimen\gre@dimen@inclinatumonlinemoravshiftbase%
\newdimen\gre@dimen@inclinatumonlinemorahshiftbase%
\newdimen\gre@dimen@inclinatumofflinemorahshiftbase%

\def\gre@setgregoriofontscaled[#1]#2#3{%
\gre@trace{gre@setgregoriofontscaled[#1]{#2}{#3}}%
\IfStrEq{#2}{parmesan}{%%% OBSOLETE
Expand All @@ -1805,7 +1813,13 @@
\gdef\GreCPVirgaReversaAscendensOnDLine##1{\GreCPVirgaReversaLongqueueAscendens}%
\fi %
}%%% OBSOLETE
\relax %
% currently all fonts use the same calibration distances
\gre@dimen@stafflinethicknessbase=1500sp\relax %
\gre@dimen@glyphraisebase=-22000sp\relax%
\gre@dimen@interstafflinedistancebase=30000sp\relax%
\gre@dimen@inclinatumonlinemoravshiftbase=4500sp\relax%
\gre@dimen@inclinatumonlinemorahshiftbase=3700sp\relax%
\gre@dimen@inclinatumofflinemorahshiftbase=2500sp\relax%
\gre@trace@end%
}%

Expand Down
6 changes: 3 additions & 3 deletions tex/gregoriotex-signs.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1210,12 +1210,12 @@
% here we shift a bit left in the case where we have a punctum inclinatum on a line
\ifnum#4=1\relax %
\ifgre@isonaline %
\gre@dimen@temp@three=\dimexpr(3700sp * \gre@factor)\relax %
\gre@dimen@temp@three=\dimexpr(\gre@dimen@inclinatumonlinemorahshiftbase * \gre@factor)\relax %
\kern-\gre@dimen@temp@three %
\gre@dimen@temp@three=\dimexpr(4500sp * \gre@factor)\relax%
\gre@dimen@temp@three=\dimexpr(\gre@dimen@inclinatumonlinemoravshiftbase * \gre@factor)\relax%
\advance\gre@dimen@glyphraisevalue by -\gre@dimen@temp@three %
\else %
\gre@dimen@temp@three=\dimexpr(2500sp * \gre@factor)\relax %
\gre@dimen@temp@three=\dimexpr(\gre@dimen@inclinatumofflinemorahshiftbase * \gre@factor)\relax %
\advance\gre@dimen@glyphraisevalue by -\gre@dimen@temp@three %
\fi %
\fi %
Expand Down
28 changes: 11 additions & 17 deletions tex/gregoriotex-spaces.tex
Original file line number Diff line number Diff line change
Expand Up @@ -166,35 +166,29 @@

% Messing with the staff line thickness directly is messy, so we provide the following interface to make life easier on the user:
% stafflineheight is the height of a staff line
% = 1500 * stafflinefactor
% = gre@dimen@stafflinethicknessbase * stafflinefactor
\newdimen\gre@dimen@stafflineheight\relax%
\def\gre@calculate@stafflineheight{%
\gre@trace{gre@calculate@stafflineheight}%
\global\gre@dimen@stafflineheight=\dimexpr(1500 sp * \gre@stafflinefactor)\relax %
\global\gre@dimen@stafflineheight=\dimexpr(\gre@dimen@stafflinethicknessbase * \gre@stafflinefactor)\relax %
\gre@trace@end%
}%

% interstafflinespace is the space between two lines of staff
% = (30000 - (stafflineheight/gre@factor - 1500)) * gre@factor = 31500 * gre@factor - stafflineheight
% = (gre@dimen@interstafflinedistancebase + gre@dimen@stafflinethicknessbase) * gre@factor - gre@dimen@stafflinethicknessbase * gre@stafflinefactor
\newdimen\gre@dimen@interstafflinespace\relax%
\def\gre@calculate@interstafflinespace{%
\gre@trace{gre@calculate@interstafflinespace}%
\global\gre@dimen@interstafflinespace=\dimexpr((31500sp * \gre@factor) %
- \gre@dimen@stafflineheight)\relax%
\global\gre@dimen@interstafflinespace=\dimexpr((\gre@dimen@interstafflinedistancebase + \gre@dimen@stafflinethicknessbase) * \gre@factor - \gre@dimen@stafflinethicknessbase * \gre@stafflinefactor)\relax%
\gre@trace@end%
}%

% a distance to help place glyphs when the lines are not their default thickness
% = (stafflineheight/gre@factor - 1500sp)/2 * gre@factor
% = gre@dimen@stafflinethicknessbase * (gre@stafflinefactor - gre@factor) / 2
\newdimen\gre@dimen@stafflinediff\relax%
\def\gre@calculate@stafflinediff{%
\gre@trace{gre@calculate@stafflinediff}%
\global\gre@dimen@stafflinediff = \dimexpr(%
( ( ( \gre@dimen@stafflineheight %
/ \gre@factor)%
- 1500sp)%
/ 2)%
* \gre@factor)\relax%
\global\gre@dimen@stafflinediff = \dimexpr( \gre@dimen@stafflinethicknessbase * (\gre@stafflinefactor - \gre@factor) / 2 )\relax%
\gre@trace@end%
}%

Expand All @@ -217,7 +211,7 @@
% to calculate that, we take the bottom of the third line : it is at 200 in the fonts, and it must be at grespacelinestext + grespacebeneathtext + 2*greinterstafflinespace + 2*grestafflineheight + translationheight
\def\gre@calculate@constantglyphraise{%
\gre@trace{gre@calculate@constantglyphraise}%
\global\gre@dimen@constantglyphraise = \dimexpr((-22000 sp * \gre@factor) %
\global\gre@dimen@constantglyphraise = \dimexpr((\gre@dimen@glyphraisebase * \gre@factor) %
+ \gre@dimen@additionalbottomspace %
+ \gre@space@dimen@spacebeneathtext %
+ \gre@space@dimen@spacelinestext %
Expand Down Expand Up @@ -812,7 +806,7 @@
\fi%
\fi%
\global\advance\gre@count@temp@three by -8 %
\global\gre@dimen@glyphraisevalue = \dimexpr(15750 sp * \gre@factor * \gre@count@temp@three)\relax %
\global\gre@dimen@glyphraisevalue = \dimexpr(((\gre@dimen@interstafflinedistancebase + \gre@dimen@stafflinethicknessbase) / 2 ) * \gre@factor * \gre@count@temp@three)\relax %
\ifcase#2 %
\or\or\or%3: if it is a vertical episema on a line, we shift it a bit higher, so that it's more beautiful
\ifgre@isonaline%
Expand Down Expand Up @@ -996,21 +990,21 @@
\gre@num@max{#1}{\gre@pitch@cleftop}%
\gre@count@temp@one=\numexpr(\gre@count@temp@one - \gre@pitch@adjust@top - \gre@space@count@additionaltopspacethreshold)\relax %
\ifnum\gre@count@temp@one>0\relax %
\global\gre@dimen@additionaltopspace=\dimexpr(15750 sp * \gre@count@temp@one * \gre@factor)\relax %
\global\gre@dimen@additionaltopspace=\dimexpr(((\gre@dimen@interstafflinedistancebase + \gre@dimen@stafflinethicknessbase) / 2 ) * \gre@count@temp@one * \gre@factor)\relax %
\else %
\global\gre@dimen@additionaltopspace=0 sp%
\fi %
\gre@num@max{#1}{\gre@pitch@cleftop}%
\gre@count@temp@one=\numexpr(\gre@count@temp@one - \gre@pitch@adjust@top - \gre@space@count@additionaltopspacealtthreshold)\relax %
\ifnum\gre@count@temp@one>0\relax %
\global\gre@dimen@additionaltopspacealt=\dimexpr(15750 sp * \gre@count@temp@one * \gre@factor)\relax %
\global\gre@dimen@additionaltopspacealt=\dimexpr(((\gre@dimen@interstafflinedistancebase + \gre@dimen@stafflinethicknessbase) / 2 ) * \gre@count@temp@one * \gre@factor)\relax %
\else %
\global\gre@dimen@additionaltopspacealt=0 sp%
\fi %
\gre@num@max{#1}{\gre@pitch@cleftop}%
\gre@count@temp@one=\numexpr(\gre@count@temp@one - \gre@pitch@adjust@top - \gre@space@count@additionaltopspacenabcthreshold)\relax %
\ifnum\gre@count@temp@one>0\relax %
\global\gre@dimen@additionaltopspacenabc=\dimexpr(15750 sp * \gre@count@temp@one * \gre@factor)\relax %
\global\gre@dimen@additionaltopspacenabc=\dimexpr(((\gre@dimen@interstafflinedistancebase + \gre@dimen@stafflinethicknessbase) / 2 ) * \gre@count@temp@one * \gre@factor)\relax %
\else %
\global\gre@dimen@additionaltopspacenabc=0 sp%
\fi %
Expand Down