我目前正在尝试使用组合字体在 lualatex 中构建无衬线字体。为了进行测试,我使用 TeX Gyre Pagella Math 作为基础数学字体,并尝试从其他数学和文本字体中提取字形。
它已经适用于数字和字母,但现在我被积分卡住了。我可以使用 TeX Gyre Dejavu Math 的 textstyle 积分,但 displaystyle 积分是错误的。有人知道如何纠正这个问题吗?
(这是一个测试文件!所以它不会试图变得漂亮。例如,脚本样式字体使用其他权重,以便人们可以更好地看到组合是否有效)。
%needs lualatex!
\documentclass[parskip=full,fleqn]{scrartcl}
\usepackage[math-style=upright]{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,
file:texgyredejavu-math.otf at #1pt
}
{%
{},
0x30-0x39,
0x61-0x7A*0x03B1-0x03C9,
0x222B
}
\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,
file:texgyredejavu-math.otf at #1pt
}
{%
{},
0x30-0x39,
0x61-0x7A*0x03B1-0x03C9,
0x222B
}
\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,
file:texgyredejavu-math.otf at #1pt
}
{%
{},
0x30-0x39,
0x61-0x7A*0x03B1-0x03C9,
0x222B
}
% 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,
file:texgyredejavu-math.otf at #1pt
}
{%
{},
0x30-0x39,
0x61-0x7A*0x03B1-0x03C9,
0x222B
}
\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-math 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}
\begin{document}
\minisec{Test some symbols}
$\int f(x)^2$
\[\int f(x)^2 \]
\end{document}
答案1
如果你只是使用unicode-math
% better start with a real math font, so that
% unicode-math sets everything up
\setmathfont{TeX Gyre Pagella Math}%
因此删除所有组合字体,然后添加\showoutput
你看到的
.....\l_fontspec_font ∫
....\glue(\thinmuskip) 1.82497
....\l_fontspec_font f
对于文本样式\int f
,但是
.......\l_fontspec_font