| 1 |
% !Mode:: "TeX:DE:UTF-8:Main" |
| 2 |
%% Date 2017/07/03 Version 0.2 combofont example |
| 3 |
\documentclass[parskip=full]{scrartcl} |
| 4 |
|
| 5 |
\usepackage{luacode} |
| 6 |
|
| 7 |
%As a test I patch the FraktionNumeratorShift by a large value |
| 8 |
% and add it to the luaotfload patch_font callback: |
| 9 |
\begin{luacode} |
| 10 |
|
| 11 |
local patch_texgyrepagellamath = function (fontdata) |
| 12 |
local mathconstants = fontdata.MathConstants |
| 13 |
if mathconstants and fontdata.psname == "TeXGyrePagellaMath-Regular" |
| 14 |
then |
| 15 |
mathconstants.FractionNumeratorDisplayStyleShiftUp=5.5*mathconstants.FractionNumeratorDisplayStyleShiftUp |
| 16 |
mathconstants.FractionNumeratorShiftUp=5.5*mathconstants.FractionNumeratorShiftUp |
| 17 |
end |
| 18 |
end |
| 19 |
|
| 20 |
|
| 21 |
luatexbase.add_to_callback |
| 22 |
( |
| 23 |
"luaotfload.patch_font", |
| 24 |
patch_texgyrepagellamath, |
| 25 |
"change_texgyrepagellamath" |
| 26 |
) |
| 27 |
\end{luacode} |
| 28 |
|
| 29 |
\usepackage[math-style=upright]{unicode-math} |
| 30 |
\usepackage{combofont} |
| 31 |
|
| 32 |
\setmainfont{Fira Sans} |
| 33 |
|
| 34 |
|
| 35 |
\setupcombofont{FiraMath} |
| 36 |
{% |
| 37 |
file:texgyrepagella-math.otf:mode=base;script=math;language=DFLT; at #1pt, |
| 38 |
file:firasans-light.otf at #1pt, |
| 39 |
file:firasans-lightitalic.otf at #1pt |
| 40 |
} |
| 41 |
{% |
| 42 |
{}, |
| 43 |
0x30-0x39, |
| 44 |
0x61-0x7A*0x03B1-0x03C9 |
| 45 |
} |
| 46 |
|
| 47 |
\setupcombofont{FiraMathScript} |
| 48 |
{% |
| 49 |
file:texgyrepagella-math.otf:mode=base;script=math;language=DFLT;+ssty=0 at #1pt, |
| 50 |
file:firasans-regular.otf at #1pt, |
| 51 |
file:firasans-italic.otf at #1pt |
| 52 |
} |
| 53 |
{% |
| 54 |
{}, |
| 55 |
0x30-0x39, |
| 56 |
0x61-0x7A*0x03B1-0x03C9 |
| 57 |
} |
| 58 |
|
| 59 |
\setupcombofont{FiraMathScriptScript} |
| 60 |
{% |
| 61 |
file:texgyrepagella-math.otf:mode=base;script=math;language=DFLT;+ssty=1 at #1pt, |
| 62 |
file:firasans-semibold.otf at #1pt, |
| 63 |
file:firasans-semibolditalic.otf at #1pt |
| 64 |
} |
| 65 |
{% |
| 66 |
{}, |
| 67 |
0x30-0x39, |
| 68 |
0x61-0x7A*0x03B1-0x03C9 |
| 69 |
} |
| 70 |
|
| 71 |
% Mathversion bold need Script and ScriptScript declarations too! |
| 72 |
\setupcombofont{FiraMathBold} |
| 73 |
{% |
| 74 |
file:texgyrepagella-math.otf:mode=base;script=math;language=DFLT; at #1pt, |
| 75 |
file:firasans-regular.otf at #1pt, |
| 76 |
file:firasans-italic.otf at #1pt |
| 77 |
} |
| 78 |
{% |
| 79 |
{}, |
| 80 |
0x30-0x39, |
| 81 |
0x61-0x7A*0x03B1-0x03C9 |
| 82 |
} |
| 83 |
|
| 84 |
|
| 85 |
\DeclareFontFamily{TU}{FiraMath}{} |
| 86 |
\DeclareFontShape {TU}{FiraMath}{m}{n} |
| 87 |
{ |
| 88 |
<-7> combo*FiraMathScriptScript |
| 89 |
<7-10>combo*FiraMathScript |
| 90 |
<10-> combo*FiraMath |
| 91 |
}{} |
| 92 |
|
| 93 |
\DeclareFontShape {TU}{FiraMath}{bx}{n} {<->combo*FiraMathBold}{} |
| 94 |
|
| 95 |
% better start with a real math font, so that |
| 96 |
% unicode sets everything up |
| 97 |
\setmathfont{TeX Gyre Pagella Math}% |
| 98 |
|
| 99 |
% Perhaps some other symbol fonts will need setup too |
| 100 |
\SetSymbolFont{operators}{normal}{TU}{FiraMath}{m}{n} |
| 101 |
\SetSymbolFont{operators}{bold}{TU}{FiraMath}{bx}{n} |
| 102 |
|
| 103 |
|
| 104 |
% Map "a" etc to the ascii range. Original values can be found with |
| 105 |
%[\Umathcharclass `\a] [\Umathcharfam `\a] [\Umathcharslot `\a] |
| 106 |
% not needed because of math-style=upright |
| 107 |
%\Umathcode `\a = "7 "0 "61 |
| 108 |
|
| 109 |
|
| 110 |
\begin{document} |
| 111 |
|
| 112 |
\minisec{Test some symbols} |
| 113 |
|
| 114 |
$123 - a^{a^a} + 1^{1^1} abc = \sqrt{hhhhhhhhhhh}$ |
| 115 |
|
| 116 |
\minisec{Test patching} |
| 117 |
|
| 118 |
$\frac{1}{9}$ |
| 119 |
|
| 120 |
\minisec{Test math version} |
| 121 |
|
| 122 |
\mathversion{bold} |
| 123 |
$123 - a^{a^a} + 1^{1^1} abc = \frac{1}{9} $ |
| 124 |
|
| 125 |
\end{document} |