]> git.lyx.org Git - lyx.git/commitdiff
- remove MathStyles cache from those insets that don't need it
authorAndré Pönitz <poenitz@gmx.net>
Mon, 22 Oct 2001 15:37:49 +0000 (15:37 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 22 Oct 2001 15:37:49 +0000 (15:37 +0000)
- fix math font sizes in headings etc
- remove unused static member int MathInset::workwidth

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2909 a592a061-630c-0410-9148-cb99ea01b6c8

47 files changed:
src/mathed/ChangeLog
src/mathed/formula.C
src/mathed/formula.h
src/mathed/formulabase.C
src/mathed/formulabase.h
src/mathed/formulamacro.C
src/mathed/math_arrayinset.C
src/mathed/math_binominset.C
src/mathed/math_boxinset.C
src/mathed/math_boxinset.h
src/mathed/math_charinset.C
src/mathed/math_charinset.h
src/mathed/math_decorationinset.h
src/mathed/math_deliminset.C
src/mathed/math_dotsinset.C
src/mathed/math_fracinset.C
src/mathed/math_funcinset.C
src/mathed/math_funcinset.h
src/mathed/math_funcliminset.C
src/mathed/math_funcliminset.h
src/mathed/math_gridinset.C
src/mathed/math_inset.C
src/mathed/math_inset.h
src/mathed/math_lefteqninset.C
src/mathed/math_macro.C
src/mathed/math_macro.h
src/mathed/math_macroarg.C
src/mathed/math_macroarg.h
src/mathed/math_macrotemplate.C
src/mathed/math_matrixinset.C
src/mathed/math_matrixinset.h
src/mathed/math_metricsinfo.h
src/mathed/math_nestinset.C
src/mathed/math_notinset.C
src/mathed/math_notinset.h
src/mathed/math_rootinset.C
src/mathed/math_scriptinset.C
src/mathed/math_scriptinset.h
src/mathed/math_sizeinset.C
src/mathed/math_spaceinset.C
src/mathed/math_specialcharinset.C
src/mathed/math_specialcharinset.h
src/mathed/math_sqrtinset.C
src/mathed/math_stackrelinset.C
src/mathed/math_symbolinset.C
src/mathed/math_symbolinset.h
src/mathed/support.C

index 550d77e4eb24bb071899bbc6455606661afeb586..342be7a290808ca2734f4115b879fb95a8938182 100644 (file)
@@ -1,4 +1,15 @@
 
+2001-10-17  André Pönitz  <poenitz@gmx.net>
+
+       * math_*inset.[Ch]: remove MathStyles cache from insets that
+         don't need it
+
+       * support.C: 
+         formulabase.C: fix math font sizes in headings etc
+
+       * math_inset.[Ch]:
+         formula.C: remove unused static member int MathInset::workwidth
+
 2001-10-17  André Pönitz  <poenitz@gmx.net>
 
        * math_inset.h:
index 400bbaf813ad5acc4f30e7703b6b70ad49fb081e..67f37cd7bd14dd51b476fa6f8a1483ffda8f82aa 100644 (file)
@@ -49,6 +49,22 @@ using std::endl;
 using std::vector;
 
 
+namespace {
+
+       void stripFromLastEqualSign(MathArray & ar)
+       {
+               // find position of last '=' in the array
+               MathArray::size_type pos = ar.size();
+               for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
+                       if ((*it)->getChar() == '=')
+                               pos = it - ar.begin();
+
+               // delete everything behind this position
+               ar.erase(pos, ar.size());
+       }
+
+}
+
 
 InsetFormula::InsetFormula()
        : par_(MathAtom(new MathMatrixInset))
@@ -132,10 +148,9 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & font,
        int x = int(xx) - 1;
        y -= 2;
 
-       MathInset::workwidth = bv->workWidth();
        Painter & pain = bv->painter();
 
-       metrics(bv, &font);
+       metrics(bv, font);
        int w = par_->width();
        int h = par_->height();
        int a = par_->ascent();
@@ -242,7 +257,9 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
 
                case LFUN_MATH_EXTERN:
                        bv->lockedInsetStoreUndo(Undo::EDIT);
-                       handleExtern(arg, bv);
+                       handleExtern(arg);
+                       // re-compute inset dimension
+                       metrics(bv);
                        updateLocal(bv, true);
                        break;
 
@@ -299,25 +316,32 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
 }
 
 
-void InsetFormula::handleExtern(const string & arg, BufferView * bv)
+void InsetFormula::handleExtern(const string & arg)
 {
        // where are we?
+       if (!mathcursor)
+               return; 
+
        MathArray & ar = mathcursor->cursor().cell();
 
-       // find position of last '=' in the array for handleExtern
-       MathArray::size_type pos = ar.size();
-       for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
-               if ((*it)->getChar() == '=')
-                       pos = it - ar.begin();
+       // parse args
+       string lang;
+       string extra;
+       istringstream iss(arg.c_str());
+       iss >> lang >> extra;
+       if (extra.empty())
+               extra = "noextra";      
 
-       // delete everything behind this position
-       ar.erase(pos, ar.size());
+       // strip last '=' and everything behind
+       stripFromLastEqualSign(ar);
 
        // create normalized expression
        //string outfile = lyx::tempName("maple.out");
-       string outfile = "/tmp/lyx2" + arg + ".out";
+       string outfile = "/tmp/lyx2" + lang + ".out";
        ostringstream os;
+       os << "[" << extra << ' ';
        ar.writeNormal(os); 
+       os << "]";
        string code = os.str().c_str();
 
        // run external sript
@@ -332,9 +356,6 @@ void InsetFormula::handleExtern(const string & arg, BufferView * bv)
        ifstream is(outfile.c_str());
        mathed_parse_cell(ar, is);
        mathcursor->end();
-
-       // re-compute inset dimension
-       metrics(bv);
 }
 
 
@@ -390,7 +411,7 @@ int InsetFormula::descent(BufferView *, LyXFont const &) const
 
 int InsetFormula::width(BufferView * bv, LyXFont const & font) const
 {
-       metrics(bv, &font);
+       metrics(bv, font);
        return par_->width();
 }
 
index 659c80a1cae23c36e706e40f162f5c0864533b4e..94c6d602b6671a11696bb69d2b02b483aee5dd74 100644 (file)
@@ -71,7 +71,7 @@ public:
        ///
        std::vector<string> const getLabelList() const;
        ///
