X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetSpecialChar.cpp;h=ff4c7208a60c2abaa05fdd89e015b6cc7b4689b0;hb=ed7d3a33abad4e1b5141b2ec626b542d1603782c;hp=8671d2b7d01ba16dcfe29002e7885b2e5b35818a;hpb=51b1cfab721ea6d7c9f43853de987ad6f0157ea8;p=lyx.git diff --git a/src/insets/InsetSpecialChar.cpp b/src/insets/InsetSpecialChar.cpp index 8671d2b7d0..ff4c7208a6 100644 --- a/src/insets/InsetSpecialChar.cpp +++ b/src/insets/InsetSpecialChar.cpp @@ -20,6 +20,7 @@ #include "Lexer.h" #include "MetricsInfo.h" #include "output_xhtml.h" +#include "texstream.h" #include "frontends/FontMetrics.h" #include "frontends/Painter.h" @@ -128,8 +129,6 @@ void InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const } if (dim.wid == 0) dim.wid = fm.width(s); - - setDimCache(mi, dim); } @@ -138,8 +137,10 @@ namespace { // helper function: draw text and update x. void drawChar(PainterInfo & pi, int & x, int const y, char_type ch) { - pi.pain.text(x, y, ch, pi.base.font); - x += theFontMetrics(pi.base.font).width(ch); + FontInfo font = pi.base.font; + font.setPaintColor(pi.textColor(font.realColor())); + pi.pain.text(x, y, ch, font); + x += theFontMetrics(font).width(ch); } @@ -284,7 +285,6 @@ void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const } -// In lyxf3 this will be just LaTeX void InsetSpecialChar::write(ostream & os) const { string command; @@ -327,7 +327,6 @@ void InsetSpecialChar::write(ostream & os) const } -// This function will not be necessary when lyx3 void InsetSpecialChar::read(Lexer & lex) { lex.next(); @@ -368,22 +367,23 @@ void InsetSpecialChar::latex(otexstream & os, os << "\\-"; break; case LIGATURE_BREAK: - os << "\\textcompwordmark{}"; + os << "\\textcompwordmark" << termcmd; break; case END_OF_SENTENCE: os << "\\@."; break; case LDOTS: - os << "\\ldots{}"; + os << "\\ldots" << termcmd; break; case MENU_SEPARATOR: if (rp.local_font->isRightToLeft()) - os << "\\lyxarrow*{}"; + os << "\\lyxarrow*"; else - os << "\\lyxarrow{}"; + os << "\\lyxarrow"; + os << termcmd; break; case SLASH: - os << "\\slash{}"; + os << "\\slash" << termcmd; break; case NOBREAKDASH: if (rp.moving_arg) @@ -393,22 +393,22 @@ void InsetSpecialChar::latex(otexstream & os, case PHRASE_LYX: if (rp.moving_arg) os << "\\protect"; - os << "\\LyX{}"; + os << "\\LyX" << termcmd; break; case PHRASE_TEX: if (rp.moving_arg) os << "\\protect"; - os << "\\TeX{}"; + os << "\\TeX" << termcmd; break; case PHRASE_LATEX2E: if (rp.moving_arg) os << "\\protect"; - os << "\\LaTeXe{}"; + os << "\\LaTeXe" << termcmd; break; case PHRASE_LATEX: if (rp.moving_arg) os << "\\protect"; - os << "\\LaTeX{}"; + os << "\\LaTeX" << termcmd; break; } } @@ -571,6 +571,12 @@ void InsetSpecialChar::validate(LaTeXFeatures & features) const } +bool InsetSpecialChar::isChar() const +{ + return kind_ != HYPHENATION || kind_ != LIGATURE_BREAK; +} + + bool InsetSpecialChar::isLetter() const { return kind_ == HYPHENATION || kind_ == LIGATURE_BREAK