I would like to change the font in XeLaTeX when I enter a new Unicode block with a certain Script (e.g. Devanagari for Hindi languages). The ucharclasses package seems to do exactly that.
However, when I leave the place where the different script is used and go back to what I had before (e.g. latin script) I loose the formatting (e.g. boldface) and the font size.
To illustrate, try this:
\documentclass[10pt,a5paper,DIV12,BCOR8.25mm,twoside,parskip=half]{scrreprt}
\usepackage[Devanagari]{ucharclasses}
\usepackage{xltxtra}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{Liberation Serif}
\setsansfont[Mapping=tex-text]{Liberation Sans}
\setmonofont[Mapping=tex-text]{Liberation Mono}
\newfontfamily\hindifont{Siddhanta}
\setTransitionsFor{Devanagari}{\hindifont}{\rm}
\begin{document}
\tableofcontents
\section{A latin script section}
Some latin script
\section{Devanagari: ताजा धनिया के साथ अनायास and so on}
A mixture \textbf{ of normal text and ताजा धनिया के साथ अनायास Devanagari script} in bold
\section{Some more latin script}
Some latin script
\end{document}
The output looks like this:

The \setTransitionTo correctly picks up the Devanagari script and changes the font to Siddhanta. However, when I come back to latin script, the boldface is gone and the fontsize is increased. The table of contents line shows the same problem.
N.B. \setTransitionsFor{...}{...}{...} is what the documentation describes as \setTransitions. The doc seems to be wrong.
{\bf text}. Use\textbf{text}instead. For reasons as to why, see thel2tabupackage. – Roelof Spijker Oct 21 '11 at 16:01\textbfbut that doesn't help. I also added some text to the section title to show the same problem appearing in the table of contents. – kongo09 Oct 21 '11 at 16:07