-       void handleExtern(string const & arg, BufferView * bv);
+       void handleExtern(string const & arg);
        ///
        bool display() const;
        ///
index eb67e308fc52f998305b5f3e9bc8fd2743bf075c..954e0374e0266acb0e30bc0062c72d6d4698fda6 100644 (file)
@@ -95,7 +95,7 @@ bool openNewInset(BufferView * bv, UpdatableInset * new_inset)
 MathArrayInset * matrixpar(MathInset::idx_type & idx)
 {
        idx = 0;
-       return (mathcursor ? mathcursor->enclosingArray(idx) : 0)
+       return mathcursor ? mathcursor->enclosingArray(idx) : 0
 }
 
 
@@ -104,7 +104,7 @@ MathArrayInset * matrixpar(MathInset::idx_type & idx)
 
 
 InsetFormulaBase::InsetFormulaBase()
-       : view_(0), font_(0)
+       : view_(0), font_()
 {
        // This is needed as long the math parser is not re-entrant
        MathMacroTable::builtinMacros();
@@ -117,14 +117,11 @@ void InsetFormulaBase::validate(LaTeXFeatures &) const
 {}
 
 
-void InsetFormulaBase::metrics(BufferView * bv, LyXFont const * f) const 
+void InsetFormulaBase::metrics(BufferView * bv, LyXFont const & f) const 
 {
        if (bv)
                view_ = bv;
-       if (f)
-               font_ = f;
-       if (f)
-               lyxerr << "fontsize: " << f->size() << "\n";
+       font_ = f;
        MathMetricsInfo mi(view_, font_, display() ? LM_ST_DISPLAY : LM_ST_TEXT);
        par()->metrics(mi);
 }
index 3d45a7814fbc6ba7ee1519344091c30d9d8ef890..4d33c9700b9a9db422ddade7ef190cc8d9330876 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <iosfwd>
 #include "insets/inset.h"
+#include "lyxfont.h"
 
 // only for getType():
 #include "math_defs.h"
@@ -89,7 +90,7 @@ public:
        ///
        virtual MathAtom & par() = 0;
        ///
-       virtual void metrics(BufferView * bv = 0, LyXFont const * font = 0) const;
+       virtual void metrics(BufferView * bv = 0, LyXFont const & font = LyXFont()) const;
        ///
        virtual void updateLocal(BufferView * bv, bool mark_dirty);
 private:
@@ -98,7 +99,7 @@ private:
        ///
        mutable BufferView * view_;     
        ///
-       mutable LyXFont const * font_;
+       mutable LyXFont font_;
 };
 
 // We don't really mess want around with mathed stuff outside mathed.
index b0188770d3f9e68a99085877f71b190e4da2b00a..587155747ee679a1a4a816883fc76296394786ea 100644 (file)
@@ -140,7 +140,7 @@ int InsetFormulaMacro::descent(BufferView *, LyXFont const &) const
 
 int InsetFormulaMacro::width(BufferView * bv, LyXFont const & f) const
 {
-       metrics(bv, &f);
+       metrics(bv, f);
        return 10 + lyxfont::width(prefix(), f) + par()->width();
 }
 
index 0b06d00a5953ce723178fdccd1bc6ee1ccf8f543..57eb16832f678229fb5dea413576fd279204b1b6 100644 (file)
@@ -46,9 +46,9 @@ void MathArrayInset::write(MathWriteInfo & os) const
 
 void MathArrayInset::metrics(MathMetricsInfo const & st) const
 {
-       size_ = st;
-       if (size_.style == LM_ST_DISPLAY)
-               size_.style = LM_ST_TEXT;
-       MathGridInset::metrics(size_);
+       MathMetricsInfo mi = st;
+       if (mi.style == LM_ST_DISPLAY)
+               mi.style = LM_ST_TEXT;
+       MathGridInset::metrics(mi);
 }
 
