X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FMetricsInfo.cpp;h=93782f94765882948b245d7959d7965796b44d00;hb=99174acff85c4db06e677b87e36a99d4a16dd967;hp=60a004573e2d3d61c1c4bc3d4fe71d077f32a8b0;hpb=75bfed55079cab6b73fbea6ce4ae3f10d1af3b91;p=lyx.git diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp index 60a004573e..93782f9476 100644 --- a/src/MetricsInfo.cpp +++ b/src/MetricsInfo.cpp @@ -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