I was building on egreg's solution to this question to provide missing accented characters for my document. I also added accsupp to make sure that the text is searchable.
Unfortunately, there seems to be a problem with accsupp and microtype:
\documentclass{article}
\usepackage{microtype}
\usepackage{fontspec}
\usepackage{newunicodechar}
\usepackage{accsupp}
\makeatletter \let\d\relax \DeclareRobustCommand{\d}[1]
{\hmode@bgroup
\o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-1ex}.\hidewidth}\egroup}
\let\.\relax
\makeatother
\newunicodechar{Ḍ}{%
\BeginAccSupp{method=hex,unicode,ActualText=1e0c}%
\d{D}%
\EndAccSupp{}%
}
\begin{document}
Ḍ
\end{document}
Not that the MWE works flawlessy, if microtype is commented out. With microtype enabled, it breaks.
accsupp. A simple\newunicodechar{Ḍ}{\d{D}}does not seem to bothermicrotype.\AtBeginDocumentdoes indeed fix the problem though. – Simifilm Oct 22 '18 at 11:04