Le 21/11/2016 à 01:17, Guillaume Munch a écrit :
commit fdd09d6f51491059f3def7f6c3d11167d6f5462c
Author: Guillaume Munch <[email protected]>
Date:   Sun Nov 20 23:41:36 2016 +0100

    Let math mu skips scale with zoom

Do you really see a difference with this patch? What makes you thing that theFontMetrics(font).em() does not scale with zoom? Looking at the code, the way zoom is taken in account on this code path in Length is pretty ugly.

I find the previous code was more straightforward.

JMarc

---
 src/mathed/MathSupport.cpp |   23 +++++++----------------
 src/mathed/MathSupport.h   |    8 +++++---
 2 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/src/mathed/MathSupport.cpp b/src/mathed/MathSupport.cpp
index 16fbbcd..222807b 100644
--- a/src/mathed/MathSupport.cpp
+++ b/src/mathed/MathSupport.cpp
@@ -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)
diff --git a/src/mathed/MathSupport.h b/src/mathed/MathSupport.h
index b7e3c7c..87f824d 100644
--- a/src/mathed/MathSupport.h
+++ b/src/mathed/MathSupport.h
@@ -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);



Reply via email to