commit 7a6ad48495b920797da20fdc685152f3d744c2dd
Author: Enrico Forestieri <for...@lyx.org>
Date:   Sat Apr 3 18:37:10 2021 +0200

    Use font metrics for computing the size of math decorations
    
    It was an error using an absolute size instead of one relative to the
    size of the used font. It was requiring using the physical dpi of the
    screen and caused #12222. Now everything is computed with respect to
    the metrics of the font and should be automatically correct.
    
    Fixes #12222.
---
 src/frontends/qt/GuiApplication.cpp |    2 +-
 src/mathed/InsetMathDecoration.cpp  |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/frontends/qt/GuiApplication.cpp 
b/src/frontends/qt/GuiApplication.cpp
index 7d9bb94..b818163 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -1141,7 +1141,7 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
 
        // needs to be done before reading lyxrc
        QWidget w;
-       lyxrc.dpi = (w.physicalDpiX() + w.physicalDpiY()) / 2;
+       lyxrc.dpi = (w.logicalDpiX() + w.logicalDpiY()) / 2;
 
        guiApp = this;
 
diff --git a/src/mathed/InsetMathDecoration.cpp 
b/src/mathed/InsetMathDecoration.cpp
index ae95cdc..cc4ba16 100644
--- a/src/mathed/InsetMathDecoration.cpp
+++ b/src/mathed/InsetMathDecoration.cpp
@@ -122,8 +122,8 @@ void InsetMathDecoration::metrics(MetricsInfo & mi, 
Dimension & dim) const
        cell(0).metrics(mi, dim);
 
        int const l1 = mi.base.bv->zoomedPixels(1);
-       int const l2 = 4 * l1;
-       int const l3 = 4 * l1;
+       int const l2 = mathed_char_width(mi.base.font, 'x') - l1;
+       int const l3 = l2;
 
        dh_  = l2; //mathed_char_height(LM_TC_VAR, mi, 'I', ascent_, descent_);
        dw_  = l3; //mathed_char_width(LM_TC_VAR, mi, 'x');
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to