index a9f419a4922945bdedcfa3c984a0217f0c682ba6..7ffbd19fee98d040939ee7b049b66a9e3e49538e 100644 (file)
@@ -30,10 +30,10 @@ int MathBinomInset::dw() const
 
 void MathBinomInset::metrics(MathMetricsInfo const & st) const
 {
-       size_ = st;
-       smallerStyleFrac(size_);
-       xcell(0).metrics(size_);
-       xcell(1).metrics(size_);
+       MathMetricsInfo mi = st;
+       smallerStyleFrac(mi);
+       xcell(0).metrics(mi);
+       xcell(1).metrics(mi);
        ascent_  = xcell(0).height() + 4 + 5;
        descent_ = xcell(1).height() + 4 - 5; 
        width_   = std::max(xcell(0).width(), xcell(1).width()) + 2 * dw() + 4; 
index 8d7642ceb10a413081065df9d23489477a4249fc..2e1c3bacded15038e635a6e1744f6875adaad000 100644 (file)
@@ -54,11 +54,11 @@ void MathBoxInset::writeNormal(std::ostream & os) const
 
 void MathBoxInset::metrics(MathMetricsInfo const & st) const
 {
-       size_ = st;
-       if (text_ && st.view && st.font) {
-               ascent_  = text_->ascent(st.view, *st.font)  + 2;
-               descent_ = text_->descent(st.view, *st.font) + 2;
-               width_   = text_->width(st.view, *st.font)   + 4;
+       mi_ = st;
+       if (text_ && mi_.view) {
+               ascent_  = text_->ascent(mi_.view, mi_.font)  + 2;
+               descent_ = text_->descent(mi_.view, mi_.font) + 2;
+               width_   = text_->width(mi_.view, mi_.font)   + 4;
        } else {
                ascent_  = 10;
                descent_ = 0;
@@ -71,8 +71,8 @@ void MathBoxInset::draw(Painter & pain, int x, int y) const
 {
        float fx = x + 2;
 
-       if (text_ && size_.view && size_.font)
-               text_->draw(size_.view, *(size_.font), y, fx, false);
+       if (text_ && mi_.view)
+               text_->draw(mi_.view, mi_.font, y, fx, false);
        if (mathcursor && mathcursor->isInside(this))
                pain.rectangle(x, y - ascent(), xcell(0).width(), height(),
                        LColor::mathframe);
index 9b0bd58123a3e62ba14c96379ac246b45ec35412..a3d8202c7570df32f6c0d523457d992bf05b52ad 100644 (file)
@@ -33,7 +33,7 @@ public:
        ///
        void writeNormal(std::ostream &) const;
        ///
-       void metrics(MathMetricsInfo const & st) const;
+       void metrics(MathMetricsInfo const &) const;
        /// identifies BoxInsets
        MathBoxInset * asBoxInset() { return this; }
 
@@ -41,6 +41,8 @@ private:
        /// unimplemented
        void operator=(MathBoxInset const &);
 
+       ///
+       mutable MathMetricsInfo mi_;
        ///
        string name_;
        ///
index 197f918525e1eb9cdc1e8e9eb25a1dfb874ed4f6..3d1557c402446a3a992223ecbf5972587b5c2c59 100644 (file)
@@ -60,25 +60,25 @@ MathInset * MathCharInset::clone() const
 
 int MathCharInset::ascent() const
 {
-       return mathed_char_ascent(code_, size_, char_);
+       return mathed_char_ascent(code_, mi_, char_);
 }
 
 
 int MathCharInset::descent() const
 {
-       return mathed_char_descent(code_, size_, char_);
+       return mathed_char_descent(code_, mi_, char_);
 }
 
 
 int MathCharInset::width() const
 {
-       return mathed_char_width(code_, size_, char_);
+       return mathed_char_width(code_, mi_, char_);
 }
 
 
-void MathCharInset::metrics(MathMetricsInfo const & st) const
+void MathCharInset::metrics(MathMetricsInfo const & mi) const
 {
-       size_ = st;
+       mi_ = mi;
 }
 
 
@@ -87,7 +87,7 @@ void MathCharInset::draw(Painter & pain, int x, int y) const
        xo(x);
        yo(y);
        //lyxerr << "drawing '" << char_ << "' code: " << code_ << endl;
-       drawChar(pain, code_, size_, x, y, char_);
+       drawChar(pain, code_, mi_, x, y, char_);
 }
 
 
index fc024338fee7be83b7a87d591457a09b0e13a876..3d844729ba4e6f4ad7c1cc89c27f3bea931d3d2c 100644 (file)
@@ -58,5 +58,7 @@ private:
        char char_;
        /// the font to be used on screen
        MathTextCodes code_;
+       ///
+       mutable MathMetricsInfo mi_;
 };
 #endif
index a7a8effa821a2b15850cdf2655cb2461f42cd7ea..1808b2f474d42775e0e4273ffb91d1ff11e1418e 100644 (file)
@@ -44,5 +44,7 @@ private:
        mutable int dh_;
        /// vertical offset cache of deco
        mutable int dy_;
+       ///
+       mutable MathMetricsInfo size_;
 };
 #endif
index cef56a13cc0f15ab3340ae896c93b4b2afdd1f8a..40f548695cf822496ed5048ceac653ddf051cedd 100644 (file)
@@ -60,12 +60,11 @@ int MathDelimInset::dw() const
 }
 
 
-void MathDelimInset::metrics(MathMetricsInfo const & st) const
+void MathDelimInset::metrics(MathMetricsInfo const & mi) const
 {
-       xcell(0).metrics(st);
-       size_    = st;
+       xcell(0).metrics(mi);
        int a, d, w;
-       mathed_char_dim(LM_TC_VAR, size_, 'I', a, d, w);
+       mathed_char_dim(LM_TC_VAR, mi, 'I', a, d, w);
        int h0   = (a + d) / 2;
        int a0   = std::max(xcell(0).ascent(), a)   - h0;
        int d0   = std::max(xcell(0).descent(), d)  + h0;
index 40249eeff18bae8df1f36266da0da3811ff3640c..47a79a7d4a7d51d926b96df70fe0f50e019d41df 100644 (file)
@@ -32,10 +32,9 @@ void MathDotsInset::draw(Painter & pain, int x, int y) const
 }
 
 
-void MathDotsInset::metrics(MathMetricsInfo const & st) const
+void MathDotsInset::metrics(MathMetricsInfo const & mi) const
 {
-       size_ = st;
-       mathed_char_dim(LM_TC_VAR, size_, 'M', ascent_, descent_, width_);
+       mathed_char_dim(LM_TC_VAR, mi, 'M', ascent_, descent_, width_);
        switch (name_[0]) {
                case 'l': dh_ = 0; break;
                case 'c': dh_ = ascent_ / 2; break;
index e25adc5c0eb821fab3635623fc053e826f3e70bf..4a4cd0ef64bacb46495ab1ad3304ef49e724384c 100644 (file)
@@ -19,12 +19,12 @@ MathInset * MathFracInset::clone() const
 }
 
 
-void MathFracInset::metrics(MathMetricsInfo const & st) const
+void MathFracInset::metrics(MathMetricsInfo const & mi) const
 {
-       size_    = st;
-       smallerStyleFrac(size_);
-       xcell(0).metrics(size_);
-       xcell(1).metrics(size_);
+       MathMetricsInfo m = mi;
+       smallerStyleFrac(m);
+       xcell(0).metrics(m);
+       xcell(1).metrics(m);
        width_   = std::max(xcell(0).width(), xcell(1).width()) + 4; 
        ascent_  = xcell(0).height() + 4 + 5;
        descent_ = xcell(1).height() + 4 - 5; 
index a255258670451e10cc09c6cb7678eb3dd186f88b..765aa191b94cf61d2b75da094f68ffc6dcfaa687 100644 (file)
@@ -49,10 +49,10 @@ void MathFuncInset::writeNormal(std::ostream & os) const
 }
 
 
-void MathFuncInset::metrics(MathMetricsInfo const & st) const 
+void MathFuncInset::metrics(MathMetricsInfo const & mi) const 
 {
-       size_ = st;
-       mathed_string_dim(LM_TC_TEX, size_, name_, ascent_, descent_, width_);
+       mi_ = mi;
+       mathed_string_dim(LM_TC_TEX, mi_, name_, ascent_, descent_, width_);
 }
 
 
@@ -60,5 +60,5 @@ void MathFuncInset::draw(Painter & pain, int x, int y) const
 { 
        xo(x);
        yo(y);
-       drawStr(pain, LM_TC_TEX, size_, x, y, name_);
+       drawStr(pain, LM_TC_TEX, mi_, x, y, name_);
 }
index b81cc60907468ae46a26e8324ced5b6046276a33..4ec3b0c32a58ca8bb89ee59144701be5e78e2124 100644 (file)
@@ -34,5 +34,7 @@ public:
 private:
        ///
        string name_;
+       ///
+       mutable MathMetricsInfo mi_;
 };
 #endif
index 2788b420516a14821675a29966394e8965d655de..9939eaf494bfca1c6b0e667c974252476caadb49 100644 (file)
@@ -19,7 +19,7 @@ MathInset * MathFuncLimInset::clone() const
 
 bool MathFuncLimInset::isScriptable() const
 {
-       return size_.style == LM_ST_DISPLAY;
+       return mi_.style == LM_ST_DISPLAY;
 }
 
 
@@ -35,11 +35,10 @@ void MathFuncLimInset::writeNormal(ostream & os) const
 }
 
 
