TypeWriter 字体对 polyglossia 包无效

TypeWriter 字体对 polyglossia 包无效

使用 XeLaTeX 引擎,MWE1 与 fontspec 和 ucharclasses 包配合得很好。但是当我将 fontspec 更改为 polyglossia (MWE2) 时,没有 TypeWriter 字体效果。此外,英文文本的第一句不是 Times New Roman 字体。有什么解决办法吗?

1型

\documentclass[11pt,a4paper]{article}
\usepackage{fontspec}
\newfontfamily\khmerfont[Script=Khmer,Scale=0.9]{Khmer OS}
\newfontfamily\khmerfonttt[Script=Khmer,Scale=0.9]{Khmer OS}
\newfontfamily\englishfont{Computer Modern Roman}
\usepackage{ucharclasses}
\setTransitionTo{Khmer}{\khmerfont}
\setTransitionFrom{Khmer}{\englishfont}
\usepackage{fancyvrb}
\begin{document}
\noindent What is wrong? តើមានអ្វីប្លែក? What is wrong? តើមានអ្វីប្លែក?
\begin{Verbatim}
What is wrong? តើមានអ្វីប្លែក? What is wrong? តើមានអ្វីប្លែក?
\end{Verbatim}
\end{document}

微波辐射计

\documentclass[11pt,a4paper]{article}
\usepackage{polyglossia}
\newfontfamily\khmerfont[Script=Khmer,Scale=0.9]{Khmer OS}
\newfontfamily\khmerfonttt[Script=Khmer,Scale=0.9]{Khmer OS}
\newfontfamily\englishfont{Computer Modern Roman}
\setdefaultlanguage[numerals=khmer]{khmer}
\setotherlanguage{english}
\usepackage{ucharclasses}
\setTransitionTo{Khmer}{\khmerfont}
\setTransitionFrom{Khmer}{\englishfont}
\usepackage{fancyvrb}
\begin{document}
\noindent What is wrong? តើមានអ្វីប្លែក? What is wrong? តើមានអ្វីប្លែក?
\begin{Verbatim}
What is wrong? តើមានអ្វីប្លែក? What is wrong? តើមានអ្វីប្លែក?
\end{Verbatim}
\end{document}

高棉操作系统字体http://www.khmeros.info/en/fonts

答案1

在这两种情况下,我都得到了错误的输出。至少在英文文本中,它们涉及更多的字体系列,因此您需要更复杂的字体更改。请尝试以下操作:

\documentclass[11pt,a4paper]{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\newfontfamily\khmerfont[Script=Khmer,Scale=0.9]{Khmer OS}
\setdefaultlanguage[numerals=khmer]{khmer}
\setotherlanguage{english}
\usepackage{ucharclasses}
\makeatletter
\setTransitionTo{Khmer}{%
 \global\let\orif@family\f@family
 \khmerfont}
\setTransitionFrom{Khmer}{%
 \fontfamily{\orif@family}\selectfont}
 \makeatother
\usepackage{fancyvrb}
\begin{document}
\noindent What is wrong? តើមានអ្វីប្លែក ? What is wrong? តើមានអ្វីប្លែក?
\begin{Verbatim}
What is wrong? តើមានអ្វីប្លែក? What is wrong? តើមានអ្វីប្លែក?
\end{Verbatim}
\end{document}

如果您有专用于高棉语的 tt 字体,您可以为当前系列添加一些测试。

在此处输入图片描述

相关内容