+docstring InsetSpecialChar::toolTip(BufferView const &, int, int) const
+{
+ docstring message;
+ switch (kind_) {
+ case ALLOWBREAK:
+ message = from_ascii("Optional Line Break (ZWSP)");
+ break;
+ case LIGATURE_BREAK:
+ message = from_ascii("Ligature Break (ZWNJ)");
+ break;
+ case END_OF_SENTENCE:
+ message = from_ascii("End of Sentence");
+ break;
+ case HYPHENATION:
+ message = from_ascii("Hyphenation Point");
+ break;
+ case SLASH:
+ message = from_ascii("Breakable Slash");
+ break;
+ case NOBREAKDASH:
+ message = from_ascii("Protected Hyphen (SHY)");
+ break;
+ case LDOTS:
+ case MENU_SEPARATOR:
+ case PHRASE_LYX:
+ case PHRASE_TEX:
+ case PHRASE_LATEX2E:
+ case PHRASE_LATEX:
+ // no tooltip for these ones.
+ break;
+ }
+ return message;
+}
+
+
+int InsetSpecialChar::rowFlags() const
+{
+ switch (kind_) {
+ case ALLOWBREAK:
+ case HYPHENATION:
+ case SLASH:
+ // these are the elements that allow line breaking
+ return CanBreakAfter;
+ case NOBREAKDASH:
+ case END_OF_SENTENCE:
+ case LIGATURE_BREAK:
+ case LDOTS:
+ case MENU_SEPARATOR:
+ case PHRASE_LYX:
+ case PHRASE_TEX:
+ case PHRASE_LATEX2E:
+ case PHRASE_LATEX:
+ break;
+ }
+ return Inline;
+}
+
+
+namespace {
+
+// helper function: draw text and update x.
+void drawChar(PainterInfo & pi, int & x, int const y, char_type ch)
+{
+ FontInfo font = pi.base.font;
+ font.setPaintColor(pi.textColor(font.realColor()));
+ pi.pain.text(x, y, ch, font);
+ x += theFontMetrics(font).width(ch);
+}
+
+
+void drawLogo(PainterInfo & pi, int & x, int const y, InsetSpecialChar::Kind kind)
+{
+ FontInfo const & font = pi.base.font;
+ int const em = theFontMetrics(font).em();
+ switch (kind) {
+ case InsetSpecialChar::PHRASE_LYX:
+ /** Reference macro:
+ * \providecommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\\@};
+ */
+ drawChar(pi, x, y, 'L');
+ x -= em / 6;
+ drawChar(pi, x, y + em / 4, 'Y');
+ x -= em / 8;
+ drawChar(pi, x, y, 'X');
+ break;
+
+ case InsetSpecialChar::PHRASE_TEX: {
+ /** Reference macro:
+ * \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@}
+ */
+ int const ex = theFontMetrics(font).xHeight();
+ drawChar(pi, x, y, 'T');
+ x -= em / 6;
+ drawChar(pi, x, y + ex / 2, 'E');
+ x -= em / 8;
+ drawChar(pi, x, y, 'X');
+ 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, x, y, InsetSpecialChar::PHRASE_LATEX);
+ x += 3 * em / 20;
+ drawChar(pi, x, y, '2');
+ // ε U+03B5 GREEK SMALL LETTER EPSILON
+ drawChar(pi, x, y + em / 4, char_type(0x03b5));
+ 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}
+ */
+ drawChar(pi, x, y, 'L');
+ x -= 9 * em / 25;
+ PainterInfo pi2 = pi;
+ pi2.base.font.decSize().decSize();
+ drawChar(pi2, x, y - em / 5, 'A');
+ x -= 3 * em / 20;
+ drawLogo(pi, x, y, InsetSpecialChar::PHRASE_TEX);
+ break;
+ }
+ default:
+ LYXERR0("No information for drawing logo " << kind);
+ }
+}
+
+} // namespace
+
+
+void InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const