]> git.lyx.org Git - features.git/commitdiff
fix drawing of mathrels. make \| equivalent to \Vert instead of \parallel
authorAndré Pönitz <poenitz@gmx.net>
Wed, 31 Oct 2001 10:54:34 +0000 (10:54 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 31 Oct 2001 10:54:34 +0000 (10:54 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2949 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/BUGS
src/mathed/math_defs.h
src/mathed/math_macro.C
src/mathed/math_macrotable.C
src/mathed/math_symbolinset.C

index 679e64204cfad1fe954dcc5a4aad405baf610f07..bd9af09116a9e136bbc595c37323699542457758 100644 (file)
@@ -34,6 +34,8 @@ General hints for bug reports:
 
 ----------------------------------------------------------------------
 
+- \matrm{xy} gets written as \mathrm{x}\mathrm{y}
+
 Dekel:
 
 Macros:
index 6b49f5db9ddef9c22e46853ae8520678ea72662c..c1c6f04f55f3a8ed181b0827125fa040b0360e89 100644 (file)
@@ -127,26 +127,6 @@ enum MathSymbolTypes {
        LMB_RELATION,
        ///
        LMB_OPERATOR,
-       ///
-       LMB_BOP = (LMB_RELATION | LMB_OPERATOR)
-};
-
-
-/// Paragraph permissions
-enum MathParFlag {
-       LMPF_BASIC = 0,
-       /// If false can use a non-standard size
-       LMPF_FIXED_SIZE = 1,
-       /// If true can insert newlines 
-       LMPF_ALLOW_CR  = 2,
-       /// If true can use tabs
-       LMPF_ALLOW_TAB = 4,
-       /// If true can insert new columns
-       LMPF_ALLOW_NEW_COL = 8,
-       /// Smaller than current size (frac)
-       LMPF_SMALLER = 16,
-       /// Script size (subscript, stackrel)
-       LMPF_SCRIPT = 32
 };
 
 #endif
index 5872f070d50470b913f4e8daa88ea51638c26308..f65f7c551e395be5c38dcff7c1d57c63d05cf4a9 100644 (file)
@@ -105,9 +105,9 @@ void MathMacro::metrics(MathMetricsInfo const & mi) const
        expanded_ = tmplate_->xcell(0);
        expanded_.data_.substitute(*this);
        expanded_.metrics(mi_);
-       width_   = expanded_.width()   + 6;
-       ascent_  = expanded_.ascent()  + 3;
-       descent_ = expanded_.descent() + 3;
+       width_   = expanded_.width();
+       ascent_  = expanded_.ascent();
+       descent_ = expanded_.descent();
 }
 
 
@@ -145,7 +145,7 @@ void MathMacro::draw(Painter & pain, int x, int y) const
                return;
        }
 
-       expanded_.draw(pain, x + 3, y);
+       expanded_.draw(pain, x, y);
 }
 
 
index c120da64f85c6c3b7fffee53ddb7913527b2c2e8..89065350ab1f7d185db7c497feb8698d012cfe00 100644 (file)
@@ -92,7 +92,7 @@ void MathMacroTable::builtinMacros()
        create("owns",         0, "\\ni");
        create("gets",         0, "\\leftarrow");
        create("to",           0, "\\rightarrow");
-       create("|",            0, "\\parallel");
+       create("|",            0, "\\Vert");
 
        create("longleftrightarrow", 0, "\\leftarrow\\kern-6mu\\rightarrow");
        create("Longleftrightarrow", 0, "\\Leftarrow\\kern-6mu\\Rightarrow");
index e27fbe1bc9bb1aabd34e5e83f1131e18a133fa1b..c895aa89519837a59483550807e2bfbb0a2daaa8 100644 (file)
@@ -1,5 +1,6 @@
 #include "math_symbolinset.h"
 #include "math_parser.h"
+#include "debug.h"
 #include "support.h"
 #include "support/LOstream.h"
 
@@ -7,7 +8,8 @@
 using std::ostream;
 
 MathSymbolInset::MathSymbolInset(const latexkeys * l)
-       : sym_(l), h_(0) {}
+       : sym_(l), h_(0)
+{}
 
 
 MathInset * MathSymbolInset::clone() const
@@ -69,18 +71,21 @@ void MathSymbolInset::metrics(MathMetricsInfo const & mi) const
                        ascent_  += h_;
                        descent_ -= h_;
                }
-               return;
+       } else {
+               if (sym_->id > 0 && sym_->id < 255 && math_font_available(LM_TC_SYMB))
+                       mathed_char_dim(code2(), mi_, sym_->id, ascent_, descent_, width_);
+               else
+                       mathed_string_dim(LM_TC_TEX, mi_, sym_->name, ascent_, descent_, width_);
        }
-
-       if (sym_->id > 0 && sym_->id < 255 && math_font_available(LM_TC_SYMB))
-               mathed_char_dim(code2(), mi_, sym_->id, ascent_, descent_, width_);
-       else
-               mathed_string_dim(LM_TC_TEX, mi_, sym_->name, ascent_, descent_, width_);
+       if (isRelOp())
+               width_ +=  mathed_char_width(LM_TC_TEX, mi_, 'I');
 }
 
 
 void MathSymbolInset::draw(Painter & pain, int x, int y) const
 {  
+       if (isRelOp())
+               x += mathed_char_width(LM_TC_TEX, mi_, 'I') / 2;
        MathTextCodes Code = code();
        if (sym_->latex_font_id > 0 && math_font_available(Code))
                drawChar(pain, Code, mi_, x, y - h_, sym_->latex_font_id);
@@ -92,7 +97,7 @@ void MathSymbolInset::draw(Painter & pain, int x, int y) const
 
 
 bool MathSymbolInset::isRelOp() const
-{
+{      
        return sym_->type == LMB_RELATION;
 }