-void MathFuncLimInset::metrics(MathMetricsInfo const & st) const
+void MathFuncLimInset::metrics(MathMetricsInfo const & mi) const
 {
-       size_ = st;
-       mathed_string_dim(LM_TC_TEXTRM, size_, sym_->name,
-               ascent_, descent_, width_);
+       mi_ = mi;
+       mathed_string_dim(LM_TC_TEXTRM, mi_, sym_->name, ascent_, descent_, width_);
 }
 
 
@@ -47,5 +46,5 @@ void MathFuncLimInset::draw(Painter & pain, int x, int y) const
 {  
        xo(x);
        yo(y);
-       drawStr(pain, LM_TC_TEXTRM, size_, x, y, sym_->name);
+       drawStr(pain, LM_TC_TEXTRM, mi_, x, y, sym_->name);
 }
index 70f0e992b8729dc1258dd9a2bc2753658645e6dc..0d4e8dcc8517d996754e3448812cdd20c8c367b6 100644 (file)
@@ -29,5 +29,7 @@ public:
 private:
        ///
        latexkeys const * sym_;
+       ///
+       mutable MathMetricsInfo mi_;
 };
 #endif
index 4b3c16d606522c2c76d048f9048c866894276d19..d583e90ab2ad99ca894924adb35b64141d9adbf8 100644 (file)
@@ -3,6 +3,7 @@
 #endif
 
 #include "math_gridinset.h"
+#include "lyxfont.h"
 #include "support/LOstream.h"
 #include "debug.h"
 
@@ -132,11 +133,10 @@ LyXLength MathGridInset::vskip(row_type row) const
 }
 
 
-void MathGridInset::metrics(MathMetricsInfo const & st) const
+void MathGridInset::metrics(MathMetricsInfo const & mi) const
 {
        // let the cells adjust themselves
-       MathNestInset::metrics(st);
-       size_ = st;
+       MathNestInset::metrics(mi);
 
        // adjust vertical structure
        for (row_type row = 0; row < nrows(); ++row) {
index 114ab8a4827442a96adb9d007727345b67505c9e..1656ac28ec5075105d9216eff223b53d1282d8b2 100644 (file)
@@ -24,9 +24,6 @@
 #include "debug.h"
 
 
-int MathInset::workwidth;
-
-
 MathInset::MathInset()
        : xo_(0), yo_(0)
 {}
@@ -246,10 +243,9 @@ std::vector<MathInset::idx_type>
 }
 
 
-void MathInset::metrics(MathMetricsInfo const & st) const
+void MathInset::metrics(MathMetricsInfo const &) const
 {
        lyxerr << "MathInset::metrics() called directly!\n";
-       size_ = st;
 }
 
 
index d72bcfa0a50cdb9d27dc9e456f79d5f15f44b83e..b70260e6926d7f04b4bfdc6ac348a705ff41bd50 100644 (file)
@@ -257,13 +257,6 @@ public:
        ///
        virtual void handleFont(MathTextCodes) {}
 
-       ///
-       static int workwidth;
-
-protected:
-       /// the used font size
-       mutable MathMetricsInfo size_;
-
 private:
        /// the following are used for positioning the cursor with the mouse
        /// cached cursor start position in pixels from the document left
index 9c22c442a4af453c9913c28d907c128e1e6b8915..3f4382d8eab624cd027e1dbda7397f470ebf6e51 100644 (file)
@@ -45,10 +45,9 @@ void MathLefteqnInset::writeNormal(std::ostream & os) const
 }
 
 
-void MathLefteqnInset::metrics(MathMetricsInfo const & st) const
+void MathLefteqnInset::metrics(MathMetricsInfo const & mi) const
 {
-       MathNestInset::metrics(st);
-       size_    = st;
+       MathNestInset::metrics(mi);
        ascent_  = xcell(0).ascent() + 2;
        descent_ = xcell(0).descent() + 2;
        width_   = 4;
index f7a327c3f2d1815f672daca7b6fdc0804166a9be..c62f84dac884b743c2668c06e09bbedda212bcf8 100644 (file)
@@ -69,32 +69,32 @@ bool MathMacro::editing() const
 }
 
 
