这是一个极其简化的版本我的代码来自这个答案,我终于找到了解决这个问题的方法:
\documentclass{article}
\tracinglostchars=3 % Panic if a font does not contain the character we need.
\usepackage{ luacode, luatexbase }
\usepackage{fontspec}
\begin{luacode*}
fonts.handlers.otf.addfeature {
name = "xalt",
type = "chainsubstitution",
lookups = {
{
type = "substitution",
data = {
["sheva"] = "sheva_for_finalkaf",
["qamats"] = "qamats_for_finalkaf",
},
},
},
data = {
rules = {
{
before = { {"finalkaf"} },
current = { {"sheva", "qamats"} },
lookups = { 1 },
},
},
},
}
\end{luacode*}
% Taamey Ashkenaz and other Culmus fonts with Taamim are available, libre, at:
% https://culmus.sourceforge.io/taamim/index.html
% If you want Hebrew letters that slant from left to right rather than right
% to left, replace the ItalicFont= and BoldItalicFont= features with
% AutoFakeSlant = 0.15
\defaultfontfeatures[TaameyAshkenaz]{
UprightFont = *-Medium,
BoldFont = *-Bold,
ItalicFont = *-MediumOblique,
BoldItalicFont = *-BoldOblique,
Extension = .ttf }
% Uncommenting this line enables RawFeature={+xalt}:
%\setmainfont{TaameyAshkenaz}
\setmainfont{Latin Modern Roman}
\newfontfamily\AshkenazCustom{TaameyAshkenaz}[Script=Hebrew, RawFeature={-ccmp, +xalt}]
\newfontfamily\AshkenazDefault{TaameyAshkenaz}[Script=Hebrew, RawFeature={+ccmp, -xalt}]
\begin{document}
\begingroup\noindent
\AshkenazCustom
^^^^05da^^^^05b0 ^^^^05da^^^^05b8
\endgroup
\begingroup\noindent
\AshkenazDefault
^^^^05da^^^^05b0 ^^^^05da^^^^05b8
\endgroup
\end{document}
下面一行是正确的。xalt
字体功能旨在取代ccmp
(上下文组合和分解)功能中的一些替换,我需要关闭该功能。
但是,xalt
只有当字体是文档加载的第一个字体时,此功能才有效。无论它是作为\setmainfont
还是加载\newfontfamily
,或者\setmainfont
加载后是否发生变化,此功能都有效,但chainsubstitution
只有当它是第一个加载的字体时,此功能才有效。我测试过的其他功能类型ligature
和pair
不存在此问题。预计到达时间:但multiple
确实也一样。
我找不到任何关于此问题的警告我所知道的文档。 这是一个 Bug 吗?如果是,那是谁的 Bug?