如何更改兩個特定字母之間的字距調整(從而創建連字)?

如何更改兩個特定字母之間的字距調整(從而創建連字)?

我正在使用 Minion Pro 字體製作文檔,該字體缺少“oo”連字(即 U+A74F:ꝏ)。因此,我想透過自動減少字母對「oo」之間的間距來人為地創建這個連字。我可以手動執行此操作並建立命令(例如\oo),但與其他連字的簡單性相比,這會非常煩人。

下面是我想要的效果,儘管創建起來很麻煩:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Minion Pro}

\begin{document}
    \Huge
    Bo\hspace{-.15em}ok\par Book
\end{document}

在此輸入影像描述

答案1

在這裡,我將其設為oactive,而您通常不希望這樣做,因此我提供\myligON\myligOFF限制其使用。

\documentclass{article}
\let\svO o
\newcommand\OOkern{\hspace{-.15em}}
\newcommand\myligON{\catcode`o=\active }
\newcommand\myligOFF{\catcode`o=11 }
{\catcode`o=\active \gdefo#1{\svO\ifxo#1\expandafter\OOkern\fi#1}}
\begin{document}
Book

\myligON Book hop \myligOFF
versus Book hop

\end{document}

在此輸入影像描述

答案2

我不會在任何地方都這樣做,只是為了在顯示尺寸的標題中產生特殊效果。但 Ulrike Fischer 解釋了字距調整法如何調整LuaTeX中的字型特性?做的工作:

% compile with lualatex
\documentclass{article}
\usepackage{fontspec}
\directlua{
 fonts.handlers.otf.addfeature{
   name = "oooh",
   type = "kern",
   data =
   {
     ["o"] = { ["o"] =  -175 },
   },
 }
}
\setmainfont{Minion Pro}[RawFeature=+oooh]
\begin{document}
Look at the old book in the nook.
\end{document}

輸出

答案3

一個XeTeX補充@ThereseLuaTeX答案的解決方案,利用該Interchartoks功能:

\documentclass{article}
\XeTeXinterchartokenstate = 1
\newXeTeXintercharclass \mycharclasso
\XeTeXcharclass `\o \mycharclasso
% between "o" and "o":
\XeTeXinterchartoks\mycharclasso\mycharclasso={\kern-2.5pt }
\usepackage{fontspec}
\setmainfont{Minion Pro}
\begin{document}
    \huge\centering Look at the old book in the nook.
\end{document}

連字文本

相關內容