-void MathMacro::metrics(MathMetricsInfo const & st) const
+void MathMacro::metrics(MathMetricsInfo const & mi) const
 {
+       mi_ = mi;
+
        if (defining()) {
-               size_ = st;
-               mathed_string_dim(LM_TC_TEX, size_, name(), ascent_, descent_, width_);
+               mathed_string_dim(LM_TC_TEX, mi_, name(), ascent_, descent_, width_);
                return;
        }
 
        if (editing()) {
                expanded_ = tmplate_->xcell(0);
-               expanded_.metrics(st);
-               size_    = st;
+               expanded_.metrics(mi_);
                width_   = expanded_.width()   + 4;
                ascent_  = expanded_.ascent()  + 2;
                descent_ = expanded_.descent() + 2;
 
-               width_ +=  mathed_string_width(LM_TC_TEXTRM, size_, name()) + 10;
+               width_ +=  mathed_string_width(LM_TC_TEXTRM, mi_, name()) + 10;
 
                int lasc;
                int ldes;
                int lwid;
-               mathed_string_dim(LM_TC_TEXTRM, size_, "#1: ", lasc, ldes, lwid);
+               mathed_string_dim(LM_TC_TEXTRM, mi_, "#1: ", lasc, ldes, lwid);
 
                for (idx_type i = 0; i < nargs(); ++i) {
                        MathXArray const & c = xcell(i);
-                       c.metrics(st);
+                       c.metrics(mi_);
                        width_    = std::max(width_, c.width() + lwid);
                        descent_ += std::max(c.ascent(),  lasc) + 5;
                        descent_ += std::max(c.descent(), ldes) + 5;
@@ -104,8 +104,7 @@ void MathMacro::metrics(MathMetricsInfo const & st) const
 
        expanded_ = tmplate_->xcell(0);
        expanded_.data_.substitute(*this);
-       expanded_.metrics(st);
-       size_    = st;
+       expanded_.metrics(mi_);
        width_   = expanded_.width()   + 6;
        ascent_  = expanded_.ascent()  + 3;
        descent_ = expanded_.descent() + 3;
@@ -117,25 +116,25 @@ void MathMacro::draw(Painter & pain, int x, int y) const
        xo(x);
        yo(y);
 
-       metrics(size_);
+       metrics(mi_);
 
        if (defining()) {
-               drawStr(pain, LM_TC_TEX, size_, x, y, name());
+               drawStr(pain, LM_TC_TEX, mi_, x, y, name());
                return;
        }
 
        if (editing()) {
                int h = y - ascent() + 2 + expanded_.ascent();
-               drawStr(pain, LM_TC_TEXTRM, size_, x + 3, h, name());
+               drawStr(pain, LM_TC_TEXTRM, mi_, x + 3, h, name());
 
-               int const w = mathed_string_width(LM_TC_TEXTRM, size_, name());
+               int const w = mathed_string_width(LM_TC_TEXTRM, mi_, name());
                expanded_.draw(pain, x + w + 12, h);
                h += expanded_.descent();
 
                int lasc;
                int ldes;
                int lwid;
-               mathed_string_dim(LM_TC_TEXTRM, size_, "#1: ", lasc, ldes, lwid);
+               mathed_string_dim(LM_TC_TEXTRM, mi_, "#1: ", lasc, ldes, lwid);
 
                for (idx_type i = 0; i < nargs(); ++i) {
                        MathXArray const & c = xcell(i);
@@ -143,7 +142,7 @@ void MathMacro::draw(Painter & pain, int x, int y) const
                        c.draw(pain, x + lwid, h);
                        char str[] = "#1:";
                        str[1] += static_cast<char>(i);
-                       drawStr(pain, LM_TC_TEX, size_, x + 3, h, str);
+                       drawStr(pain, LM_TC_TEX, mi_, x + 3, h, str);
                        h += std::max(c.descent(), ldes) + 5;
                }
                return;
index 4460f0bfd5d54c352cf0aba3ee66d91f7915e4e0..39fb630aff559ffd141de4738293dccc0166724e 100644 (file)
@@ -82,6 +82,8 @@ private:
        MathAtom & tmplate_;
        ///
        mutable MathXArray expanded_;
+       ///
+       mutable MathMetricsInfo mi_;
 };
 
 
index 6ed3e3e04a1468e88b592cb2fe8ed88db78b1437..77c817305fb26e9c7e0328f5b205e1727c2f471e 100644 (file)
@@ -35,15 +35,16 @@ void MathMacroArgument::write(MathWriteInfo & os) const
 }
 
 
-void MathMacroArgument::metrics(MathMetricsInfo const & st) const
+void MathMacroArgument::metrics(MathMetricsInfo const & mi) const
 {
+       mi_ = mi;
        if (expanded_) {
-               xcell(0).metrics(st);
+               xcell(0).metrics(mi_);
                width_   = xcell(0).width();
                ascent_  = xcell(0).ascent();
                descent_ = xcell(0).descent();
        } else
-               mathed_string_dim(LM_TC_TEX, size_, str_, ascent_, descent_, width_);
+               mathed_string_dim(LM_TC_TEX, mi_, str_, ascent_, descent_, width_);
 }
 
 
@@ -52,7 +53,7 @@ void MathMacroArgument::draw(Painter & pain, int x, int y) const
        if (expanded_)
                xcell(0).draw(pain, x, y);
        else
-               drawStr(pain, LM_TC_TEX, size_, x, y, str_);
+               drawStr(pain, LM_TC_TEX, mi_, x, y, str_);
 }
 
 
index c8855d9a87d1d177703ceef742d94c9117ae95ca..25755677d0d05c4cccd451a33e28c277cdabced8 100644 (file)
@@ -37,6 +37,8 @@ private:
        char str_[3];
        ///
        bool expanded_;
+       ///
+       mutable MathMetricsInfo mi_;
 };
 
 #endif
index c217cd1b57c8bbc49056521b9d840bca2b91c24a..486e200cc0e15be1823f9d945987e2894a7b5316 100644 (file)
@@ -56,10 +56,9 @@ void MathMacroTemplate::write(MathWriteInfo & os) const
 }
 
 
-void MathMacroTemplate::metrics(MathMetricsInfo const & st) const
+void MathMacroTemplate::metrics(MathMetricsInfo const & mi) const
 {
-       xcell(0).metrics(st);
-       size_    = st;
+       xcell(0).metrics(mi);
        width_   = xcell(0).width() + 4;
        ascent_  = xcell(0).ascent() + 2;
        descent_ = xcell(0).descent() + 2;
index 9c289572c6fd45d6f4bf555d4261904f914ef1e3..70c3788326af75615de585ac3913b029480390e2 100644 (file)
@@ -140,13 +140,13 @@ int MathMatrixInset::defaultColSpace(col_type col)
 }
 
 
-void MathMatrixInset::metrics(MathMetricsInfo const & st) const
+void MathMatrixInset::metrics(MathMetricsInfo const & mi) const
 {
-       size_ = st;
-       size_.style = (getType() == LM_OT_SIMPLE) ? LM_ST_TEXT : LM_ST_DISPLAY;
+       mi_ = mi;
+       mi_.style = (getType() == LM_OT_SIMPLE) ? LM_ST_TEXT : LM_ST_DISPLAY;
 
        // let the cells adjust themselves
-       MathGridInset::metrics(size_);
+       MathGridInset::metrics(mi_);
 
        if (display()) {
                ascent_  += 12;
@@ -156,7 +156,7 @@ void MathMatrixInset::metrics(MathMetricsInfo const & st) const
        if (numberedType()) {
                int l = 0;
                for (row_type row = 0; row < nrows(); ++row)
-                       l = std::max(l, mathed_string_width(LM_TC_BF, size_, nicelabel(row)));
+                       l = std::max(l, mathed_string_width(LM_TC_BF, mi_, nicelabel(row)));
 
                if (l)
                        width_ += 30 + l;
@@ -165,7 +165,7 @@ void MathMatrixInset::metrics(MathMetricsInfo const & st) const
        // make it at least as high as the current font
        int asc = 0;
        int des = 0;
-       math_font_max_dim(LM_TC_TEXTRM, size_, asc, des);
+       math_font_max_dim(LM_TC_TEXTRM, mi_, asc, des);
        ascent_  = std::max(ascent_,  asc);
        descent_ = std::max(descent_, des);
 }
@@ -182,7 +182,7 @@ void MathMatrixInset::draw(Painter & pain, int x, int y) const
                int const xx = x + colinfo_.back().offset_ + colinfo_.back().width_ + 20;
                for (row_type row = 0; row < nrows(); ++row) {
                        int const yy = y + rowinfo_[row].offset_;
-                       drawStr(pain, LM_TC_BF, size_, xx, yy, nicelabel(row));
+                       drawStr(pain, LM_TC_BF, mi_, xx, yy, nicelabel(row));
                }
        }
 }
