summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-07-03 20:59:09 +0000
committerKarl Berry <karl@freefriends.org>2017-07-03 20:59:09 +0000
commita01052959998f1f29c55dcd9546885027e07d082 (patch)
tree79cb394631ca36df9497e87babe5b32b2e01067c /Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.tex
parentc8e87353c6f27a916b9d01e200bc3a7c0b75f1f6 (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/combofont/combofont-test-fira-math.tex')
-rw-r--r--Master/texmf-dist/doc/lualatex/combofont/combofont-test-fira-math.tex132
1 files changed, 132 insertions, 0 deletions
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}