reflectbox in emphasis environment
The problem is that the italics (or slant) lean the text to the right, and when you reflect it, the lean is to the left. But you already figured this out.
Bruno Le Floch devised a neat \slantbox
command that applies a shear transform to a given object, so you can make a "reverse italics" then reflect the irony mark:
\documentclass{article}
\usepackage{graphicx}
\makeatletter
\newcommand{\slantbox}[2][.5]
{%
\mbox
{%
\sbox{\@tempboxa}{#2}%
\hskip\wd\@tempboxa
\pdfsave
\pdfsetmatrix{1 0 #1 1}%
\llap{\usebox{\@tempboxa}}%
\pdfrestore
}%
}
\newcommand\irony{%
\,%
\ifdim\the\fontdimen\@ne\font>\z@
% ↓--↓ Manually tuned
\reflectbox{\slantbox[-0.6]{?}}%
\else
\reflectbox{?}%
\fi
}
\makeatother
\begin{document}
\makeatletter
Roman : Lorem ipsum dolor\irony
Emphasis : \emph{Lorem ipsum dolor\irony}
Bold : \textbf{Lorem ipsum dolor\irony}
\end{document}
I also added a conditional to check if the current font shape is italicized or not.
Unfortunately this doesn't work for XeTeX, since the \slantbox
command uses pdfTeX primitives. It works for LuaTeX though :)
With TikZ you have engine independence.
\documentclass{article}
\usepackage{fontspec}
\usepackage{newunicodechar}
\usepackage{graphicx}
\usepackage{tikz}
\setmainfont{CMU Serif}
\newfontfamily{\dejavu}{DejaVu Serif}
\makeatletter
\newunicodechar{⸮}{%
\iffontchar\font`⸮
⸮%
\else
\ifdim\fontdimen1\font=\z@
\tikz[baseline=(?.base),inner sep=0pt,outer sep=0pt]\node[xscale=-1] (?) {?};%
\else
\tikz[baseline=(?.base),inner sep=0pt,outer sep=0pt]\node[xscale=-1,xslant=-0.5] (?) {?};%
\kern-0.35em
\fi
\fi
}
\makeatother
\begin{document}
\setlength{\fboxsep}{0pt} % for showing the bounding boxes
dolor⸮?
\textit{dolor⸮?} \fbox{\itshape ⸮} \fbox{\itshape ?}
\dejavu
dolor⸮?
\textit{dolor⸮?}
\end{document}
The real character is used if available.
You can use a custom version of reflectbox which also applies some slant to fit with the current font:
\documentclass{minimal}
\makeatletter
\newcommand\REflectwithslant{%
\hskip\wd0
\wd0=0pt
\pdfsave
\pdfsetmatrix{%
-1 0
\strip@pt\dimexpr2\fontdimen1\font\relax\space 1%
}%
\box0
\pdfrestore
\endgroup
}
\newcommand\Reflectwithslant{\aftergroup\REflectwithslant}
\newcommand\reflectwithslant{\begingroup\afterassignment\Reflectwithslant\setbox0\hbox}
\makeatother
\newcommand\irony{\,\reflectwithslant{?}}
\begin{document}
Roman : Lorem ipsum dolor\irony
Emphasis : \emph{Lorem ipsum dolor\irony}
Bold : \textbf{Lorem ipsum dolor\irony}
\end{document}