index c28020b549d96d232ce52628a92ff727f3b78127..c6cdaab385b02e50692f70bb9e04fd20cf39d3b8 100644 (file)
@@ -101,6 +101,8 @@ private:
        std::vector<int> nonum_;
        ///
        std::vector<string> label_;
+       ///
+       mutable MathMetricsInfo mi_;
 };
 
 #endif
index db5a3c2caf2a2cd125f08ec0a184ffb5c2c6d140..ee67ca71865afda15ad58b0f98abf4434e26fd02 100644 (file)
@@ -1,8 +1,9 @@
 #ifndef MATH_METRICSINFO
 #define MATH_METRICSINFO
 
+#include "lyxfont.h"
+
 class BufferView;
-class LyXFont;
 
 
 /// Standard Math Sizes (Math mode styles)
@@ -21,17 +22,17 @@ enum MathStyles {
 struct MathMetricsInfo {
        ///
        MathMetricsInfo()
-               : view(0), font(0), style(LM_ST_TEXT)
+               : view(0), font(), style(LM_ST_TEXT)
        {}
        ///
-       MathMetricsInfo(BufferView * v, LyXFont const * f, MathStyles s)
+       MathMetricsInfo(BufferView * v, LyXFont const & f, MathStyles s)
                : view(v), font(f), style(s)
        {}
 
        ///
        BufferView * view;
        ///
-       LyXFont const * font;
+       LyXFont font;
        ///
        MathStyles style;
 };
index 9b8a411002adc960bb51ce5d94f350d6de3b2f1f..6e051d1744f6c1aa676fe32292976d0247a4b503 100644 (file)
@@ -48,11 +48,10 @@ void MathNestInset::substitute(MathMacro const & m)
 }
 
 
-void MathNestInset::metrics(MathMetricsInfo const & st) const
+void MathNestInset::metrics(MathMetricsInfo const & mi) const
 {
-       size_ = st;
        for (idx_type i = 0; i < nargs(); ++i)
-               xcell(i).metrics(st);
+               xcell(i).metrics(mi);
 }
 
 
index 5e72280b84c96dec0ff94dd292db186e5fed3371..3c6442c7ba1f410b8c354c8c3dd3333bba76f143 100644 (file)
@@ -28,13 +28,13 @@ void MathNotInset::writeNormal(ostream & os) const
 }
 
 
-void MathNotInset::metrics(MathMetricsInfo const & st) const
+void MathNotInset::metrics(MathMetricsInfo const & mi) const
 {
-       size_ = st;
+       mi_ = mi;
        if (math_font_available(LM_TC_CMSY))
-               mathed_char_dim(LM_TC_CMSY, size_, 54, ascent_, descent_, width_);
+               mathed_char_dim(LM_TC_CMSY, mi_, 54, ascent_, descent_, width_);
        else
-               mathed_char_dim(LM_TC_VAR, size_, '/', ascent_, descent_, width_);
+               mathed_char_dim(LM_TC_VAR, mi_, '/', ascent_, descent_, width_);
        width_ = 0;
 }
 
@@ -45,7 +45,7 @@ void MathNotInset::draw(Painter & pain, int x, int y) const
        yo(y);
 
        if (math_font_available(LM_TC_CMSY))
-               drawChar(pain, LM_TC_CMSY, size_, x, y, 54);
+               drawChar(pain, LM_TC_CMSY, mi_, x, y, 54);
        else
-               drawChar(pain, LM_TC_VAR, size_, x, y, '/');
+               drawChar(pain, LM_TC_VAR, mi_, x, y, '/');
 }
index cc0dca081bad65389d3e4d58ac15145018dab8d2..0f945420427f7f79dd04b8c1bd5295c8e84c3019 100644 (file)
@@ -20,5 +20,8 @@ public:
        void metrics(MathMetricsInfo const & st) const;
        ///
        void draw(Painter &, int x, int y) const;
+private:
+       ///
+       mutable MathMetricsInfo mi_;
 };
 #endif
index c9bd8e618877cd06dea1d8e7aca5315378a3b8aa..d5190cea733e9879884afa6fde5c7ae16ac6abde 100644 (file)
@@ -19,6 +19,7 @@
 #include "support/LOstream.h"
 #include "Painter.h"
 
+
 MathRootInset::MathRootInset()
        : MathNestInset(2)
 {}
@@ -30,10 +31,9 @@ MathInset * MathRootInset::clone() const
 }
 
 
-void MathRootInset::metrics(MathMetricsInfo const & st) const
+void MathRootInset::metrics(MathMetricsInfo const & mi) const
 {
-       MathNestInset::metrics(st);
-       size_    = st;
+       MathNestInset::metrics(mi);
        ascent_  = std::max(xcell(0).ascent()  + 5, xcell(1).ascent())  + 2;
        descent_ = std::max(xcell(1).descent() + 5, xcell(0).descent()) + 2;
        width_   = xcell(0).width() + xcell(1).width() + 10;
index f3622459120e3be47c2f907e88d5a6e7fc04eae3..b68c70f26fc786a597c4ecfac6da791f5bb8d5ce 100644 (file)
@@ -100,7 +100,7 @@ int MathScriptInset::dy1(MathInset const * nuc) const
                asc += na + 2;
        else 
                asc = std::max(asc, na);
-       asc = std::max(asc, mathed_char_ascent(LM_TC_VAR, size_, 'I'));
+       asc = std::max(asc, mathed_char_ascent(LM_TC_VAR, mi_, 'I'));
        return asc;
 }
 
