由于某种原因,一些字体中缺少俄文字母ё
,这导致
warning (file c:/Users/mishk/OneDrive/Stuff/fonts/PTSerifPro-Regular.otf) (cff
): 'seac' character deprecated in type 2 charstring
! error: (file c:/Users/mishk/OneDrive/Stuff/fonts/PTSerifPro-Regular.otf) (cf
f): Type2 Charstring Parser: parsing charstring failed: (status=-1, stack=5)
! ==> Fatal error occurred, no output PDF file produced!
然而,用字母代替它总是可以接受的е
,但这段代码不起作用:
\newunicodechar{ё}{\iffontchar\font`ё ё\else{е}\fi}
\newunicodechar{Ё}{\iffontchar\font`Ё Ё\else{Е}\fi}
我可以自动替换吗没有宣称ё
自己是一个活跃角色?
完整的 LuaLaTeX MWE:
\documentclass{book}
\usepackage{polyglossia}
\usepackage{newunicodechar}
\setmainlanguage{russian}
\newcommand{\MyPath}{C:/Users/mishk/OneDrive/Stuff/fonts/}
\newfontfamily{\cyrillicfont}{PTSerifPro}[
Path = \MyPath,
Extension = .otf,
UprightFont = *-Regular,
]
\newunicodechar{ё}{\iffontchar\font`ё ё\else{е}\fi}
\newunicodechar{Ё}{\iffontchar\font`Ё Ё\else{Е}\fi}
\begin{document}
ааа еее ёёё
\end{document}
答案1
在 LuaTeX 中,您可以将自己的替换规则定义为字体功能,请参阅如何调整LuaTeX 中的字体功能?
\documentclass{article}
\usepackage{fontspec}
\directlua{
fonts.handlers.otf.addfeature {
name = "ediaeresis",
type = "substitution",
prepend = true,
data = {
["ё"] = "e",
["Ё"] = "Е",
}
}
}
\setmainfont{PT Serif}[RawFeature=+ediaeresis]
\begin{document}
ё Ё
\end{document}