mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 05:01:49 +00:00
Better fix for bug #6851.
The old-style font changing macros really inherit the mode, so we have to account for this. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35156 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
cf0708db7a
commit
87f155767a
11
lib/symbols
11
lib/symbols
@ -111,12 +111,11 @@ ce font forcetext
|
||||
cf font forcetext
|
||||
|
||||
# old-style font commands
|
||||
# name "oldfont" alias
|
||||
bf oldfont textbf
|
||||
cal oldfont mathcal
|
||||
it oldfont textit
|
||||
rm oldfont textrm
|
||||
tt oldfont texttt
|
||||
bf oldfont none
|
||||
cal oldfont none
|
||||
it oldfont none
|
||||
rm oldfont none
|
||||
tt oldfont none
|
||||
|
||||
# matrix environments
|
||||
Bmatrix matrix none
|
||||
|
@ -13,8 +13,9 @@
|
||||
#include "InsetMathFontOld.h"
|
||||
|
||||
#include "MathData.h"
|
||||
#include "MathStream.h"
|
||||
#include "MathParser.h"
|
||||
#include "MathStream.h"
|
||||
#include "MathSupport.h"
|
||||
#include "MetricsInfo.h"
|
||||
|
||||
#include <ostream>
|
||||
@ -23,7 +24,7 @@
|
||||
namespace lyx {
|
||||
|
||||
InsetMathFontOld::InsetMathFontOld(Buffer * buf, latexkeys const * key)
|
||||
: InsetMathNest(buf, 1), key_(key)
|
||||
: InsetMathNest(buf, 1), key_(key), current_mode_(TEXT_MODE)
|
||||
{
|
||||
//lock(true);
|
||||
}
|
||||
@ -37,7 +38,16 @@ Inset * InsetMathFontOld::clone() const
|
||||
|
||||
void InsetMathFontOld::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
FontSetChanger dummy(mi.base, key_->extra);
|
||||
current_mode_ = isTextFont(from_ascii(mi.base.fontname))
|
||||
? TEXT_MODE : MATH_MODE;
|
||||
|
||||
docstring const font = current_mode_ == MATH_MODE
|
||||
? "math" + key_->name : "text" + key_->name;
|
||||
|
||||
// When \cal is used in text mode, the font is not changed
|
||||
bool really_change_font = font != "textcal";
|
||||
|
||||
FontSetChanger dummy(mi.base, font, really_change_font);
|
||||
cell(0).metrics(mi, dim);
|
||||
metricsMarkers(dim);
|
||||
}
|
||||
@ -45,7 +55,16 @@ void InsetMathFontOld::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
|
||||
void InsetMathFontOld::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
FontSetChanger dummy(pi.base, key_->extra);
|
||||
current_mode_ = isTextFont(from_ascii(pi.base.fontname))
|
||||
? TEXT_MODE : MATH_MODE;
|
||||
|
||||
docstring const font = current_mode_ == MATH_MODE
|
||||
? "math" + key_->name : "text" + key_->name;
|
||||
|
||||
// When \cal is used in text mode, the font is not changed
|
||||
bool really_change_font = font != "textcal";
|
||||
|
||||
FontSetChanger dummy(pi.base, font, really_change_font);
|
||||
cell(0).draw(pi, x + 1, y);
|
||||
drawMarkers(pi, x, y);
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ class InsetMathFontOld : public InsetMathNest {
|
||||
public:
|
||||
///
|
||||
explicit InsetMathFontOld(Buffer * buf, latexkeys const * key);
|
||||
/// we are in text mode.
|
||||
mode_type currentMode() const { return TEXT_MODE; }
|
||||
/// we inherit the mode
|
||||
mode_type currentMode() const { return current_mode_; }
|
||||
/// we write extra braces in any case...
|
||||
bool extraBraces() const { return true; }
|
||||
///
|
||||
@ -52,6 +52,8 @@ private:
|
||||
virtual Inset * clone() const;
|
||||
/// the font to be used on screen
|
||||
latexkeys const * key_;
|
||||
/// the inherited mode
|
||||
mutable mode_type current_mode_;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user