]> git.lyx.org Git - features.git/commitdiff
fix cursor font bug
authorAndré Pönitz <poenitz@gmx.net>
Tue, 28 Aug 2001 13:34:04 +0000 (13:34 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 28 Aug 2001 13:34:04 +0000 (13:34 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2606 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_charinset.C
src/mathed/math_cursor.C
src/mathed/texify

index fa9dceba913cae557124d32490a49f6d7173f69c..28548ba1292badcebe6c9190cf0a5d56eae33b66 100644 (file)
@@ -31,6 +31,9 @@ MathTextCodes MathCharInset::nativeCode(char c) const
 {
        if (isalpha(c))
                return LM_TC_VAR;
+       if (strchr("#$%{|}", c))
+               return LM_TC_SPECIAL;
+       //if (strchr("0123456789;:!|[]().,?+/-*<>=", c)
        return LM_TC_CONST;
 }
 
index 78c45a2d82f36855d7d599c8d796db9e70044e84..124a0ac6104756b57fc13317bc9ac10152d49c91 100644 (file)
@@ -1251,62 +1251,11 @@ void MathCursor::interpret(string const & s)
                return;
        }
 
-       if (c == '{') {
-               niceInsert(new MathScopeInset);
-               return;
-       }
-
-       if (isalpha(c) && (lastcode_ == LM_TC_GREEK || lastcode_ == LM_TC_GREEK1)) {
-               static char const greek[26] =
-                       {'A', 'B', 'X',  0 , 'E',  0 ,  0 , 'H', 'I',  0 ,
-                        'K',  0 , 'M', 'N', 'O',  0 ,  0 , 'P',  0 , 'T',
-                        0,  0,   0,   0,   0 , 'Z' };
-                       
-               MathTextCodes code = LM_TC_SYMB;
-               if ('A' <= c && c <= 'Z' && greek[c - 'A']) {
-                       code = LM_TC_RM;
-                       c = greek[c - 'A'];
-               }
-               insert(c, code);
-       
-#warning greek insert problem? look here!
-               //if (lastcode_ == LM_TC_GREEK1)
-                       lastcode_ = LM_TC_VAR;
-               return; 
-       }
-
        if (selection_)
                selDel();
 
-       if (lastcode_ == LM_TC_TEX) {
-               if (macroName().empty()) {
-                       insert(c, LM_TC_TEX);
-                       if (!isalpha(c)) {
-                               macroModeClose();
-                               lastcode_ = LM_TC_VAR;
-                       }
-               } else {
-                       if (isalpha(c))
-                               insert(c, LM_TC_TEX);
-                       else {
-                               macroModeClose();
-                               lastcode_ = LM_TC_VAR;
-                       }
-               }
-               return;
-       }
-
-       if (strchr("0123456789;:!|[]().,?+/-*<>=", c)) {
-               if (lastcode_ != LM_TC_TEXTRM)
-                       lastcode_ = LM_TC_CONST;
-               insert(c, lastcode_);
-               return;
-       }
-
-       if (strchr("#$%{|}", c)) {
-               if (lastcode_ != LM_TC_TEXTRM)
-                       lastcode_ = LM_TC_SPECIAL;
-               insert(c, lastcode_);
+       if (lastcode_ == LM_TC_TEXTRM) {
+               insert(c, LM_TC_TEXTRM);
                return;
        }
 
@@ -1323,11 +1272,6 @@ void MathCursor::interpret(string const & s)
                        return;
                }
 
-               if (lastcode_ == LM_TC_TEXTRM) {
-                       insert(c, LM_TC_TEXTRM);
-                       return;
-               }
-
                if (mathcursor->popRight())
                        return;
 
@@ -1338,22 +1282,59 @@ void MathCursor::interpret(string const & s)
                return;
        }
 
-       if (c == '\'' || c == '@') {
-               insert(c, LM_TC_VAR);
+       if (lastcode_ == LM_TC_TEX) {
+               if (macroName().empty()) {
+                       insert(c, LM_TC_TEX);
+                       if (!isalpha(c)) {
+                               macroModeClose();
+                               lastcode_ = LM_TC_VAR;
+                       }
+               } else {
+                       if (isalpha(c))
+                               insert(c, LM_TC_TEX);
+                       else {
+                               macroModeClose();
+                               lastcode_ = LM_TC_VAR;
+                       }
+               }
                return;
        }
 
-       if (c == '\\') {
-               lastcode_ = LM_TC_TEX;
-               //bv->owner()->message(_("TeX mode"));
+       if (c == '{') {
+               niceInsert(new MathScopeInset);
+               return;
+       }
+
+       if (c == '}') // ignore it
+               return;
+
+       if (isalpha(c) && (lastcode_ == LM_TC_GREEK || lastcode_ == LM_TC_GREEK1)) {
+               static char const greek[26] =
+                       {'A', 'B', 'X',  0 , 'E',  0 ,  0 , 'H', 'I',  0 ,
+                        'K',  0 , 'M', 'N', 'O',  0 ,  0 , 'P',  0 , 'T',
+                        0,  0,   0,   0,   0 , 'Z' };
+                       
+               MathTextCodes code = LM_TC_SYMB;
+               if ('A' <= c && c <= 'Z' && greek[c - 'A']) {
+                       code = LM_TC_RM;
+                       c = greek[c - 'A'];
+               }
+               insert(c, code);
+       
+#warning greek insert problem? look here!
+               //if (lastcode_ == LM_TC_GREEK1)
+                       lastcode_ = LM_TC_VAR;
                return; 
        }
 
-       if (isalpha(c)) {
-               insert(c, lastcode_);
+       if (c == '\\') {
+               lastcode_ = LM_TC_TEX;
+               //bv->owner()->message(_("TeX mode"));
                return; 
        }
 
+       // no special circumstances, so insert the character without any fuss
+       insert(c);
 }
 
 
index c4dad63ebcff55ab7b46852a3ff5d03d1006ac8d..3df99f029102ea6557901c4c8d7db15d42e5d87c 100755 (executable)
@@ -4,7 +4,8 @@
 # a given macro.
 #
 # Call it with  texify '\macro' [...] to get a line per item giving ascent,
-# descent, width and the primitives that TeX would use to typeset the item
+# descent, width, the font and the position in the font TeX would use to
+# typeset the symbol.
 
 # Original script:
 #\batchmode
@@ -42,7 +43,9 @@ foreach item $::argv {
        set f [open $filebase.log r]
        while {![eof $f]} {
                gets $f line
+               # try to interpret it as a hbox line
                regexp $hboxexp $line dummy ascent descent width
+               # try to interpret it as a font line
                regexp $fontexp $line dummy font char
        }
        close $f