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.
This commit is contained in:
Enrico Forestieri 2021-04-03 18:37:10 +02:00
parent 9d1031771e
commit 7a6ad48495
2 changed files with 3 additions and 3 deletions

View 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;

View 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');