]> git.lyx.org Git - features.git/commitdiff
Correct on-screen kerning in math for non-mu units
authorGuillaume Munch <gm@lyx.org>
Mon, 21 Nov 2016 21:21:38 +0000 (22:21 +0100)
committerGuillaume Munch <gm@lyx.org>
Tue, 22 Nov 2016 10:30:26 +0000 (11:30 +0100)
The current math style should have no impact on \kern1mu. This is another
benefit of a9eb87a8.

Testcase:
\begin{align*}
 & \kern1em a\\
 & {\scriptscriptstyle \kern1em a}\\
 & \kern18mu a\\
 & {\scriptscriptstyle \kern18mu a}
\end{align*}

src/Length.cpp

index 5e5a805c67abf1df16452f398b9c470f044fbb44..62b7c842f8f8bf509a06406cb27af5c9023d2466 100644 (file)
@@ -302,7 +302,11 @@ int Length::inPixels(MetricsBase const & base) const
 {
        FontInfo fi = base.font;
        if (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 inPixels(base.textwidth, theFontMetrics(fi).em());
 }