diff options
author | Karl Berry <karl@freefriends.org> | 2013-09-18 23:01:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-09-18 23:01:10 +0000 |
commit | 59e14ca1cb8dc807d3a015e7dbf36e2133d6d820 (patch) | |
tree | 288b6f46ea293c419308726280909a0412bae824 /Master/texmf-dist/tex/lualatex/lilyglyphs/core | |
parent | 03b4781dee398a30d033aab5f007883e2f844ccc (diff) |
lilyglyphs (18sep13)
git-svn-id: svn://tug.org/texlive/trunk@31696 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/lilyglyphs/core')
5 files changed, 460 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/lualatex/lilyglyphs/core/README-core b/Master/texmf-dist/tex/lualatex/lilyglyphs/core/README-core new file mode 100644 index 00000000000..23286b05f8a --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/lilyglyphs/core/README-core @@ -0,0 +1,2 @@ +This folder contains the core functionality +of the lilyglyphs LaTeX package.
\ No newline at end of file diff --git a/Master/texmf-dist/tex/lualatex/lilyglyphs/core/dotted.inp b/Master/texmf-dist/tex/lualatex/lilyglyphs/core/dotted.inp new file mode 100644 index 00000000000..6b7b7f634b6 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/lilyglyphs/core/dotted.inp @@ -0,0 +1,114 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% This file is part of the 'lilyglyphs' LaTeX package. % +% ========== % +% % +% https://github.com/openlilylib/lilyglyphs % +% http://www.openlilylib.org/lilyglyphs % +% % +% Copyright 2012-2013 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% +} diff --git a/Master/texmf-dist/tex/lualatex/lilyglyphs/core/genericAccess.inp b/Master/texmf-dist/tex/lualatex/lilyglyphs/core/genericAccess.inp new file mode 100644 index 00000000000..095dd2de64a --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/lilyglyphs/core/genericAccess.inp @@ -0,0 +1,189 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% This file is part of the 'lilyglyphs' LaTeX package. % +% ========== % +% % +% https://github.com/openlilylib/lilyglyphs % +% http://www.openlilylib.org/lilyglyphs % +% % +% Copyright 2012-2013 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 the generic printing functionality % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% This is the internal command that actually prints the glyph(s)% +% Users aren't intended to use it directly % +% #1 are key-value options +% #2 the content to be printed +\newcommand*{\lilyPrint}[2][]{% + % interpret optional argument + \interpretLilyOptions{#1}% + % print the glyph in a raisebox + \raisebox{\lilyEffectiveRaise ex}{% + {\fontspec[Scale=\lilyEffectiveScale]{emmentaler-\lilyOpticalSuffix.otf}#2}% + }% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Helper functions for \lilyPrintImage below + +% Calculate the (point) ratio between the current font size +% and the size of \normalsize fonts. +% This is used to scale the output of \lilyPrintImage +% as images aren't scaled automatically with font size commands. +\makeatletter +\newcommand*{\currentFontRatio}{% + % store point size of current font + \xdef\currentFontSize{\f@size}% + {% + % Temporarily switch to normal size + \normalsize% + % and store normal point size + \xdef\normalFontSize{\f@size}% + }% + % Calculate ratio and store the value + \pgfmathsetmacro{\getCurrentFontRatio}{% + \currentFontSize / \normalFontSize}% +} +\makeatother + +% Apply the scaling factor that is necessary to +% accomodate the current font size. +% The accumulated scaling factor of the other sources +% is taken into account through \lilyEffectiveScale. +\newcommand*{\lilyScaleImage}{% + \currentFontRatio% + \pgfmathsetmacro{\lilyImageEffectiveScale}{% + \lilyEffectiveScale * \getCurrentFontRatio}% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Load 'glyph' from an image (preferrably PDF). % +% Used for items that are created using LilyPond itself % +% Users aren't intended to use it directly % +% #1 are key-value options +% #2 the content to be printed +\newcommand*{\lilyPrintImage}[2][]{% + % interpret optional argument + \interpretLilyOptions{#1}% + % determine scaling factor to accomodate the current font size + % (as images don't scale automatically with the font) + \lilyScaleImage% + % Print the image in a raisebox + \raisebox{\lilyEffectiveRaise ex}{% + \includegraphics[scale=\lilyImageEffectiveScale]{#2.pdf}% + }% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Generic command(s) to select a LilyPond Glyph % +% These shouldn't be used by end users but % +% for designing predefined commands. % +% They select a glyph by a specific method and % +% return the #2 to be passed to \lilyPrint % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Determine the glyph by its OpenType glyphName + +\usepackage{ifluatex,ifxetex} + +\ifluatex +\usepackage{luaotfload,luacode} +\begin{luacode} +documentdata = documentdata or { } + +local stringformat = string.format +local texsprint = tex.sprint +local slot_of_name = luaotfload.aux.slot_of_name + +documentdata.fontchar = function (chr) +local chr = slot_of_name(font.current(), chr, false) +if chr and type(chr) == "number" then +texsprint +(stringformat ([[\char"%X"]], chr)) +end +end +\end{luacode} + +\def\lilyGetGlyph#1{\directlua{documentdata.fontchar "#1"}} +\fi + +\ifxetex +\newcommand*{\lilyGetGlyph}[1]{\XeTeXglyph\XeTeXglyphindex"#1" } +\fi + +% Determine the glyph by its OpenType character number +% (these may change with new versions of the fonts!) +\newcommand*{\lilyGetGlyphByNumber}[1]{\char"#1 } + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Generic commands to print glyphs that aren't % +% covered by predefined commands yet. % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Print a glyph by its glyph name. % +% Glyph names have to be looked up % +% in the docs. % + +\newcommand*{\lilyGlyph}[2][]{% + % set defaults + \setkeys{lilyDesignOptions}{scale=1,raise=0}% + \lilyPrint[#1]{\lilyGetGlyph{#2}}% +} + +% Determine the glyph by its Unicode number +% (works for those glyphs that reside in 'standard' places) +\newcommand*{\lilyGlyphByNumber}[2][]{% + % set defaults + \setkeys{lilyDesignOptions}{scale=1,raise=0}% + \lilyPrint[#1]{\lilyGetGlyphByNumber{#2}}% +} + +% Don't 'determine' glyph positions but just use plain text. +% This works for dynamics letters, numbers and + - . , +\newcommand*{\lilyText}[2][]{% + % set defaults + \setkeys{lilyDesignOptions}{scale=1,raise=0}% + \lilyPrint[#1]{#2}% +} + +% Load 'glyph' from an image (preferrably PDF). +% Used for items that are created using LilyPond itself. +\newcommand*{\lilyImage}[2][]{% + % set defaults + \setkeys{lilyDesignOptions}{scale=1, raise=0}% + % interpret optional argument + \interpretLilyOptions{#1}% + \raisebox{\lilyEffectiveRaise ex}{% + \includegraphics[scale=\lilyEffectiveScale]{#2}% + }% +} diff --git a/Master/texmf-dist/tex/lualatex/lilyglyphs/core/keyval.inp b/Master/texmf-dist/tex/lualatex/lilyglyphs/core/keyval.inp new file mode 100644 index 00000000000..840bbacc366 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/lilyglyphs/core/keyval.inp @@ -0,0 +1,100 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% This file is part of the 'lilyglyphs' LaTeX package. % +% ========== % +% % +% https://github.com/openlilylib/lilyglyphs % +% http://www.openlilylib.org/lilyglyphs % +% % +% Copyright 2012-2013 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 the key-value functionality % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Define keys for keyval options +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\makeatletter + +%%%%%%%%%%%%%%%%%%%%%%%%%% +% Family lilyDesignOptions +% +% This family is used for defining default values for the options at design time +% i.e. when developping predefined commands. +\define@key{lilyDesignOptions}{scale}{\def\lilyDesignOptions@scale{#1}} +\define@key{lilyDesignOptions}{raise}{\def\lilyDesignOptions@raise{#1}} + +%%%%%%%%%%%%%%%%%%%%%%%%%% +% Family lilyGlobalOptions +% +% This family is used for globally adjusting the option values. +% The user can globally override options at any time +% using the command \lilyOptions. +% This is originally intended for cases where the package defaults +% are not very suitable for the font of the continuous text +\define@key{lilyGlobalOptions}{scale}{\def\lilyGlobalOptions@scale{#1}} +\define@key{lilyGlobalOptions}{raise}{\def\lilyGlobalOptions@raise{#1}} +% Initialize these \defs to 'no adjustment' because the user doesn't have to do that +\def\lilyGlobalOptions@scale{1} +\def\lilyGlobalOptions@raise{0} + +% Change any of the global options at any place in the document +% (only options that are present are affected) +\newcommand*{\lilyGlobalOptions}[1]{\setkeys{lilyGlobalOptions}{#1}} + +%%%%%%%%%%%%%%%%%%%%%%% +% Family lilyCmdOptions +% +% This family is used for options the end user can use to fine tune the output +% (i.e. within the actual document) +\define@key{lilyCmdOptions}{scale}{\def\lilyCmdOptions@scale{#1}} +\define@key{lilyCmdOptions}{raise}{\def\lilyCmdOptions@raise{#1}} + +% Calculate the effective option values from +% - global defaults, +% - design time defaults and +% - actual user options +% +% Scaling factors are multiplied. +% Raise levels are summed. +\newcommand*{\interpretLilyOptions}[1]{% + % initialize user arguments (no argument = no change) + % in order to avoid uninitialized arguments + \setkeys{lilyCmdOptions}{scale=1,raise=0}% + % Options that are present override the defaults + \setkeys{lilyCmdOptions}{#1}% + % calculate the scaling factor + \pgfmathsetmacro{\lilyEffectiveScale}{% + \lilyGlobalOptions@scale * \lilyCmdOptions@scale * \lilyDesignOptions@scale}% + % calculate the raise level from the design value and the optional user value + \pgfmathsetmacro{\lilyEffectiveRaise}{% + \lilyGlobalOptions@raise + \lilyCmdOptions@raise + \lilyDesignOptions@raise}% +} + +\makeatother + diff --git a/Master/texmf-dist/tex/lualatex/lilyglyphs/core/opticals.inp b/Master/texmf-dist/tex/lualatex/lilyglyphs/core/opticals.inp new file mode 100644 index 00000000000..83c39ede6e7 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/lilyglyphs/core/opticals.inp @@ -0,0 +1,55 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% This file is part of the 'lilyglyphs' LaTeX package. % +% ========== % +% % +% https://github.com/openlilylib/lilyglyphs % +% http://www.openlilylib.org/lilyglyphs % +% % +% Copyright 2012-2013 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 % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Define the used optical size font +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% The Emmentaler font comes in several optical sizes +% While these are originally intendes for use at different point sizes +% they are rather weights in the context of continuous text. +% +% Default to 16 (medium) +\def\lilyOpticalSuffix{16} +% The following command select from the available fonts +% and can be used anywhere in the document +% #1 is the suffix number of the font file +% and has to be on of the following: +% 11,13,14,16,18,20,23,26 +% Higher the number result in thinner glyphs +\newcommand{\lilyOpticalSize}[1]{\def\lilyOpticalSuffix{#1}} + |