%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % This file is part of the 'lilyglyphs' LaTeX package. % % ========== % % % % https://github.com/openlilylib/lilyglyphs % % http://www.openlilylib.org/lilyglyphs % % % % Copyright 2012-2020 Urs Liska and others, ul@openlilylib.org % % % % 'lilyglyphs' is free software: you can redistribute it and/or modify % % it under the terms of the LaTeX Project Public License, either % % version 1.3 of this license or (at your option) any later version. % % You may find the latest version of this license at % % http://www.latex-project.org/lppl.txt % % more information on % % http://latex-project.org/lppl/ % % and version 1.3 or later is part of all distributions of LaTeX % % version 2005/12/01 or later. % % % % This work has the LPPL maintenance status 'maintained'. % % The Current Maintainer of this work is Urs Liska (see above). % % % % This work consists of the files listed in the file 'manifest.txt' % % which can be found in the 'license' directory. % % % % This program is distributed in the hope that it will be useful, % % but WITHOUT ANY WARRANTY; without even the implied warranty of % % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This file is part of the lilyglyphs package % % and defines one subset of glyphs % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% % logic for dotted glyphs % %%%%%%%%%%%%%%%%%%%%%%%%%%% % Dot, e.g. necessary to create dotted notes \newcommand*{\lilyDot}[1][]{% \setkeys{lilyDesignOptions}{scale=1.5,raise=0}% \lilyPrint[#1]{\lilyGetGlyph{dots.dot}}% } \makeatletter % Calculate the space between a glyph and a dot % based on the 2nd order function % f(x) = (1/n * x^2) - 1/n + (m * x) - m + o % where % #1: scaling factor x % #2: curve factor n % #4 line steepness m % #3 offset o (offset of 0 results in a dotSpace of 0 at scale=1). % The result is supposed to be taken as ex and stored in \lilyDotSpaceF % which is used by \lilyDotSpace \newcommand*{\lilyCalcDotSpace}[4]{% \pgfmathsetmacro{\lilyDotSpaceF}{% #1 * #1% x^2 * #2 - #2% + #1 * #3 - #3 + #4}% } % Interpret the different options to be used for printing a dot % The optional arguments (passed as #1)given by the user are taken into account, % then the scaling and raise are calculated using the design options % from the calling predefined command. % Finally the space between the glyph and the dot is calculated using the % 2nd order function \lilyCalcDotSpace: % (1/n * scale^2) - 1/n + (1/m * scale) - 1/m + o % #2: curve factor n % #4 line steepness m % #3 offset o (offset of 0 results in a dotSpace of 0 at scale=1). \newcommand*{\lilySetDotOptions}[4][]{% % Initialize the user's command option in case he didn't provide them \setkeys{lilyCmdOptions}{scale=1,raise=0}% % process the optional argument to access the values \setkeys{lilyCmdOptions}{#1}% % calculate optional arguments for the dot, % based on "design options" and the given arguments \pgfmathsetmacro{\lilyDotScale}{\lilyCmdOptions@scale * \lilyDesignOptions@scale}% \pgfmathsetmacro{\lilyDotRaise}{\lilyCmdOptions@raise + \lilyDesignOptions@raise}% % calculate the space between the rest and the dot \lilyCalcDotSpace{\lilyCmdOptions@scale}{#2}{#3}{#4}% } \makeatother % Insert a space between a glyph and a dot % \lilyCalcDotSpace or better \lilySetDotOptions should have been called % immediately before \lilyDotSpace, % otherwise the result could be undefined \newcommand*{\lilyDotSpace}{\hspace*{\lilyDotSpaceF ex}} % Print the actual dot, % use the settings defined in \lilySetDotOptions \newcommand*{\lilyPrintDot}{\lilyDot[raise=\lilyDotRaise,scale=\lilyDotScale]} % Print another dot, for multiply dotted symbols. % It uses the dot settings from the previous command. % So if you encounter strange settings, make sure you have called % a predefined command of a dotted symbol immediately before. % If no predefined command has been called at all % you will see an error message because the key-value pairs % haven't been initialized yet. % It uses a different way to determine the space between dots. % It defaults to 0.25 ex, but you can optionally pass it % a number that is interpreted as ex. \newcommand*{\lilyPrintMoreDots}[1][0.25]{% \hspace*{#1 ex}\lilyPrintDot% }