@@ -162,36 +162,36 @@ int MathScriptInset::nwid(MathInset const * nuc) const
 {
        return nuc ?
                nuc->width() :
-               mathed_char_width(LM_TC_TEX, size_, '.');
+               mathed_char_width(LM_TC_TEX, mi_, '.');
 }
 
 
 int MathScriptInset::nasc(MathInset const * nuc) const
 {
        return nuc ? nuc->ascent()
-               : mathed_char_ascent(LM_TC_VAR, size_, 'I');
+               : mathed_char_ascent(LM_TC_VAR, mi_, 'I');
 }
 
 
 int MathScriptInset::ndes(MathInset const * nuc) const
 {
        return nuc ? nuc->descent()
-               : mathed_char_descent(LM_TC_VAR, size_, 'I');
+               : mathed_char_descent(LM_TC_VAR, mi_, 'I');
 }
 
 
-void MathScriptInset::metrics(MathMetricsInfo const & st) const
+void MathScriptInset::metrics(MathMetricsInfo const & mi) const
 {      
-       metrics(0, st);
+       metrics(0, mi);
 }
 
 
 void MathScriptInset::metrics(MathInset const * nuc,
-       MathMetricsInfo const & st) const
+       MathMetricsInfo const & mi) const
 {      
-       MathNestInset::metrics(st);
+       MathNestInset::metrics(mi);
        if (nuc)
-               nuc->metrics(st);
+               nuc->metrics(mi);
 
        ascent_  = ascent(nuc);
        descent_ = descent(nuc);
@@ -215,7 +215,7 @@ void MathScriptInset::draw(MathInset const * nuc, Painter & pain,
        if (nuc)
                nuc->draw(pain, x + dxx(nuc), y);
        else
-               drawStr(pain, LM_TC_TEX, size_, x + dxx(nuc), y, ".");
+               drawStr(pain, LM_TC_TEX, mi_, x + dxx(nuc), y, ".");
 
        if (hasUp())
                up().draw(pain, x + dx1(nuc), y - dy1(nuc));
index 49337fa80a10956a6f19590a3459c5e05aa98e0f..f7af1546ccfe5ac7482ea4ac0128c30f8ee04f71 100644 (file)
@@ -100,6 +100,8 @@ private:
        bool script_[2]; 
        ///
        int limits_;
+       ///
+       mutable MathMetricsInfo mi_;
 };
 
 #endif
index a7d6221c8cbc0aaaeb407e4ba11e71a7ca4388fd..d7e4c1b5300eab6078a63075b123aa9fa8d48370 100644 (file)
@@ -26,11 +26,11 @@ void MathSizeInset::draw(Painter & pain, int x, int y) const
 }
 
 
-void MathSizeInset::metrics(MathMetricsInfo const & st) const
+void MathSizeInset::metrics(MathMetricsInfo const & mi) const
 {
-       size_ = st;
-       size_.style = MathStyles(key_->id);
-       xcell(0).metrics(size_);
+       MathMetricsInfo m = mi;
+       m.style = MathStyles(key_->id);
+       xcell(0).metrics(m);
        ascent_   = xcell(0).ascent_;
        descent_  = xcell(0).descent_;
        width_    = xcell(0).width_;
index 87b752e8846368970715e28a1e06374a61ebdc53..77be8e3a19f2ec01b2865cda9a9e7a4aef98faeb 100644 (file)
@@ -21,25 +21,6 @@ MathInset * MathSpaceInset::clone() const
 }
 
 
-void MathSpaceInset::draw(Painter & pain, int x, int y) const
-{ 
-       
-// XPoint p[4] = {{++x, y-3}, {x, y}, {x+width-2, y}, {x+width-2, y-3}};
-       
-// Sadly, HP-UX CC can't handle that kind of initialization.
-       
-       int xp[4];
-       int yp[4];
-       
-       xp[0] = ++x;             yp[0] = y - 3;
-       xp[1] = x;                   yp[1] = y;
-       xp[2] = x + width_ - 2;  yp[2] = y;
-       xp[3] = x + width_ - 2;  yp[3] = y - 3;
-       
-       pain.lines(xp, yp, 4, space_ ? LColor::latex : LColor::math);
-}
-
-
 void MathSpaceInset::write(MathWriteInfo & os) const
 {
        if (space_ >= 0 && space_ < 6)
@@ -53,9 +34,8 @@ void MathSpaceInset::writeNormal(std::ostream & os) const
 }
 
 
-void MathSpaceInset::metrics(MathMetricsInfo const & st) const
+void MathSpaceInset::metrics(MathMetricsInfo const & mi) const
 {
-       size_  = st;
        width_ = space_ ? space_ * 2 : 2;
        if (space_ > 3)
                width_ *= 2;
@@ -67,6 +47,25 @@ void MathSpaceInset::metrics(MathMetricsInfo const & st) const
 }
 
 
+void MathSpaceInset::draw(Painter & pain, int x, int y) const
+{ 
+       
+// XPoint p[4] = {{++x, y-3}, {x, y}, {x+width-2, y}, {x+width-2, y-3}};
+       
+// Sadly, HP-UX CC can't handle that kind of initialization.
+       
+       int xp[4];
+       int yp[4];
+       
+       xp[0] = ++x;             yp[0] = y - 3;
+       xp[1] = x;                   yp[1] = y;
+       xp[2] = x + width_ - 2;  yp[2] = y;
+       xp[3] = x + width_ - 2;  yp[3] = y - 3;
+       
+       pain.lines(xp, yp, 4, space_ ? LColor::latex : LColor::math);
+}
+
+
 void MathSpaceInset::incSpace()
 {
        space_ = (space_ + 1) % 6;
index 0c9d76fec825bc45f834c214fa4dff82bbce3220..bfd1eaf130b089f74f0d27d189c0d5bd575db8f9 100644 (file)
@@ -20,25 +20,25 @@ MathInset * MathSpecialCharInset::clone() const
 
 int MathSpecialCharInset::ascent() const
 {
-       return mathed_char_ascent(LM_TC_CONST, size_, char_);
+       return mathed_char_ascent(LM_TC_CONST, mi_, char_);
 }
 
 
 int MathSpecialCharInset::descent() const
 {
-       return mathed_char_descent(LM_TC_CONST, size_, char_);
+       return mathed_char_descent(LM_TC_CONST, mi_, char_);
 }
 
 
 int MathSpecialCharInset::width() const
 {
-       return mathed_char_width(LM_TC_CONST, size_, char_);
+       return mathed_char_width(LM_TC_CONST, mi_, char_);
 }
 
 
-void MathSpecialCharInset::metrics(MathMetricsInfo const & st) const
+void MathSpecialCharInset::metrics(MathMetricsInfo const & mi) const
 {
-       size_ = st;
+       mi_ = mi;
 }
 
 
@@ -46,7 +46,7 @@ void MathSpecialCharInset::draw(Painter & pain, int x, int y) const
 { 
        xo(x);
        yo(y);
-       drawChar(pain, LM_TC_CONST, size_, x, y, char_);
+       drawChar(pain, LM_TC_CONST, mi_, x, y, char_);
 }
 
 
index 8fcfbb32c96d8277ba59c61fe8ca3056b651c56a..1fbcc91301c506019a07d7784e5b6bc0a014e80f 100644 (file)
@@ -37,5 +37,7 @@ public:
 private:
        /// the character
        char char_;
+       ///
+       mutable MathMetricsInfo mi_;
 };
 #endif
