
繼續https://chat.stackexchange.com/rooms/97632/discussion- Between-marcel-kruger-and-mdayq6,運行 lualatex
\documentclass{article}
\usepackage{fontspec}
\usepackage{unicode-math}
% \setmathfont{texgyretermes-math.otf}
\setmathfont[Kerning=On]{TeXRygeTermesMath-Regular.otf}%%% same as Tex Gyre Termes Math, with an attempt to improve kerning
\begin{document}
\(\{f\}\)
\[
\{f\}
\]
\end{document}
字體是從哪裡取得的http://filebin.net/36gqo82z5evv2869(我們嘗試改進 tex gyre termes 數學),產生
正如我們所看到的,字距調整適用於第一種情況,但不適用於第二種情況。在第二種情況下如何才能獲得正確的字距調整?
此外,嘗試減少 f 和 } 之間的字距調整毫無結果:無論我在字距偏移中輸入哪個值
,產生的 PDF 保持不變。
關於如何調整 f 和 } 之間的字距調整有什麼想法嗎?
最後但並非最不重要的一點是,您知道如何減少 Fontforge 中的字距調整$\sigma_0$
和\[\sigma_0\]
使用 Fontforge 嗎?到目前為止,這個字距調整非常大...
編輯:以下馬塞爾的建議,我放棄了尋找好的解決方案{f}
並創建了一個帶有新字距的 TeX Ryge Termes Math 字體\sigma
改進斜體和\tau
數學模式下的正確下標。讓我們考慮一下輸入
\documentclass{article}
\pagestyle{empty}
\usepackage{unicode-math}
%\setmathfont[Ligatures=TeX]{TeX Gyre Termes Math}
\setmathfont[Ligatures=TeX]{TeXRygeTermesMath-Regular.otf} %%% Name changed to comply with the license. The shapes are (hopefully) the same, and the math kernings are new.
\begin{document}
\newcommand{\test}[1]{#1_{abc} #1_0^a #1^b_b #1_1^c #1^d_⊤ #1_⟂^e #1_T^f #1_k^g #1_{\mathup{k}}^h #1_{h}^j}
\newcommand{\testtest}{\test{\sigma}\test{\tau}}
\(\testtest\)
\[\testtest\]
\end{document}
使用原始的 Gyre 字體,上面會產生輸出
對於 xelatex 和
對於lualatex。
當使用字距調整的 Ryge 字體時,我們得到
當用 xelatex 編譯時
當用 lulatex 編譯。
使用新的 Ryge 字體,xelatex
在字距調整方面總體表現不錯,lualatex
除了下標「abc」之外,幾乎沒有在字距調整方面做任何工作。為什麼這樣?
認為有必要進一步改進:
稍微增加下標 ⊤ 的字距調整,
答案1
對於您的兩個問題,請閱讀我對您的另一個問題的回答:正常字距調整不是數學的正確工具,通常不會應用。 LuaTeX 有時確實會應用它,這可能是因為 TeX 不再知道這些字元曾經是數學。f
插入斜體校正後,因此f
和}
不會直接相互跟隨 -> 無字距調整。同樣在顯示數學中,LuaTeX 不希望找到需要字距調整的內容,因此會跳過字距調整。
無論如何,你的最後一個問題更有趣:
字元與其下標之間的字距調整在 OpenType Math 中稱為數學字距調整。看https://docs.microsoft.com/en-us/typography/opentype/spec/math#mathkerninfo-table了解詳情。在你的情況下,你只需要調整西格瑪。
在 FontForge 中開啟數學字體。然後您可以透過元素->其他資訊->數學資訊來變更數學相關參數。將會開啟一個像這樣的視窗:
選擇“Math Kern”並按下可為新字形新增數學字距調整。輸入您的字形名稱,在您的情況下為“u1D70E”(數學斜體小西格瑪)。然後按更改來調整值。
這將帶您進入“數學字距調整”對話框:
若要新增新點,請前往“文字”,然後選擇“右下角”。按三下新增三個點並返回“圖形”。點擊右下角下方的西格瑪以選擇該區塊。您的字距調整點將會出現,您可以將其拖曳到適當的位置。粗略地說,每個點都意味著如果下標附加在這個高度或更低的高度,那麼它應該得到這個字距調整量。例如,您可以這樣設定您的點:
現在按一下「確定」確認,再次按一下「確定」並產生字體。
如果您按照與我相同的方式放置積分,$\sigma_0$
則變為
當然,如果你不想改變你的字體,LuaTeX也允許你使用Lua程式碼改變mathkerns:
\documentclass{standalone}
\usepackage{unicode-math}
\usepackage{luacode}
\begin{luacode*}
-- First create a table specifying the mathkerns we want to set:
local mathkerns = {
["TeXGyreTermesMath-Regular"] = { -- This should be the PostScript name of the font
[0x1D70E] = { -- If the character would have a regular name, you could also use the glyphname here
bottomright = {
{height=0,kern=-175},
{height=216,kern=-76},
{kern=0},
},
},
},
}
local function initmathkern(tfmdata)
local values = mathkerns[tfmdata.properties.psname]
if not values then return end
for cp, value in next, values do
local tcp = type(cp)
if tcp == 'string' then
cp = tfmdata.resources.unicodes[cp]
end
local char = tfmdata.characters[cp]
if char then
local mathkern = char.mathkerns
if not mathkern then
mathkern = {}
char.mathkerns = mathkern
end
for corner, v in next, value do
mathkern[corner] = v
end
end
end
end
fonts.constructors.newfeatures'otf'.register{
name = 'mathkern',
description = 'Overwrite mathkern values',
initializers = {
base = initmathkern,
},
}
\end{luacode*}
\setmathfont[RawFeature=mathkern]{texgyretermes-math.otf}
\begin{document}
$\sigma_0$
\end{document}