Bit of a niche question. There is a beautiful set of TrueType fonts called Chartwell designed for producing graphs from text. I am trying to get these to work in Latex. I have switched to Xe(La)tex, and can now get the fonts to appear. However I would like to change text colour without sequence of numbers being split into two. Best explained with some code and a picture.
\documentclass[13pt]{article}
\usepackage{fontspec}
\usepackage{xcolor}
% Now define your quick commands for switching fonts
\setmainfont{ChartwellRose}
\newfontfamily\cwrose[Ligatures=Rare, Color=blue]{ChartwellRose}
\begin{document}
\raggedright
Here is the text without ligatures
\fontsize{48}{60}
\selectfont
40+20+50
\rmfamily
\normalsize
Here is the text with ligatures
\cwrose
\fontsize{48}{60}
\selectfont
40+70
\rmfamily
\normalsize
Here is the text with a colour change inserted
\cwrose
\fontsize{48}{60}
\selectfont
40+\addfontfeature{Color=red}+70
\rmfamily
\normalsize
And as you can see the colour change has broken the effect of enabling the ligatures and the 'rose' is now presented as two separate objects (rather than a single object with 2 different colours.
\end{document}
Is it possible therefore to change the colour of a part of the text without the ligature formation being broken?
Here is a screenshot of the compiled example and here is a screenshot of unbroken form of the last example
\addfontfeaturejust defines a new font from the current one plus the requested features. Possible with LuaTeX though, if you are interested in LuaTeX solutions. – Khaled Hosny Feb 18 at 22:21