]> git.lyx.org Git - features.git/commitdiff
Use font metrics for computing the size of math decorations
authorEnrico Forestieri <forenr@lyx.org>
Sat, 3 Apr 2021 16:37:10 +0000 (18:37 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Sat, 3 Apr 2021 16:37:10 +0000 (18:37 +0200)
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
src/mathed/InsetMathDecoration.cpp

index 7d9bb9433f8ca4b16206e0f00d002039005ed3c7..b818163f0b00d0a1ed7e1d95616d4d1b507718fc 100644 (file)
@@ -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;
 
index ae95cdc1d5473e6acf5943c84db736f6f41a6335..cc4ba162796b8adaf48782f7bc9ec5cb4986749a 100644 (file)
@@ -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');