As a sort of follow-up to these two questions, I'm interested in trying to fine-tune the output of transforming characters so they don't look too out-of-alignment. The main use-case of this (at present) is in typesetting documents utilising the dozenal or duodecimal numeral system. Whilst the desired characters are available in Unicode, they're nonexistent in virtually all fonts, so the character transforms are necessary for the time being.
What I'm after is twofold. Firstly, if the correct Unicode glyphs are available in the font, I don't want to perform the transformation/substitution. Secondly, and more importantly, if the transformation is performed, I want to avoid the awkward kerning keming I get with the transformed characters. How could the rendering be improved?
Here's a MWE. The initial code to get it working was shamelessly stolen from egreg's answer to the first linked question. The fonts aren't strictly necessary, but they're my preferred fonts in the documents I've been typing up, so improving how they look is quite important.
\documentclass{article}
\usepackage{fontspec}
\usepackage{microtype}
% Special characters for dozenal numerals
% newunicodechar and graphicx are needed to substitute and rotate the characters
\usepackage{newunicodechar}
\usepackage{graphicx}
\newcommand{\DeclareUnicodeCharacter}[2]{%
\begingroup\lccode`|=\string"#1\relax
\lowercase{\endgroup\newunicodechar{|}}{#2}%
}
\DeclareUnicodeCharacter{218A}{\turnedtwo}
\DeclareUnicodeCharacter{218B}{\turnedthree}
\makeatletter
\DeclareRobustCommand{\turnedtwo}{\make@turned{2}}
\DeclareRobustCommand{\turnedthree}{\make@turned{3}}
\newcommand{\make@turned}[1]{%
\raisebox{\depth}{\scalebox{-1}[-1]{#1}}%
}
\makeatother
\setmainfont{Linux Libertine O}[
Ligatures=TeX,
Numbers=Uppercase,
]
\setsansfont{Fira Sans}[
Ligatures=TeX,
Numbers=Uppercase,
Scale=MatchLowercase,
BoldFont={* SemiBold},
]
\setmonofont{Fira Mono}[
Ligatures=TeX,
Scale=MatchLowercase,
]
\begin{document}
\Huge
123456789↊↋0
\textit{123456789↊↋0}
\textbf{123456789↊↋0}
\textbf{\itshape 123456789↊↋0}
\sffamily 123456789↊↋0
\textit{123456789↊↋0}
\textbf{123456789↊↋0}
\textbf{\itshape 123456789↊↋0}
\end{document}


