#include "font.h"
#include "math_arrayinset.h"
#include "math_spaceinset.h"
+#include "math_scopeinset.h"
#include "math_macrotable.h"
#include "support/lyxlib.h"
#include "mathed/support.h"
if (greek_kb_flag < 2)
greek_kb_flag = 0;
- } else if (strchr("!,:;{}", c) && (varcode == LM_TC_TEX||was_macro)) {
+ } else if (c == '{') {
+ mathcursor->insert(new MathScopeInset);
+ mathcursor->left();
+ mathcursor->clearLastCode();
+ } else if (strchr("!,:;", c) && (varcode == LM_TC_TEX||was_macro)) {
mathcursor->insert(c, LM_TC_TEX);
- if (c == '{') {
- mathcursor->insert('}', LM_TC_TEX);
- mathcursor->left();
- }
mathcursor->clearLastCode();
} else if (c == '_' && varcode == LM_TC_TEX) {
mathcursor->insert(c, LM_TC_SPECIAL);
if (code_ >= LM_TC_RM && code_ <= LM_TC_TEXTRM)
os << '\\' << math_font_name[code_ - LM_TC_RM] << '{';
- if ((code_ == LM_TC_TEX && char_ != '{' && char_ != '}') ||
- (code_ == LM_TC_SPECIAL))
+ if (code_ == LM_TC_TEX || code_ == LM_TC_SPECIAL)
os << '\\';
os << char_;
{"bowtie", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"breve", LM_TK_DECORATION, LM_breve, LMB_NONE},
{"bullet", LM_TK_SYM, LM_bullet, LMB_OPERATOR},
+ {"cal", LM_TK_OLDFONT, LM_TC_CAL, LMB_OPERATOR},
{"cap", LM_TK_SYM, LM_cap, LMB_OPERATOR},
{"cdot", LM_TK_SYM, LM_cdot, LMB_OPERATOR},
{"cdots", LM_TK_DOTS, LM_cdots, LMB_NONE},
#include "math_matrixinset.h"
#include "math_noglyphinset.h"
#include "math_rootinset.h"
+#include "math_scopeinset.h"
+#include "math_sqrtinset.h"
#include "math_scriptinset.h"
#include "math_sizeinset.h"
#include "math_spaceinset.h"
FLAG_BRACE_LAST = 1 << 1, // // { Last } ends the parsing process
FLAG_RIGHT = 1 << 2, // Next right ends the parsing process
FLAG_END = 1 << 3, // Next end ends the parsing process
- FLAG_BRACE_FONT = 1 << 4, // // { Next } closes a font
FLAG_BRACK_END = 1 << 5, // // [ Next ] ends the parsing process
FLAG_AMPERSAND = 1 << 6, // Next & ends the parsing process
FLAG_NEWLINE = 1 << 7, // Next \\ ends the parsing process
break;
case LM_TK_OPEN:
- ++brace;
- if (flags & FLAG_BRACE)
- flags &= ~FLAG_BRACE;
- else
- array.push_back(new MathCharInset('{', LM_TC_TEX));
+ array.push_back(new MathScopeInset);
+ parse_into(array.back()->cell(0), FLAG_BRACE_LAST);
break;
case LM_TK_CLOSE:
- --brace;
- if (brace < 0) {
- error("Unmatching braces");
- panic = true;
- break;
- }
- if (flags & FLAG_BRACE_FONT) {
- yyvarcode = LM_TC_VAR;
- flags &= ~FLAG_BRACE_FONT;
- break;
- }
- if (brace == 0 && (flags & FLAG_BRACE_LAST))
+ if (flags & FLAG_BRACE_LAST) {
flags |= FLAG_LEAVE;
- else
- array.push_back(new MathCharInset('}', LM_TC_TEX));
+ }
break;
case '[':
break;
case LM_TK_FONT:
+ {
+ MathTextCodes t = static_cast<MathTextCodes>(lval_->id);
+ MathArray ar;
+ parse_into(ar, FLAG_ITEM);
+ for (MathArray::iterator it = ar.begin(); it != ar.end(); ++it)
+ (*it)->handleFont(t);
+ array.push_back(ar);
+ break;
+ }
+
+ case LM_TK_OLDFONT:
yyvarcode = static_cast<MathTextCodes>(lval_->id);
- flags |= (FLAG_BRACE | FLAG_BRACE_FONT);
break;
case LM_TK_STY:
LM_TK_NEWLINE,
///
LM_TK_UNDEF,
- ///
+ /// mathcal, mathrm...
+ LM_TK_OLDFONT,
+ /// cal,...
LM_TK_FONT,
///
LM_TK_LEFT,
#include "math_scopeinset.h"
#include "LColor.h"
#include "Painter.h"
+#include "support.h"
#include "support/LOstream.h"
{
xcell(0).metrics(st);
size_ = st;
- ascent_ = xcell(0).ascent() + 2;
- descent_ = xcell(0).descent() + 2;
- width_ = xcell(0).width() + 4;
+ ascent_ = xcell(0).ascent();
+ descent_ = xcell(0).descent();
+ width_ = xcell(0).width() + mathed_string_width(LM_TC_TEX, st, "{}");
}
{
xo(x);
yo(y);
- xcell(0).draw(pain, x + 2, y);
- pain.rectangle(x, y - ascent_, width_, height(), LColor::mathline);
+ int d = mathed_char_width(LM_TC_TEX, size_, '{');
+ drawChar(pain, LM_TC_TEX, size_, x, y, '{');
+ xcell(0).draw(pain, x + d, y);
+ drawChar(pain, LM_TC_TEX, size_, x + width_ - d, y, '}');
+ //pain.rectangle(x, y - ascent_, width_, height(), LColor::mathline);
}