+namespace {
+
+void drawLogo(PainterInfo & pi, InsetSpecialChar::Kind kind, int & x, int & y) {
+ FontInfo const & font = pi.base.font;
+ // FIXME: this definition of em is bogus, but there is a need
+ // for a big refactoring of the code around this issue anyway.
+ double const em = theFontMetrics(font).width('M');
+ switch (kind) {
+ case InsetSpecialChar::PHRASE_LYX:
+ /** Reference macro:
+ * \providecommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\\@};
+ */
+ x += pi.pain.text(x, y, from_ascii("L"), font);
+ x -= 0.16667 * em;
+ x += pi.pain.text(x, y + 0.25 * em, from_ascii("Y"), font);
+ x -= 0.125 * em;
+ x += pi.pain.text(x, y, from_ascii("X"), font);
+ break;
+
+ case InsetSpecialChar::PHRASE_TEX: {
+ /** Reference macro:
+ * \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@}
+ */
+ double const ex = theFontMetrics(font).ascent('x');
+ x += pi.pain.text(x, y, from_ascii("T"), font);
+ x -= 0.16667 * em;
+ x += pi.pain.text(x, y + 0.5 * ex, from_ascii("E"), font);
+ x -= 0.125 * em;
+ x += pi.pain.text(x, y, from_ascii("X"), font);
+ break;
+ }
+ case InsetSpecialChar::PHRASE_LATEX2E:
+ /** Reference macro:
+ * \DeclareRobustCommand{\LaTeXe}{\mbox{\m@th
+ * \if b\expandafter\@car\f@series\@nil\boldmath\fi
+ * \LaTeX\kern.15em2$_{\textstyle\varepsilon}$}}
+ */
+ drawLogo(pi, InsetSpecialChar::PHRASE_LATEX, x, y);
+ x += 0.15 * em;
+ x += pi.pain.text(x, y, from_ascii("2"), font);
+ x += pi.pain.text(x, y + 0.25 * em, char_type(0x03b5), font);
+ break;
+
+ case InsetSpecialChar::PHRASE_LATEX: {
+ /** Reference macro:
+ * \DeclareRobustCommand{\LaTeX}{L\kern-.36em%
+ * {\sbox\z@ T%
+ * \vbox to\ht\z@{\hbox{\check@mathfonts
+ * \fontsize\sf@size\z@
+ * \math@fontsfalse\selectfont
+ * A}%
+ * \vss}%
+ * }%
+ * \kern-.15em%
+ * \TeX}
+ */
+ x += pi.pain.text(x, y, from_ascii("L"), font);
+ x -= 0.36 * em;
+ FontInfo smaller = font;
+ smaller.decSize().decSize();
+ x += pi.pain.text(x, y - 0.2 * em, from_ascii("A"), smaller);
+ x -= 0.15 * em;
+ drawLogo(pi, InsetSpecialChar::PHRASE_TEX, x, y);
+ break;
+ }
+ default:
+ LYXERR0("No information for drawing logo " << kind);
+ }
+}
+
+}
+