Font based Distances

While GregorioTeX supports the use of the font based em and ex units when setting the values for distances, each font has 5 other spacing parameters associated with it and sometimes it may be useful to use one of those instead. These spacing parameters are accessed via the \fontdimen>int<\font interface in LaTeX where >int< is an integer between 1 and 7, inclusive (see this answer on tex.stackexchange.com for a description of all 7 spacing parameters). Using these spacing parameters is possible, but imposes some requirements on the way the distance is defined in order to link the two in a dynamic fashion:

  1. When using \fontdimen values in defining a GregorioTeX distance, they should be prepended by \the and can be combined or scaled using \dimexpr and \glueexpr (which also need to be prepended by \the when used).
  2. To prevent premature expansion, the entire value for the distance should be enclosed in \unexpanded.
  3. The distance should be defined as fixed relative to the staff size. If the distance is scalable then any link between the distance and the font distance will be broken if \grechangestaffsize is called.

Example 1:

\grechangedim{interwordspacetext}{\unexpanded{\the\fontdimen2\font}}{fixed}%

This definition for interwordspacetext will make it equal to the standard space for the font (i.e., what appears between words in the body text).

Example 2:

\grechangedim{interwordspacetext@euouae}{\unexpanded{\the\dimexpr(\the\fontdimen2\font * 8 / 10)\relax}}{fixed}%

This definition for interwordspacetext@euouae makes it 8/10th the size of standard space for the font.

This trick can also be adapted to create a partial (or complete) dependance of one distance on another:

Example 3:

Nota bene: Starting with version 4.2, this particular trick is no longer necessary as the inherited keyword can be used to link distances using \grechangedim directly.

\makeatletter
\grechangedim{interwordspacetext}{\unexpanded{\the\fontdimen2\font plus \the\gluestretch\gre@space@skip@interwordspacenotes minus \the\glueshrink\gre@space@skip@interwordspacenotes}}{fixed}%
\makeatother

Here we've used \gluestretch and \glueshrink to extract the stretch and shrink values from interwordspacenotes and assign them to the stretch and shrink values for interwordpsacetext. If interwordspacenotes is subsequently changed (say by calling \grechangestaffsize when it is set to be a scalable distance), then those changes will automatically propogate to interwordspacetext.

Nota Bene: When using this trick to link distances, don't forget the \makeatletter and \makeatother. If you leave them out, then LaTeX will have trouble reading the entire name of the internal macro where the distance is stored.

Works with Version:

4.1.1