]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiPainter.cpp
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / GuiPainter.cpp
index fd2f96b39db0ebd17389dde96d03e0d3234ffd16..afa2182eb671f4ee3e53208c0df13efc4a273e86 100644 (file)
@@ -336,6 +336,12 @@ int GuiPainter::text(int x, int y, docstring const & s,
                textwidth = smallCapsText(x, y, str, f);
                if (f.underbar() == FONT_ON)
                        underline(f, x, y, textwidth);
+               if (f.strikeout() == FONT_ON)
+                       strikeoutLine(f, x, y, textwidth);
+               if (f.uuline() == FONT_ON)
+                       doubleUnderline(f, x, y, textwidth);
+               if (f.uwave() == FONT_ON)
+                       wavyHorizontalLine(x, y, textwidth, f.realColor().baseColor);
                return textwidth;
        }
 
@@ -345,6 +351,13 @@ int GuiPainter::text(int x, int y, docstring const & s,
        textwidth = fm.width(s);
        if (f.underbar() == FONT_ON)
                underline(f, x, y, textwidth);
+       if (f.strikeout() == FONT_ON)
+               strikeoutLine(f, x, y, textwidth);
+       if (f.uuline() == FONT_ON)
+               doubleUnderline(f, x, y, textwidth);
+       if (f.uwave() == FONT_ON)
+               // f.color() doesn't work on some circumstances
+               wavyHorizontalLine(x, y, textwidth,  f.realColor().baseColor);
 
        if (!isDrawingEnabled())
                return textwidth;
@@ -520,6 +533,17 @@ int GuiPainter::preeditText(int x, int y, char_type c,
 }
 
 
+void GuiPainter::doubleUnderline(FontInfo const & f, int x, int y, int width)
+{
+       FontMetrics const & fm = theFontMetrics(f);
+
+       int const below = max(fm.maxDescent() / 2, 2);
+
+       line(x, y + below, x + width, y + below, f.realColor());
+       line(x, y + below - 2, x + width, y + below - 2, f.realColor());
+}
+
+
 void GuiPainter::underline(FontInfo const & f, int x, int y, int width)
 {
        FontMetrics const & fm = theFontMetrics(f);
@@ -534,6 +558,20 @@ void GuiPainter::underline(FontInfo const & f, int x, int y, int width)
 }
 
 
+void GuiPainter::strikeoutLine(FontInfo const & f, int x, int y, int width)
+{
+       FontMetrics const & fm = theFontMetrics(f);
+
+       int const middle = max((fm.maxHeight() / 4), 1);
+       int const height =  middle/3;
+
+       if (height < 2)
+               line(x, y - middle, x + width, y - middle, f.realColor());
+       else
+               fillRectangle(x, y - middle, width, height, f.realColor());
+}
+
+
 void GuiPainter::dashedUnderline(FontInfo const & f, int x, int y, int width)
 {
        FontMetrics const & fm = theFontMetrics(f);