diff options
author | Karl Berry <karl@freefriends.org> | 2017-07-03 20:59:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-07-03 20:59:09 +0000 |
commit | a01052959998f1f29c55dcd9546885027e07d082 (patch) | |
tree | 79cb394631ca36df9497e87babe5b32b2e01067c /Master/texmf-dist/doc/lualatex | |
parent | c8e87353c6f27a916b9d01e200bc3a7c0b75f1f6 (diff) |
combofont (3jul17)
git-svn-id: svn://tug.org/texlive/trunk@44746 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/lualatex')
-rw-r--r-- | Master/texmf-dist/doc/lualatex/combofont/README.md | 3 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.pdf | bin | 0 -> 14675 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.tex | 132 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/combofont/combofont.pdf | bin | 86024 -> 78359 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/combofont/combofont.tex | 33 |
5 files changed, 164 insertions, 4 deletions
diff --git a/Master/texmf-dist/doc/lualatex/combofont/README.md b/Master/texmf-dist/doc/lualatex/combofont/README.md index 6c7cc78f50e..725d81a1525 100644 --- a/Master/texmf-dist/doc/lualatex/combofont/README.md +++ b/Master/texmf-dist/doc/lualatex/combofont/README.md @@ -2,7 +2,7 @@ An EXPERIMENTAL package to add nfss-declaration of combo fonts to a luaLaTeX document -Version 0.1 Ulrike Fischer 2017- +Version 0.2 copyright Ulrike Fischer 2017- ## License @@ -14,6 +14,7 @@ LATEX Project Public License 1.3c. - Readme.md (this file) - combofont.sty (the sty) - combofont.tex, combofont.pdf (the docu and example) +- combofont-test-fira-math.tex and pdf (and example for math) ## Installation diff --git a/Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.pdf b/Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.pdf Binary files differnew file mode 100644 index 00000000000..3e54fe2ea11 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.pdf diff --git a/Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.tex b/Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.tex new file mode 100644 index 00000000000..0cc437d5ae4 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.tex @@ -0,0 +1,132 @@ +% !Mode:: "TeX:DE:UTF-8:Main" + +\documentclass[parskip=full]{scrartcl} + +\usepackage{luacode} + +%As a test I patch the FraktionNumeratorShift by a large value +% and add it to the luaotfload patch_font callback: +\begin{luacode} + +local patch_texgyrepagellamath = function (fontdata) + local mathconstants = fontdata.MathConstants + if mathconstants and fontdata.psname == "TeXGyrePagellaMath-Regular" + then + mathconstants.FractionNumeratorDisplayStyleShiftUp=5.5*mathconstants.FractionNumeratorDisplayStyleShiftUp + mathconstants.FractionNumeratorShiftUp=5.5*mathconstants.FractionNumeratorShiftUp + end +end + + +luatexbase.add_to_callback + ( + "luaotfload.patch_font", + patch_texgyrepagellamath, + "change_texgyrepagellamath" + ) +\end{luacode} + +\usepackage{unicode-math} +\usepackage{combofont} + +\setmainfont{Fira Sans} + + +\setupcombofont{FiraMath} + {% + file:texgyrepagella-math.otf:mode=base;script=math;language=DFLT; at #1pt, + file:firasans-light.otf at #1pt, + file:firasans-lightitalic.otf at #1pt + } + {% + {}, + 0x30-0x39, + 0x61-0x7A + } + +\setupcombofont{FiraMathScript} + {% + file:texgyrepagella-math.otf:mode=base;script=math;language=DFLT;+ssty=0 at #1pt, + file:firasans-regular.otf at #1pt, + file:firasans-regularitalic.otf at #1pt + } + {% + {}, + 0x30-0x39, + 0x61-0x7A + } + +\setupcombofont{FiraMathScriptScript} + {% + file:texgyrepagella-math.otf:mode=base;script=math;language=DFLT;+ssty=1 at #1pt, + file:firasans-semibold.otf at #1pt, + file:firasans-semibolditalic.otf at #1pt + } + {% + {}, + 0x30-0x39, + 0x61-0x7A + } + +% Mathversion bold need Script and ScriptScript declarations too! +\setupcombofont{FiraMathBold} + {% + file:texgyrepagella-math.otf:mode=base;script=math;language=DFLT; at #1pt, + file:firasans-regular.otf at #1pt, + file:firasans-regularitalic.otf at #1pt + } + {% + {}, + 0x30-0x39, + 0x61-0x7A + } + + +\DeclareFontFamily{TU}{FiraMath}{} +\DeclareFontShape {TU}{FiraMath}{m}{n} + { + <-7> combo*FiraMathScriptScript + <7-10>combo*FiraMathScript + <10-> combo*FiraMath + }{} + +\DeclareFontShape {TU}{FiraMath}{bx}{n} {<->combo*FiraMathBold}{} + +% better start with a real math font, so that +% unicode sets everything up +\setmathfont{TeX Gyre Pagella Math}% + +% Perhaps some other symbol fonts will need setup too +\SetSymbolFont{operators}{normal}{TU}{FiraMath}{m}{n} +\SetSymbolFont{operators}{bold}{TU}{FiraMath}{bx}{n} + + +% Map a etc to the ascii range. Original values can be found with +% [\Umathcharclass `\a] [\Umathcharfam `\a] [\Umathcharslot `\a] + +\Umathcode `\a = "7 "0 "61 +\Umathcode `\b = "7 "0 "62 +\Umathcode `\c = "7 "0 "63 +\Umathcode `\d = "7 "0 "64 +\Umathcode `\e = "7 "0 "65 +\Umathcode `\f = "7 "0 "66 +\Umathcode `\g = "7 "0 "67 +\Umathcode `\h = "7 "0 "68 + + +\begin{document} + +\minisec{Test some symbols} + +$123 - a^{a^a} + 1^{1^1} abc = \sqrt{hhhhhhhhhhh}$ + +\minisec{Test patching} + +$\frac{1}{9}$ + +\minisec{Test math version} + +\mathversion{bold} +$123 - a^{a^a} + 1^{1^1} abc = \frac{1}{9} $ + +\end{document} diff --git a/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf b/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf Binary files differindex cc161245f36..0a1d94e01e9 100644 --- a/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf +++ b/Master/texmf-dist/doc/lualatex/combofont/combofont.pdf diff --git a/Master/texmf-dist/doc/lualatex/combofont/combofont.tex b/Master/texmf-dist/doc/lualatex/combofont/combofont.tex index 5cb4dece757..6c098b87e10 100644 --- a/Master/texmf-dist/doc/lualatex/combofont/combofont.tex +++ b/Master/texmf-dist/doc/lualatex/combofont/combofont.tex @@ -68,7 +68,9 @@ After trying around a bit and then asking a question (https://tex.stackexchange. It is not meant as a production package but as package that helps to exploit the use of combo fonts. \section{Requirements} -You need at least an up-to-date TeXLive 2016. TeXLive 2017 with luatex 1.0.4. or a current miktex is better. +You need at least an up-to-date TeXLive 2016. TeXLive 2017 with luatex 1.0.4. or a current miktex is better. + +\textbf{Change Version 0.2, 3.7.2017}: The style no longer loads the now obsolete \texttt{l3regex}, it assumes that it is loaded by \texttt{expl3}. In older \TeX-systems you will have to load the package. \section{Using combo fonts} @@ -102,7 +104,9 @@ To be able to use a combo font with standard \LaTeX\ font commands you have to d \begin{description} \item[Order of the fonts] The first font is the main font which will receive the glyphs. So think carefully which font is should be and setup its font features correctly. \package{combofont} defines as a helper command \verb+\combodefaultfeat+ which sets \texttt{mode=node;script=latn;language=DFLT;+tlig;}. -\item[Size declaration] The font description should end with a size declaration line \verb+at #1pt+. When processing the font \verb+#1+ will be replaced by the current font size. As you can see in the second font you can do calculations. +\item[Size declaration] The font description should end with a size declaration line \verb+at #1pt+. When processing the font \verb+#1+ will be replaced by the current font size. As you can see in the second font you can do calculations. \emph{Don't forget the size declaration!} + +\item Be careful with the commas: there shouldn't be one after the last font. \end{description} \item[\marg{comma list of ranges and code-points}] This is a comma list of settings which describe which glyphs are taken from the respective font. Example: @@ -140,7 +144,7 @@ The important point is the size-function \verb+combo*+ which does all the work. \section{Demonstration} -\verb+\fontfamily{combotest}\selectfont+: +\verb+\fontfamily{combotest}\selectfont+: \fontfamily{combotest}\selectfont Some Text with Capital Words! Eh bien, mon prince. Gênes et Lueques ne sont plus que des @@ -171,6 +175,29 @@ apanages, des поместья, de la famille Buonaparte? % \normalfont\normalsize + +\section{About Math (new in version 0.2)}\enlargethispage{2\baselineskip} + +Combofonts can also be used in math. There is a test file called \texttt{combofont-test-fira-math.tex} which shows how one can combine \textsf{TeX Gyre Pagella Math} with the \textsf{Fira Sans} textfont. It also shows how one can patch the font to adjust values of the math table. + +\minisec{Important points:} +\begin{enumerate} +\item This a first try to get something working in math. It is in no way finished or complete, I'm rather certain that something will be missing or even faulty. +\item Start with a real math font with a math constants table. +\item Don't expect to get a perfect sans serif math font this way without work. It can take quite some time to adjust everything. Also a text font is not really meant to be used as math font. +\item The lua-code for the font patch compares \texttt{fontdata.psname} with the string \\\texttt{TeXGyrePagellaMath-Regular} to restrict the patch to the specific font. + + The font name database of luaotfload-names.lua contains for \textsf{TeX Gyre Pagella Math} these entries: + + \begin{verbatim} + ["plainname"]="TeXGyrePagellaMath-Regular", + ["psname"]="texgyrepagellamathregular", + \end{verbatim} + + As you can see the correct string for the comparision with \texttt{fontdata.psname} is in \verb+["plainname"]+ and not in \verb+["psname"]+. Don't ask me why. \texttt{luaotfload} seems to copy the infos around quite a lot. So when adapting the code to other fonts, test with various font names if it seems not to work. +\end{enumerate} + + \section{Remarks and open questions} As mentioned in the introduction a combo font only pulls in glyphs. This has a lot of (not all yet understood or seen) side effects. Here a few things that should be considered when building a combo font: |