From: Enrico Forestieri Date: Thu, 2 Nov 2023 00:59:54 +0000 (+0100) Subject: Revert "Inherit outer font in text-in-math environments" X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=e0e1350b7e6e26227a73c7d3ddf7a337633cedbf;p=features.git Revert "Inherit outer font in text-in-math environments" This reverts commit d72b9b0238bd33197f0cea4a36d90d78d1cbc666. Unfortunately, the font taken into account is the font at the current cursor position rather than the font of the corresponding math inset. --- diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp index 714e8ad750..8fe03ba441 100644 --- a/src/MetricsInfo.cpp +++ b/src/MetricsInfo.cpp @@ -11,8 +11,6 @@ #include #include "MetricsInfo.h" -#include "BufferView.h" -#include "Cursor.h" #include "LyXRC.h" @@ -63,8 +61,7 @@ Changer MetricsBase::changeFontSet(string const & name) string const oldname = fontname; fontname = name; if (isMathFont(name) || isMathFont(oldname)) - font = isTextFont(name) ? bv->cursor().getFont().fontInfo() - : sane_font; + font = sane_font; augmentFont(font, name); font.setSize(rc->old.font.size()); font.setStyle(rc->old.font.style()); diff --git a/src/mathed/InsetMathBox.cpp b/src/mathed/InsetMathBox.cpp index 6feddf9cdd..afaadeb83a 100644 --- a/src/mathed/InsetMathBox.cpp +++ b/src/mathed/InsetMathBox.cpp @@ -146,14 +146,14 @@ void InsetMathBox::htmlize(HtmlStream & ms) const void InsetMathBox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("text"); + Changer dummy = mi.base.changeFontSet("textnormal"); cell(0).metrics(mi, dim); } void InsetMathBox::draw(PainterInfo & pi, int x, int y) const { - Changer dummy = pi.base.changeFontSet("text"); + Changer dummy = pi.base.changeFontSet("textnormal"); cell(0).draw(pi, x, y); } @@ -196,7 +196,7 @@ InsetMathFBox::InsetMathFBox(Buffer * buf) void InsetMathFBox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("text"); + Changer dummy = mi.base.changeFontSet("textnormal"); cell(0).metrics(mi, dim); // 1 pixel space, 1 frame, 1 space dim.wid += 2 * 3; @@ -210,7 +210,7 @@ void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const Dimension const dim = dimension(*pi.base.bv); pi.pain.rectangle(x + 1, y - dim.ascent() + 1, dim.width() - 2, dim.height() - 2, Color_foreground); - Changer dummy = pi.base.changeFontSet("text"); + Changer dummy = pi.base.changeFontSet("textnormal"); cell(0).draw(pi, x + 3, y); } @@ -281,7 +281,7 @@ InsetMathMakebox::InsetMathMakebox(Buffer * buf, bool framebox) void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const { - Changer dummy = mi.base.changeFontSet("text"); + Changer dummy = mi.base.changeFontSet("textnormal"); Dimension wdim; static docstring bracket = from_ascii("["); @@ -312,7 +312,7 @@ void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathMakebox::draw(PainterInfo & pi, int x, int y) const { - Changer dummy = pi.base.changeFontSet("text"); + Changer dummy = pi.base.changeFontSet("textnormal"); BufferView const & bv = *pi.base.bv; int w = mathed_char_width(pi.base.font, '[');