# Khmer script fails to render in parentheses

I'm creating a document where the main script is Roman but I switch inline to Khmer (Cambodian) using \ucharclasses. (Typesetting with XeLaTeX.) This works charmingly, unless I put the Khmer text in parentheses, square brackets, or quotation marks. Here's a MWE:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\newfontfamily\khmerfamily[Scale=0.8,Script=Khmer]{Khmer Mondulkiri}
\usepackage[Khmer]{ucharclasses}
\setTransitionTo{Khmer}{\khmerfamily}
\setTransitionFrom{Khmer}{\rmfamily}
\begin{document}
Here is a bit of text, ហើយ​អាហ្នឹង​ជាឃ្លាសសេ​ជា​អក្សរ​ខ្មែរ​ដែ។ But if I put a Khmer word in parentheses (អញ្ចឹង) or square brackets [អញ្ចឹង], or quotation marks អញ្ចឹង'  អញ្ចឹង'', it doesn't typeset properly. In the middle of a sentence កណ្ដាល it's fine.
\end{document}


And here's the output:

Any input would be appreciated. (I confess to not actually understanding how ucharclasses works — it's altogether a black box to me.)

You need to load/activate more settings by using the Latinoption:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\newfontfamily\khmerfamily[Scale=0.8,Script=Khmer]{Khmer Mondulkiri}
\usepackage[Latin,Khmer]{ucharclasses}

\setTransitionTo{Khmer}{\khmerfamily}
\setTransitionFrom{Khmer}{\rmfamily}
\begin{document}
Here is a bit of text, ហើយ​អាហ្នឹង​ជាឃ្លាសសេ​ជា​អក្សរ​ខ្មែរ​ដែ។ But if I put a Khmer word in parentheses (អញ្ចឹង) or square brackets [អញ្ចឹង], or quotation marks អញ្ចឹង'  អញ្ចឹង'', it doesn't typeset properly. In the middle of a sentence កណ្ដាល it's fine.
\end{document}


• Fantastic. Thanks for quickly providing a simple solution. – viverechristus Mar 16 '17 at 0:41