mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Match the font in MathMacro::metrics with the font in MathMacro::draw
This fixes the "bad keming" of math ERT (in fact wrong metrics) which recently was worsened by InsetMathChar substitutions and their MathClass spacing. Also fix a small inefficiency: always prefer: Changer dummy = (currentMode() == TEXT_MODE) ? pi.base.font.changeShape(UP_SHAPE) : Changer(); over: Changer dummy = pi.base.font.changeShape((currentMode() == TEXT_MODE) ? UP_SHAPE : pi.base.font.shape()); The former only records and restores a value when the condition is satisfied, and does not cost anything otherwise.
This commit is contained in:
parent
830eb234be
commit
c3e33b765e
@ -456,8 +456,10 @@ void MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
|
||||
// calculate new metrics according to display mode
|
||||
if (d->displayMode_ == DISPLAY_INIT || d->displayMode_ == DISPLAY_INTERACTIVE_INIT) {
|
||||
Changer dummy = mi.base.changeFontSet("lyxtex");
|
||||
mathed_string_dim(mi.base.font, from_ascii("\\") + name(), dim);
|
||||
} else if (d->displayMode_ == DISPLAY_UNFOLDED) {
|
||||
Changer dummy = mi.base.changeFontSet("lyxtex");
|
||||
cell(0).metrics(mi, dim);
|
||||
Dimension bsdim;
|
||||
mathed_string_dim(mi.base.font, from_ascii("\\"), bsdim);
|
||||
@ -508,6 +510,10 @@ void MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
} else {
|
||||
LBUFERR(d->macro_);
|
||||
|
||||
Changer dummy = (currentMode() == TEXT_MODE)
|
||||
? mi.base.font.changeShape(UP_SHAPE)
|
||||
: Changer();
|
||||
|
||||
// calculate metrics, hoping that all cells are seen
|
||||
d->macro_->lock();
|
||||
d->expanded_.metrics(mi, dim);
|
||||
@ -714,9 +720,9 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const
|
||||
++pi.base.macro_nesting;
|
||||
|
||||
bool drawBox = lyxrc.macro_edit_style == LyXRC::MACRO_EDIT_INLINE_BOX;
|
||||
bool upshape = currentMode() == TEXT_MODE;
|
||||
Changer dummy = pi.base.font.changeShape(upshape ? UP_SHAPE
|
||||
: pi.base.font.shape());
|
||||
Changer dummy = (currentMode() == TEXT_MODE)
|
||||
? pi.base.font.changeShape(UP_SHAPE)
|
||||
: Changer();
|
||||
|
||||
// warm up cells
|
||||
for (size_t i = 0; i < nargs(); ++i)
|
||||
|
Loading…
Reference in New Issue
Block a user