]> git.lyx.org Git - features.git/commitdiff
Let math mu skips scale with zoom
authorGuillaume Munch <gm@lyx.org>
Sun, 20 Nov 2016 22:41:36 +0000 (23:41 +0100)
committerGuillaume Munch <gm@lyx.org>
Sun, 20 Nov 2016 23:08:12 +0000 (00:08 +0100)
src/mathed/MathSupport.cpp
src/mathed/MathSupport.h

index 16fbbcd4be0be7816302fce8560f550ce1a91431..222807bba4a40b303d92492a913af6f68932e5df 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "InsetMathFont.h"
 #include "InsetMathSymbol.h"
+#include "Length.h"
 #include "MathData.h"
 #include "MathParser.h"
 #include "MathStream.h"
@@ -533,25 +534,15 @@ int mathed_font_em(FontInfo const & font)
  * above.
  */
 
-int mathed_thinmuskip(FontInfo font)
+int mathed_mu(FontInfo const & font, double mu)
 {
-       font.setFamily(SYMBOL_FAMILY);
-       return support::iround(3.0 / 18 * theFontMetrics(font).em());
+       MetricsBase mb(nullptr, font);
+       return Length(mu, Length::MU).inPixels(mb);
 }
 
-
-int mathed_medmuskip(FontInfo font)
-{
-       font.setFamily(SYMBOL_FAMILY);
-       return support::iround(4.0 / 18 * theFontMetrics(font).em());
-}
-
-
-int mathed_thickmuskip(FontInfo font)
-{
-       font.setFamily(SYMBOL_FAMILY);
-       return support::iround(5.0 / 18 * theFontMetrics(font).em());
-}
+int mathed_thinmuskip(FontInfo const & font) { return mathed_mu(font, 3.0); }
+int mathed_medmuskip(FontInfo const & font) { return mathed_mu(font, 4.0); }
+int mathed_thickmuskip(FontInfo const & font) { return mathed_mu(font, 5.0); }
 
 
 int mathed_char_width(FontInfo const & font, char_type c)
index b7e3c7c39b850afacce113c7b8549cad1002f193..87f824dc1685cc4f96a43fc38274dc072170b67c 100644 (file)
@@ -31,11 +31,13 @@ class latexkeys;
 
 int mathed_font_em(FontInfo const &);
 
-int mathed_thinmuskip(FontInfo font);
+int mathed_mu(FontInfo const & font, double mu);
 
-int mathed_medmuskip(FontInfo font);
+int mathed_thinmuskip(FontInfo const & font);
 
-int mathed_thickmuskip(FontInfo font);
+int mathed_medmuskip(FontInfo const & font);
+
+int mathed_thickmuskip(FontInfo const & font);
 
 int mathed_char_width(FontInfo const &, char_type c);