I have defined a command (mapcommand) to convert a given text into another form. However, in article after using the command it changes the font below of it. I mean, the font remains Times New Roman until I use the command, after using the command it changes font to CharisSil to all the text below of it. I want to use CharisSil font only the text inside the command. I tried \DeclareTextFontCommand but not working properly. Please see the MWE below. Thank you. Compiler: XeLatex
\documentclass{article}\RequirePackage{CharisSIL}\newfontface\mapfnt{CharisSIL-R.ttf}\makeatletter\def\zztable#1{#1}\def\zzrow#1#2{\expandafter\gdef\csname B-#2\endcsname{#1}}\def\mapcommand#1{\mapfnt\xxconvert#1@}\def\xxconvert{\futurelet\tmp\xxxconvert}\def\xxxconvert{%\ifx\tmp\@sptoken\space\fi\xxxxconvert}\def\xxxxconvert#1{%\expandafter\ifx\csname B-#1\endcsname\relax?%\expandafter\show\csname B-#1\endcsname\fi\csname B-#1\endcsname\xxconvert}\expandafter\def\csname B-@\endcsname#1{}\input{maps}\makeatother\setmainfont{Times New Roman}\begin{document}The font of this line Times new roman as expected. \mapcommand{০১২৩৪} However, from here font changes after the use of the command.\end{document}
maps.text
\zztable{\zzrow{0}{০}\zzrow{1}{১}\zzrow{2}{২}\zzrow{3}{৩}\zzrow{4}{৪}}