\documentclass[a4paper,12pt]{article}
\usepackage[margin=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{ucs}
\usepackage{xltxtra}
\defaultfontfeatures{Mapping=tex-text}
\XeLaTeXlinebreaklocale "khm"
\XeLaTeXlinebreakskip =0pt plus 1pt minus 1pt
\setmainfont[Scale=0.84,Script=Khmer]{Khmer OS System}
\setmathrm{Time New Roman}
\newcommand{\en}{\fontspec{Time New Roman}\selectfont}
\newcommand{\kos}{\fontspec[Scale=0.84,Script=Khmer]{Khmer OS System}\selectfont}
\newcommand{\kml}{\fontspec[Scale=0.84,Script=Khmer]{Khmer OS Moul Light}\selectfont}
\begin{document}
សរសេរអត្ថបទនៅទីនេះ
\end{document}
答案1
\XeLaTeXlinebreaklocale
未定义,我假设您\XeTeXlinebreaklocale
也打算在 XeTeXlineskip 设置中使用一些不可见的零宽度空格字符。
对于我来说,这运行没有错误,除了由于我没有字体而出现字体错误。
\documentclass[a4paper,12pt]{article}
\usepackage[margin=2cm]{geometry}
%no \usepackage[T1]{fontenc}
%no \usepackage[utf8]{inputenc}
% avoid \usepackage{ucs}
% avoid \usepackage{xltxtra}
\usepackage{fontspec}
% default \defaultfontfeatures{Mapping=tex-text}
% typo\XeLaTeXlinebreaklocale "khm"
\XeTeXlinebreaklocale "khm"
%typo \XeLaTeXlinebreakskip also zero width spaces U+200B
% \XeTeXlinebreakskip 0pt plus 1pt minus 1pt
\XeTeXlinebreakskip = 0pt plus 1pt minus 1pt
\setmainfont[Scale=0.84,Script=Khmer]{Khmer OS System}
\setmathrm{Time New Roman}
\newcommand{\en}{\fontspec{Time New Roman}\selectfont}
\newcommand{\kos}{\fontspec[Scale=0.84,Script=Khmer]{Khmer OS System}\selectfont}
\newcommand{\kml}{\fontspec[Scale=0.84,Script=Khmer]{Khmer OS Moul Light}\selectfont}
\begin{document}
សរសេរអត្ថបទនៅទីនេះ
\end{document}