]> git.lyx.org Git - lyx.git/blobdiff - src/MetricsInfo.cpp
Revert "Makes caret height adapt to context in mathed."
[lyx.git] / src / MetricsInfo.cpp
index b61011d63dee95245ae8dff328f6469f358753b7..93782f94765882948b245d7959d7965796b44d00 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "mathed/MathSupport.h"
 
+#include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
 #include "support/docstring.h"
@@ -94,6 +95,19 @@ Changer MetricsBase::changeEnsureMath(Inset::mode_type mode)
 }
 
 
+int MetricsBase::inPixels(Length const & len) const
+{
+       FontInfo fi = font;
+       if (len.unit() == Length::MU)
+               // mu is 1/18th of an em in the math symbol font
+               fi.setFamily(SYMBOL_FAMILY);
+       else
+               // Math style is only taken into account in the case of mu
+               fi.setStyle(LM_ST_TEXT);
+       return len.inPixels(textwidth, theFontMetrics(fi).em());
+}
+
+
 /////////////////////////////////////////////////////////////////////////
 //
 // MetricsInfo
@@ -157,7 +171,7 @@ ColorCode PainterInfo::backgroundColor(Inset const * inset, bool sel) const
 
 Color PainterInfo::textColor(Color const & color) const
 {
-       if (change_.changed()) 
+       if (change_.changed())
                return change_.color();
        if (selected)
                return Color_selectiontext;