index 27cdc56c2c13a99c478f5b0c46a42fd2b2ce41cf..5bfb8112a65e4f1575159c3a88fd561c465a0ddb 100644 (file)
@@ -19,10 +19,9 @@ MathInset * MathSqrtInset::clone() const
 }
 
 
-void MathSqrtInset::metrics(MathMetricsInfo const & st) const
+void MathSqrtInset::metrics(MathMetricsInfo const & mi) const
 {
-       xcell(0).metrics(st);
-       size_    = st;
+       xcell(0).metrics(mi);
        ascent_  = xcell(0).ascent()  + 4;
        descent_ = xcell(0).descent() + 2;
        width_   = xcell(0).width()   + 12;
index 3db27793445493a5b0f743b9d04018a612ccff4d..1333bc6414c208243af799ed9753bd6ad218e8a4 100644 (file)
@@ -17,12 +17,12 @@ MathInset * MathStackrelInset::clone() const
 }
 
 
-void MathStackrelInset::metrics(MathMetricsInfo const & st) const
+void MathStackrelInset::metrics(MathMetricsInfo const & mi) const
 {
-       size_    = st;
-       smallerStyleFrac(size_);
-       xcell(0).metrics(size_);
-       xcell(1).metrics(st);
+       MathMetricsInfo m = mi;
+       smallerStyleFrac(m);
+       xcell(0).metrics(m);
+       xcell(1).metrics(mi);
        width_   = std::max(xcell(0).width(), xcell(1).width()) + 4; 
        ascent_  = xcell(1).ascent() + xcell(0).height() + 4;
        descent_ = xcell(1).descent();
index f9170c1b2defc55b3b856a4e43f70e7211d108aa..24e3e9a923735e963b75102561e104031a286044 100644 (file)
@@ -58,12 +58,12 @@ MathTextCodes MathSymbolInset::code2() const
 }
 
 
-void MathSymbolInset::metrics(MathMetricsInfo const & st) const
+void MathSymbolInset::metrics(MathMetricsInfo const & mi) const
 {
-       size_ = st;
+       mi_ = mi;
        MathTextCodes c = code();
        if (sym_->latex_font_id > 0 && math_font_available(c)) {
-               mathed_char_dim(c, size_, sym_->latex_font_id, ascent_, descent_, width_);
+               mathed_char_dim(c, mi_, sym_->latex_font_id, ascent_, descent_, width_);
                if (c == LM_TC_CMEX) {
                        h_ = 4 * descent_ / 5;
                        ascent_  += h_;
@@ -73,9 +73,9 @@ void MathSymbolInset::metrics(MathMetricsInfo const & st) const
        }
 
        if (sym_->id > 0 && sym_->id < 255 && math_font_available(LM_TC_SYMB))
-               mathed_char_dim(code2(), size_, sym_->id, ascent_, descent_, width_);
+               mathed_char_dim(code2(), mi_, sym_->id, ascent_, descent_, width_);
        else
-               mathed_string_dim(LM_TC_TEX, size_, sym_->name, ascent_, descent_, width_);
+               mathed_string_dim(LM_TC_TEX, mi_, sym_->name, ascent_, descent_, width_);
 }
 
 
@@ -85,11 +85,11 @@ void MathSymbolInset::draw(Painter & pain, int x, int y) const
        yo(y);
        MathTextCodes Code = code();
        if (sym_->latex_font_id > 0 && math_font_available(Code))
-               drawChar(pain, Code, size_, x, y - h_, sym_->latex_font_id);
+               drawChar(pain, Code, mi_, x, y - h_, sym_->latex_font_id);
        else if (sym_->id > 0 && sym_->id < 255 && math_font_available(LM_TC_SYMB))
-               drawChar(pain, code2(), size_, x, y, sym_->id);
+               drawChar(pain, code2(), mi_, x, y, sym_->id);
        else
-               drawStr(pain, LM_TC_TEX, size_, x, y, sym_->name);
+               drawStr(pain, LM_TC_TEX, mi_, x, y, sym_->name);
 }
 
 
@@ -101,7 +101,7 @@ bool MathSymbolInset::isRelOp() const
 
 bool MathSymbolInset::isScriptable() const
 {
-       return size_.style == LM_ST_DISPLAY && sym_->token == LM_TK_CMEX;
+       return mi_.style == LM_ST_DISPLAY && sym_->token == LM_TK_CMEX;
 }
 
 
index a42f01ba59d21f933c9a7b8c2074d427eef8fe41..7d73c85fe36d3147b9413f6b93a6d9a8eab4ddf2 100644 (file)
@@ -40,5 +40,7 @@ private:
        latexkeys const * sym_;
        ///
        mutable int h_;
+       ///
+       mutable MathMetricsInfo mi_;
 };
 #endif
index 513b8f96a1117be7d49f59165a0c51218899a813..59274e474e32ccca03fb3bdb6000d40c21e50ac7 100644 (file)
@@ -192,15 +192,8 @@ LyXFont const & whichFontBase(MathTextCodes type)
 LyXFont whichFont(MathTextCodes type, MathMetricsInfo const & size)
 {
        LyXFont f = whichFontBase(type);
-       if (size.font) {
-#ifdef WITH_WARNINGS 
-#warning Want to fix formula sizes in headings? Look here!
-#endif
-               // unfortunatly, size.font is sometimes nonzero and size.font->size()
-               // is huge...
-               //lyxerr << "setting font size to " << size.font->size() << "\n";
-               //f.setSize(size.font->size());
-       }
+       // use actual size
+       f.setSize(size.font.size());
 
        switch (size.style) {
        case LM_ST_DISPLAY: