
続く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 mathを改善するための私たちの試み)、生成します
ご覧のとおり、最初のケースではカーニングが適用されていますが、2 番目のケースでは適用されていません。2 番目のケースでも適切なカーニングを得るにはどうすればよいでしょうか。
さらに、fと}の間のカーニングを減らそうとすると、どこにも行き着きません。kern offsetに入力した値
結果の PDF は変更されません。
f と } の間のカーニングを調整する方法をご存知ですか?
$\sigma_0$
最後になりましたが、Fontforge を使用してカーニングを減らす方法をご存知ですか\[\sigma_0\]
? 現時点では、このカーニングは非常に大きいです...
編集: 以下マルセルの提案、私は良い解決策を探すのを諦め{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
あなたの 2 つの問題については、他の質問に対する私の回答を読んでください: 通常のカーニングは数学には適したツールではないので、通常は適用されません。LuaTeX が時々適用するのは、文字が数学であったことを TeX が認識しなくなったためと考えられます。イタリックf
体の修正が挿入された後、 とf
が}
直接続かなくなるため、カーニングは行われません。また、数式の表示では、LuaTeX はカーニングを必要とするものを見つけることを期待していないため、カーニングはスキップされます。
とにかく、最後の質問の方が興味深いです:
文字とその下付き文字の間のカーニングは、OpenType MathではMathカーニングと呼ばれます。https://docs.microsoft.com/en-us/typography/opentype/spec/math#mathkerninfo-table詳細については、 を参照してください。あなたの場合は、シグマを調整するだけで済みます。
FontForge で数式フォントを開きます。次に、[要素] -> [その他の情報] -> [数式情報] から数式関連のパラメータを変更できます。次のようなウィンドウが開きます。
「数式カーニング」を選択し、 を押して新しいグリフの数式カーニングを追加します。グリフの名前を入力します。この場合は「u1D70E」(数学イタリック小文字シグマ) です。次に、変更を押して値を調整します。
これにより、数学カーニングダイアログが表示されます。
新しいポイントを追加するには、「テキスト」に移動して「右下」を選択します。3 回押して 3 つのポイントを追加し、「グラフィック」に戻ります。ここで、右下の下のシグマをクリックして、このブロックを選択します。カーニング ポイントが表示され、適切な場所にドラッグできます。大まかに言うと、各ポイントは、下付き文字がこの高さまたはそれより低い高さに添付されている場合、この量のカーニングを取得する必要があることを意味します。たとえば、ポイントを次のように設定できます。
次に、「OK」をクリックし、もう一度「OK」をクリックしてフォントを生成します。
私がしたのと同じようにポイントを配置すると$\sigma_0$
、
もちろん、フォントを変更したくない場合は、LuaTeX では Lua コードを使用して数学カーニングを変更することもできます。
\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}