]> git.lyx.org Git - features.git/commitdiff
Few math fonts improvements (use cmr for uppercase greek, support for
authorDekel Tsur <dekelts@tau.ac.il>
Fri, 31 Aug 2001 21:15:57 +0000 (21:15 +0000)
committerDekel Tsur <dekelts@tau.ac.il>
Fri, 31 Aug 2001 21:15:57 +0000 (21:15 +0000)
\mathbb)

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

24 files changed:
src/ChangeLog
src/FontInfo.C
src/FontLoader.C
src/FontLoader.h
src/frontends/xforms/MathsSymbols.C
src/lyxfont.C
src/lyxfont.h
src/mathed/ChangeLog
src/mathed/Makefile.am
src/mathed/formulabase.C
src/mathed/math_bigopinset.C [deleted file]
src/mathed/math_bigopinset.h [deleted file]
src/mathed/math_charinset.C
src/mathed/math_defs.h
src/mathed/math_factory.C
src/mathed/math_hash.C
src/mathed/math_macrotable.C
src/mathed/math_noglyphinset.C [deleted file]
src/mathed/math_noglyphinset.h [deleted file]
src/mathed/math_notinset.C
src/mathed/math_parser.h
src/mathed/math_symbolinset.C
src/mathed/math_symbolinset.h
src/mathed/support.C

index fb236df1aea00df60a028a622aebc58db3f63ffb..2ad6f9ee4dd14f749cdafc37b015cc888e0a5914 100644 (file)
@@ -1,3 +1,7 @@
+2001-09-01  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * FontLoader.C: Support for cmr font.
+
 2001-08-31  Dekel Tsur  <dekelts@tau.ac.il>
 
        * FontLoader.C (getFontinfo): Handle latex symbol fonts.
index 03e00a7d4077c716ab495214a41e3ab941859b6b..486f4ca03aaec13e80a961b09799a81664453b84 100644 (file)
@@ -134,6 +134,8 @@ void FontInfo::query()
                // We have matches. Run them through
                for (int i = 0; i < matches; ++i) {
                        string name(list[i]);
+                       lyxerr[Debug::FONT] << "match #" << i << " "
+                                           << name << endl; 
                        sizes[i] = lyx::atoi(token(name, '-', 7));
                        strings[i] = name;
                        if (sizes[i] == 0) {
index 760013b63a6ccb1a9a20ab311ce22033fe64cc6b..d45e58949e30061a90de31bb2cd67f471142b395 100644 (file)
@@ -60,7 +60,7 @@ void FontLoader::update()
 void FontLoader::reset()
 {
        // Clear font infos, font structs and font metrics
-       for (int i1 = 0; i1 < 9; ++i1)
+       for (int i1 = 0; i1 < LyXFont::NUM_FAMILIES; ++i1)
                for (int i2 = 0; i2 < 2; ++i2)
                        for (int i3 = 0; i3 < 4; ++i3) {
                                fontinfo[i1][i2][i3] = 0;
@@ -75,7 +75,7 @@ void FontLoader::reset()
 void FontLoader::unload() 
 {
        // Unload all fonts
-       for (int i1 = 0; i1 < 9; ++i1)
+       for (int i1 = 0; i1 < LyXFont::NUM_FAMILIES; ++i1)
                for (int i2 = 0; i2 < 2; ++i2)
                        for (int i3 = 0; i3 < 4; ++i3) {
                                if (fontinfo[i1][i2][i3]) {
@@ -111,6 +111,11 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family,
                                new FontInfo("-*-symbol-*-*-*-*-*-*-*-*-*-*-*-*");
                        return;
 
+               case LyXFont::CMR_FAMILY:
+                       fontinfo[family][series][shape] =
+                               new FontInfo("-*-cmr-medium-*-*-*-*-*-*-*-*-*-*-*");
+                       return;
+
                case LyXFont::CMSY_FAMILY:
                        fontinfo[family][series][shape] =
                                new FontInfo("-*-cmsy-*-*-*-*-*-*-*-*-*-*-*-*");
index 9ddd8e1f3ae233e579d8206685da8e20148da15c..66e1676068c11b54cb620892b4e68bd305bddf34 100644 (file)
@@ -53,10 +53,10 @@ public:
        
 private:
        /// Array of font structs
-       XFontStruct * fontstruct[9][2][4][10];
+       XFontStruct * fontstruct[LyXFont::NUM_FAMILIES][2][4][10];
 
        /// Array of font infos
-       FontInfo * fontinfo[9][2][4];
+       FontInfo * fontinfo[LyXFont::NUM_FAMILIES][2][4];
 
        /// Reset font handler
        void reset();
index 0278edc4e8e265cba133da5717dbe095b038a2d8..188ebe7bae200d7a70b6db06cf9373afae4740bf 100644 (file)
@@ -301,8 +301,13 @@ char const ** get_pixmap_from_symbol(char const * arg, int wx, int hx)
        case LM_TK_SQRT:
                data = mathed_get_pixmap_from_icon(MM_SQRT);
                break;
-       case LM_TK_BIGSYM:
        case LM_TK_SYM:
+       case LM_TK_CMR:
+       case LM_TK_CMSY:
+       case LM_TK_CMEX:
+       case LM_TK_CMM:
+       case LM_TK_MSA:
+       case LM_TK_MSB:
                // I have to use directly the bitmap data since the
                // bitmap tables are not yet created when this
                // function is called.
index 7e4014b74feffbcb73abe920c237b2ff403322ce..927ce95e835c46db94e21fcf6de4755c84dd82ff 100644 (file)
@@ -39,9 +39,9 @@ using std::strlen;
 
 namespace {
 
-char const * GUIFamilyNames[11] = 
+char const * GUIFamilyNames[12] = 
 { N_("Roman"), N_("Sans serif"), N_("Typewriter"), N_("Symbol"),
-  "cmsy", "cmm", "cmex", "msa", "msb",
+  "cmr", "cmsy", "cmm", "cmex", "msa", "msb",
   N_("Inherit"), N_("Ignore") };
 
 char const * GUISeriesNames[4] = 
@@ -63,9 +63,9 @@ char const * GUIMiscNames[5] =
 //
 // Strings used to read and write .lyx format files
 //
-char const * LyXFamilyNames[11] = 
+char const * LyXFamilyNames[12] = 
 { "roman", "sans", "typewriter", "symbol",
-  "cmsy", "cmm", "cmex", "msa", "msb",
+  "cmr", "cmsy", "cmm", "cmex", "msa", "msb",
   "default", "error" };
 
 char const * LyXSeriesNames[4] = 
index d230cfa6b4f54a252f56ef71119d9db1b0c7f059..4bd9ad0e9549fadcf6305dc6eec08f510d6ecfd4 100644 (file)
@@ -45,6 +45,8 @@ public:
                ///
                SYMBOL_FAMILY,
                ///
+               CMR_FAMILY,
+               ///
                CMSY_FAMILY,
                ///
                CMM_FAMILY,
@@ -57,7 +59,9 @@ public:
                ///
                INHERIT_FAMILY,
                ///
-               IGNORE_FAMILY
+               IGNORE_FAMILY,
+               ///
+               NUM_FAMILIES = INHERIT_FAMILY
        };
 
        ///
index 5008d127e91e0e073ba7f2c9b6ce804b2c8119a7..652c517fca6ca8b1566bb5d4a9f89eba2accf491 100644 (file)
@@ -1,3 +1,12 @@
+2001-09-01  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * support.C (whichFont): Add support for cmr font.
+       Add support for \mathbb.
+
+       * math_notinset.C (draw, metrics): Use cmsy symbol if available.
+
+       * math_macrotable.C (builtinMacros): Add 3 builtin macros
+
 2001-08-31  Dekel Tsur  <dekelts@tau.ac.il>
 
        * math_hash.C: Read symbols information from external file
index aa18fccd2b2c811f41051122737728c65961487f..5ffdd9c7e5a0ec5482c973f0c97eee0c52be924a 100644 (file)
@@ -22,8 +22,6 @@ libmathed_la_SOURCES = \
        formulamacro.h \
        math_arrayinset.C \
        math_arrayinset.h \
-       math_bigopinset.C \
-       math_bigopinset.h \
        math_binominset.C \
        math_binominset.h \
        math_charinset.C \
@@ -70,8 +68,6 @@ libmathed_la_SOURCES = \
        math_nestinset.h \
        math_notinset.C \
        math_notinset.h \
-       math_noglyphinset.C \
-       math_noglyphinset.h \
        math_parser.C \
        math_parser.h \
        math_rootinset.C \
index 5caf39373865de065313de937824156fc60d1b16..48e92c0d2826ccdbd0126e622fd45ba7e7e2197e 100644 (file)
@@ -523,6 +523,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
        case LFUN_EMPH:         handleFont(bv, LM_TC_CAL); break;
        case LFUN_ROMAN:        handleFont(bv, LM_TC_RM); break;
        case LFUN_CODE:         handleFont(bv, LM_TC_TT); break;
+       case LFUN_NOUN:         handleFont(bv, LM_TC_BB); break;
        case LFUN_DEFAULT:      handleFont(bv, LM_TC_VAR); break;
 
        case LFUN_MATH_MODE:
diff --git a/src/mathed/math_bigopinset.C b/src/mathed/math_bigopinset.C
deleted file mode 100644 (file)
index e714943..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "math_bigopinset.h"
-#include "mathed/math_parser.h"
-#include "mathed/support.h"
-#include "support/LOstream.h"
-
-
-using std::ostream;
-
-MathBigopInset::MathBigopInset(const latexkeys * l)
-       : sym_(l)
-{}
-
-
-MathInset * MathBigopInset::clone() const
-{
-       return new MathBigopInset(*this);
-}
-
-
-void MathBigopInset::write(ostream & os, bool /* fragile */) const
-{
-       os << '\\' << sym_->name << ' ';
-}
-
-
-void MathBigopInset::writeNormal(ostream & os) const
-{
-       os << "[bigop " << sym_->name << "] ";
-}
-
-
-void MathBigopInset::metrics(MathStyles st) const
-{
-       size_ = st;
-       mathed_char_dim(LM_TC_BSYM, st, sym_->id, ascent_, descent_, width_);
-}
-
-
-void MathBigopInset::draw(Painter & pain, int x, int y) const
-{  
-       xo(x);
-       yo(y);
-       drawChar(pain, LM_TC_BSYM, size_, x, y, sym_->id);
-}
diff --git a/src/mathed/math_bigopinset.h b/src/mathed/math_bigopinset.h
deleted file mode 100644 (file)
index 66f30e2..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// -*- C++ -*-
-#ifndef MATH_BIGOPINSET_H
-#define MATH_BIGOPINSET_H
-
-// This inset is for things like "\sum" and "\int" that get displayed
-// larger in displayed formulae and take limits
-
-#include "math_diminset.h"
-
-struct latexkeys;
-
-/// big operators
-class MathBigopInset : public MathDimInset {
-public:
-       ///
-       explicit MathBigopInset(latexkeys const *);
-       ///
-       MathInset * clone() const;
-       ///
-       void write(std::ostream &, bool fragile) const;
-       ///
-       void writeNormal(std::ostream &) const;
-       ///
-       void metrics(MathStyles st) const;
-       ///
-       void draw(Painter &, int x, int y) const;
-       ///
-       bool isScriptable() const { return true; }
-
-private:
-       ///
-       latexkeys const * sym_;
-};
-#endif
index 898868b9a3edca89ff0ddf6b61107e9516ab7572..8c1ca673b471622479b59a6d132ad8aaa4c5c7e6 100644 (file)
@@ -19,6 +19,7 @@ char const * math_font_name[] = {
        "mathrm",
        "mathcal",
        "mathbf",
+       "mathbb",
        "mathsf",
        "mathtt",
        "mathit",
index c42578fa0a8bce81a7ddb4ade00be82e777b7f4f..5fd004fca3ec179103ed3f86795a452c32f63b26 100644 (file)
@@ -65,6 +65,8 @@ enum MathTextCodes  {
        LM_TC_CAL,
        ///
        LM_TC_BF,
+       //
+       LM_TC_BB,
        ///
        LM_TC_SF,
        ///
@@ -82,7 +84,9 @@ enum MathTextCodes  {
        /// Internal code for symbols
        LM_TC_SYMB,
        /// internal code for symbols that get bigger in displayed math
-       LM_TC_BSYM,
+       LM_TC_BOLDSYMB,
+       ///
+       LM_TC_CMR,
        ///
        LM_TC_CMSY,
        ///
index fae6732e9227b8f090e7073b9a46511ab5db8448..01df5f283837628055634c885b90543d0b3d06e7 100644 (file)
@@ -1,7 +1,6 @@
 #include <config.h>
 
 #include "math_parser.h"
-#include "math_bigopinset.h"
 #include "math_binominset.h"
 #include "math_decorationinset.h"
 #include "math_dotsinset.h"
@@ -11,7 +10,6 @@
 #include "math_kerninset.h"
 #include "math_macro.h"
 #include "math_macrotable.h"
-#include "math_noglyphinset.h"
 #include "math_notinset.h"
 #include "math_rootinset.h"
 #include "math_spaceinset.h"
 MathInset * createMathInset(latexkeys const * l)
 {
        switch (l->token) {
-       case LM_TK_NOGLYPH:
-       case LM_TK_NOGLYPHB:
-               return new MathNoglyphInset(l);
-       case LM_TK_BIGSYM:
-               return new MathBigopInset(l);
        case LM_TK_FUNCLIM:
                return new MathFuncLimInset(l);
        case LM_TK_SPECIAL:
                return new MathSpecialCharInset(l->id);
        case LM_TK_SYM:
+       case LM_TK_CMR:
        case LM_TK_CMSY:
        case LM_TK_CMM:
        case LM_TK_CMEX:
index 17833dc609ac59cc4f93e70f8df385f61e9126d0..0ddfd118e415e931de3357c5c1e6ba6290a575e2 100644 (file)
@@ -26,122 +26,121 @@ struct latexkeys_a {
        short token;
        ///
        unsigned int id;
-       ///
-       MathSymbolTypes type;
 };
 
 latexkeys_a wordlist_array[] = 
 {
-       {"!",  LM_TK_SPACE, 0, LMB_NONE},
-       {"#",  LM_TK_SPECIAL, '#', LMB_NONE},
-       {"$",  LM_TK_SPECIAL, '$', LMB_NONE},
-       {"%",  LM_TK_SPECIAL, '%', LMB_NONE},
-       {"&",  LM_TK_SPECIAL, '&', LMB_NONE},
-       {"(",  LM_TK_BEGIN, LM_OT_SIMPLE, LMB_NONE},
-       {")",  LM_TK_END, LM_OT_SIMPLE, LMB_NONE},
-       {",",  LM_TK_SPACE, 1, LMB_NONE},
-       {".",  LM_TK_SPECIAL, '.', LMB_NONE},
-       {":",  LM_TK_SPACE, 2, LMB_NONE},
-       {";",  LM_TK_SPACE, 3, LMB_NONE},
-       {"Pr",  LM_TK_FUNCLIM, 0, LMB_NONE},
-       {"[",  LM_TK_BEGIN, LM_OT_EQUATION, LMB_NONE},
-       {"\\",  LM_TK_NEWLINE, static_cast<unsigned>(-1), LMB_NONE}, // -1 needed in mathed_parse_lines!
-       {"]",  LM_TK_END, LM_OT_EQUATION, LMB_NONE},
-       {"_",  LM_TK_SPECIAL, '_', LMB_NONE},
-       {"acute",  LM_TK_DECORATION, LM_acute, LMB_NONE},
-       {"arccos",  LM_TK_FUNC, 0, LMB_NONE},
-       {"arcsin",  LM_TK_FUNC, 0, LMB_NONE},
-       {"arctan",  LM_TK_FUNC, 0, LMB_NONE},
-       {"arg",  LM_TK_FUNC, 0, LMB_NONE},
-       {"atop",  LM_TK_ATOP, 0, LMB_NONE},
-       {"backslash",  LM_TK_SPECIAL, '\\', LMB_NONE},
-       {"bar",  LM_TK_DECORATION, LM_bar, LMB_NONE},
-       {"begin",  LM_TK_BEGIN, 0, LMB_NONE},
-       {"binom",  LM_TK_BINOM, 0, LMB_NONE},
-       {"bmod",  LM_TK_FUNC, 0, LMB_NONE},
-       {"breve",  LM_TK_DECORATION, LM_breve, LMB_NONE},
-       {"cal",  LM_TK_OLDFONT, LM_TC_CAL, LMB_OPERATOR},
-       {"cdots",  LM_TK_DOTS, LM_cdots, LMB_NONE},
-       {"check",  LM_TK_DECORATION, LM_check, LMB_NONE},
-       {"choose",  LM_TK_CHOOSE, 0, LMB_NONE},
-       {"cos",  LM_TK_FUNC, 0, LMB_NONE},
-       {"cosh",  LM_TK_FUNC, 0, LMB_NONE},
-       {"cot",  LM_TK_FUNC, 0, LMB_NONE},
-       {"coth",  LM_TK_FUNC, 0, LMB_NONE},
-       {"csc",  LM_TK_FUNC, 0, LMB_NONE},
-       {"ddot",  LM_TK_DECORATION, LM_ddot, LMB_NONE},
-       {"ddots",  LM_TK_DOTS, LM_ddots, LMB_NONE},
-       {"deg",  LM_TK_FUNC, 0, LMB_NONE},
-       {"det",  LM_TK_FUNCLIM, 0, LMB_NONE},
-       {"dim",  LM_TK_FUNC, 0, LMB_NONE},
-       //{"displaystyle",  LM_TK_STY, LM_ST_DISPLAY, LMB_NONE},
-       {"dot",  LM_TK_DECORATION, LM_dot, LMB_NONE},
-       {"end",  LM_TK_END, 0, LMB_NONE},
-       {"exp",  LM_TK_FUNC, 0, LMB_NONE},
-       {"frac",  LM_TK_FRAC, 0, LMB_NONE},
-       {"gcd",  LM_TK_FUNCLIM, 0, LMB_NONE},
-       {"grave",  LM_TK_DECORATION, LM_grave, LMB_NONE},
-       {"hat",  LM_TK_DECORATION, LM_hat, LMB_NONE},
-       {"hom",  LM_TK_FUNC, 0, LMB_NONE},
-       {"inf",  LM_TK_FUNCLIM, 0, LMB_NONE},
-       {"ker",  LM_TK_FUNC, 0, LMB_NONE},
-       {"kern",  LM_TK_KERN, 0, LMB_NONE},
-       {"label",  LM_TK_LABEL, 0, LMB_NONE},
-       {"ldots",  LM_TK_DOTS, LM_ldots, LMB_NONE},
-       {"left",  LM_TK_LEFT, 0, LMB_NONE},
-       {"lg",  LM_TK_FUNC, 0, LMB_NONE},
-       {"lim",  LM_TK_FUNCLIM, 0, LMB_NONE},
-       {"liminf",  LM_TK_FUNCLIM, 0, LMB_NONE},
-       {"limits",  LM_TK_LIMIT, 1 , LMB_NONE},
-       {"limsup",  LM_TK_FUNCLIM, 0, LMB_NONE},
-       {"ln",  LM_TK_FUNC, 0, LMB_NONE},
-       {"log",  LM_TK_FUNC, 0, LMB_NONE},
-       {"mathbf",  LM_TK_FONT, LM_TC_BF, LMB_NONE},
-       {"mathcal",  LM_TK_FONT, LM_TC_CAL, LMB_NONE},
-       {"mathit",  LM_TK_FONT, LM_TC_IT, LMB_NONE},
-       {"mathnormal",  LM_TK_FONT, LM_TC_VAR, LMB_NONE},
-       {"mathrm",  LM_TK_FONT, LM_TC_RM, LMB_NONE},
-       {"mathsf",  LM_TK_FONT, LM_TC_SF, LMB_NONE},
-       {"mathtt",  LM_TK_FONT, LM_TC_TT, LMB_NONE},
-       {"max",  LM_TK_FUNCLIM, 0, LMB_NONE},
-       {"min",  LM_TK_FUNCLIM, 0, LMB_NONE},
-       {"newcommand",  LM_TK_NEWCOMMAND, 0 , LMB_NONE},
-       {"nolimits",  LM_TK_LIMIT, static_cast<unsigned>(-1), LMB_NONE},
-       {"nonumber",  LM_TK_NONUM, 0, LMB_NONE},
-       {"not",  LM_TK_NOT, LM_not, LMB_NONE},
-       {"over",  LM_TK_OVER, 0, LMB_NONE},
-       {"overbrace",  LM_TK_DECORATION, LM_overbrace, LMB_NONE},
-       {"overleftarrow",  LM_TK_DECORATION, LM_overleftarrow, LMB_NONE},
-       {"overline",  LM_TK_DECORATION, LM_overline, LMB_NONE},
-       {"overrightarrow",  LM_TK_DECORATION, LM_overightarrow, LMB_NONE},
-       {"protect",  LM_TK_PROTECT, 0, LMB_RELATION},
-       {"qquad",  LM_TK_SPACE, 5, LMB_NONE},
-       {"quad",  LM_TK_SPACE, 4, LMB_NONE},
-       {"right",  LM_TK_RIGHT, 0, LMB_NONE},
-       {"root",  LM_TK_ROOT, 0, LMB_NONE},
-       //{"scriptscriptstyle",  LM_TK_STY, LM_ST_SCRIPTSCRIPT, LMB_NONE},
-       //{"scriptstyle",  LM_TK_STY, LM_ST_SCRIPT, LMB_NONE},
-       {"sec",  LM_TK_FUNC, 0, LMB_NONE},
-       {"sin",  LM_TK_FUNC, 0, LMB_NONE},
-       {"sinh",  LM_TK_FUNC, 0, LMB_NONE},
-       {"sqrt",  LM_TK_SQRT, 0, LMB_NONE},
-       {"stackrel",  LM_TK_STACK, 0, LMB_NONE},
-       {"sup",  LM_TK_FUNCLIM, 0, LMB_NONE},
-       {"tan",  LM_TK_FUNC, 0, LMB_NONE},
-       {"tanh",  LM_TK_FUNC, 0, LMB_NONE},
-       {"textrm",  LM_TK_FONT, LM_TC_TEXTRM, LMB_NONE},
-       //{"textstyle",  LM_TK_STY, LM_ST_TEXT, LMB_NONE},
-       {"tilde",  LM_TK_DECORATION, LM_tilde, LMB_NONE},
-       {"underbrace",  LM_TK_DECORATION, LM_underbrace, LMB_NONE},
-       {"underline",  LM_TK_DECORATION, LM_underline, LMB_NONE},
-       {"vdots",  LM_TK_DOTS, LM_vdots, LMB_NONE},
-       {"vec",  LM_TK_DECORATION, LM_vec, LMB_NONE},
-       {"widehat",  LM_TK_DECORATION, LM_widehat, LMB_NONE},
-       {"widetilde",  LM_TK_DECORATION, LM_widetilde, LMB_NONE},
-       {"{",  LM_TK_SPECIAL, '{', LMB_NONE},
-       {"|",  LM_TK_UNDEF, '|', LMB_NONE},
-       {"}",  LM_TK_SPECIAL, '}', LMB_NONE},
-       {"", LM_TK_SPECIAL, 0, LMB_NONE}
+       {"!",  LM_TK_SPACE, 0},
+       {"#",  LM_TK_SPECIAL, '#'},
+       {"$",  LM_TK_SPECIAL, '$'},
+       {"%",  LM_TK_SPECIAL, '%'},
+       {"&",  LM_TK_SPECIAL, '&'},
+       {"(",  LM_TK_BEGIN, LM_OT_SIMPLE},
+       {")",  LM_TK_END, LM_OT_SIMPLE},
+       {",",  LM_TK_SPACE, 1},
+       {".",  LM_TK_SPECIAL, '.'},
+       {":",  LM_TK_SPACE, 2},
+       {";",  LM_TK_SPACE, 3},
+       {"Pr",  LM_TK_FUNCLIM, 0},
+       {"[",  LM_TK_BEGIN, LM_OT_EQUATION},
+       {"\\",  LM_TK_NEWLINE, static_cast<unsigned>(-1)}, // -1 needed in mathed_parse_lines!
+       {"]",  LM_TK_END, LM_OT_EQUATION},
+       {"_",  LM_TK_SPECIAL, '_'},
+       {"acute",  LM_TK_DECORATION, LM_acute},
+       {"arccos",  LM_TK_FUNC, 0},
+       {"arcsin",  LM_TK_FUNC, 0},
+       {"arctan",  LM_TK_FUNC, 0},
+       {"arg",  LM_TK_FUNC, 0},
+       {"atop",  LM_TK_ATOP, 0},
+       {"backslash",  LM_TK_SPECIAL, '\\'},
+       {"bar",  LM_TK_DECORATION, LM_bar},
+       {"begin",  LM_TK_BEGIN, 0},
+       {"binom",  LM_TK_BINOM, 0},
+       {"bmod",  LM_TK_FUNC, 0},
+       {"breve",  LM_TK_DECORATION, LM_breve},
+       {"cal",  LM_TK_OLDFONT, LM_TC_CAL},
+       {"cdots",  LM_TK_DOTS, LM_cdots},
+       {"check",  LM_TK_DECORATION, LM_check},
+       {"choose",  LM_TK_CHOOSE, 0},
+       {"cos",  LM_TK_FUNC, 0},
+       {"cosh",  LM_TK_FUNC, 0},
+       {"cot",  LM_TK_FUNC, 0},
+       {"coth",  LM_TK_FUNC, 0},
+       {"csc",  LM_TK_FUNC, 0},
+       {"ddot",  LM_TK_DECORATION, LM_ddot},
+       {"ddots",  LM_TK_DOTS, LM_ddots},
+       {"deg",  LM_TK_FUNC, 0},
+       {"det",  LM_TK_FUNCLIM, 0},
+       {"dim",  LM_TK_FUNC, 0},
+       //{"displaystyle",  LM_TK_STY, LM_ST_DISPLAY},
+       {"dot",  LM_TK_DECORATION, LM_dot},
+       {"end",  LM_TK_END, 0},
+       {"exp",  LM_TK_FUNC, 0},
+       {"frac",  LM_TK_FRAC, 0},
+       {"gcd",  LM_TK_FUNCLIM, 0},
+       {"grave",  LM_TK_DECORATION, LM_grave},
+       {"hat",  LM_TK_DECORATION, LM_hat},
+       {"hom",  LM_TK_FUNC, 0},
+       {"inf",  LM_TK_FUNCLIM, 0},
+       {"ker",  LM_TK_FUNC, 0},
+       {"kern",  LM_TK_KERN, 0},
+       {"label",  LM_TK_LABEL, 0},
+       {"ldots",  LM_TK_DOTS, LM_ldots},
+       {"left",  LM_TK_LEFT, 0},
+       {"lg",  LM_TK_FUNC, 0},
+       {"lim",  LM_TK_FUNCLIM, 0},
+       {"liminf",  LM_TK_FUNCLIM, 0},
+       {"limits",  LM_TK_LIMIT, 1 },
+       {"limsup",  LM_TK_FUNCLIM, 0},
+       {"ln",  LM_TK_FUNC, 0},
+       {"log",  LM_TK_FUNC, 0},
+       {"mathbb",  LM_TK_FONT, LM_TC_BB},
+       {"mathbf",  LM_TK_FONT, LM_TC_BF},
+       {"mathcal",  LM_TK_FONT, LM_TC_CAL},
+       {"mathit",  LM_TK_FONT, LM_TC_IT},
+       {"mathnormal",  LM_TK_FONT, LM_TC_VAR},
+       {"mathrm",  LM_TK_FONT, LM_TC_RM},
+       {"mathsf",  LM_TK_FONT, LM_TC_SF},
+       {"mathtt",  LM_TK_FONT, LM_TC_TT},
+       {"max",  LM_TK_FUNCLIM, 0},
+       {"min",  LM_TK_FUNCLIM, 0},
+       {"newcommand",  LM_TK_NEWCOMMAND, 0 },
+       {"nolimits",  LM_TK_LIMIT, static_cast<unsigned>(-1)},
+       {"nonumber",  LM_TK_NONUM, 0},
+       {"not",  LM_TK_NOT, LM_not},
+       {"over",  LM_TK_OVER, 0},
+       {"overbrace",  LM_TK_DECORATION, LM_overbrace},
+       {"overleftarrow",  LM_TK_DECORATION, LM_overleftarrow},
+       {"overline",  LM_TK_DECORATION, LM_overline},
+       {"overrightarrow",  LM_TK_DECORATION, LM_overightarrow},
+       {"protect",  LM_TK_PROTECT, 0},
+       {"qquad",  LM_TK_SPACE, 5},
+       {"quad",  LM_TK_SPACE, 4},
+       {"right",  LM_TK_RIGHT, 0},
+       {"root",  LM_TK_ROOT, 0},
+       //{"scriptscriptstyle",  LM_TK_STY, LM_ST_SCRIPTSCRIPT},
+       //{"scriptstyle",  LM_TK_STY, LM_ST_SCRIPT},
+       {"sec",  LM_TK_FUNC, 0},
+       {"sin",  LM_TK_FUNC, 0},
+       {"sinh",  LM_TK_FUNC, 0},
+       {"sqrt",  LM_TK_SQRT, 0},
+       {"stackrel",  LM_TK_STACK, 0},
+       {"sup",  LM_TK_FUNCLIM, 0},
+       {"tan",  LM_TK_FUNC, 0},
+       {"tanh",  LM_TK_FUNC, 0},
+       {"textrm",  LM_TK_FONT, LM_TC_TEXTRM},
+       //{"textstyle",  LM_TK_STY, LM_ST_TEXT},
+       {"tilde",  LM_TK_DECORATION, LM_tilde},
+       {"underbrace",  LM_TK_DECORATION, LM_underbrace},
+       {"underline",  LM_TK_DECORATION, LM_underline},
+       {"vdots",  LM_TK_DOTS, LM_vdots},
+       {"vec",  LM_TK_DECORATION, LM_vec},
+       {"widehat",  LM_TK_DECORATION, LM_widehat},
+       {"widetilde",  LM_TK_DECORATION, LM_widetilde},
+       {"{",  LM_TK_SPECIAL, '{'},
+       {"|",  LM_TK_UNDEF, '|'},
+       {"}",  LM_TK_SPECIAL, '}'},
+       {"", LM_TK_SPECIAL, 0}
 };
 
 
@@ -159,7 +158,7 @@ void ReadSymbols(string const & filename)
                tmp.name   = p->name;
                tmp.token  = p->token;
                tmp.id     = p->id;
-               tmp.type   = p->type;
+               tmp.type   = LMB_NONE;
                tmp.latex_font_id = 0;
                wordlist.push_back(tmp);
        }
@@ -185,7 +184,9 @@ void ReadSymbols(string const & filename)
                if (lex.next())
                        type = lex.getString();
 
-               if (font == "cmsy")
+               if (font == "cmr")
+                       tmp.token = LM_TK_CMR;
+               else if (font == "cmsy")
                        tmp.token = LM_TK_CMSY;
                else if (font == "cmm")
                        tmp.token = LM_TK_CMM;
index 167b8fb809ee1da82c097c83c762d40e5cc04f07..0387ffae24d320bd7d16c897c33d7bf2a568b825 100644 (file)
@@ -100,6 +100,24 @@ void MathMacroTable::builtinMacros()
        createTemplate("gets",         0, "\\leftarrow");
        createTemplate("to",           0, "\\rightarrow");
 
+       createTemplate("longleftrightarrow", 0, "\\leftarrow\\kern-6mu\\rightarrow");
+       createTemplate("Longleftrightarrow", 0, "\\Leftarrow\\kern-6mu\\Rightarrow");
+       createTemplate("doteq", 0, "\\stackrel{\\cdot}{=}");
+
+#if 0
+       // The following either require using the latex fonts,
+       // or don't look good, so they are disabled
+
+       createTemplate("hookrightarrow", 0, "\\lhook\\kern-3mu\\rightarrow");
+       createTemplate("hookleftarrow",  0, "\\leftarrow\\kern-3mu\\rhook");
+       createTemplate("bowtie",         0, "\\triangleright\\kern-3mu\\triangleleft");
+
+       createTemplate("models",         0, "|\\kern-9mu=");
+       createTemplate("longrightarrow", 0, "-\\kern-9mu\\rightarrow");
+       createTemplate("longleftarrow",  0, "\\leftarrow\\kern-9mu-");
+       createTemplate("Longrightarrow", 0, "=\\kern-9mu\\Rightarrow");
+       createTemplate("Longleftarrow",  0, "\\Leftarrow\\kern-9mu=");
+
        //amsfonts.sty
 
        createTemplate("dasharrow",    0, "\\dashrightarrow");
@@ -115,12 +133,7 @@ void MathMacroTable::builtinMacros()
        createTemplate("doublecap",    0, "\\Cap");
        createTemplate("llless",       0, "\\lll");
        createTemplate("gggtr",        0, "\\ggg");
-
-// #ifdef WITH_WARNINGS
-// #warning 9em looks like too much but it is somehow working on screen..
-// #endif WITH_WARNINGS
-//     createTemplate("ll",           0, "<\\kern-9em<");
-//     createTemplate("gg",           0, ">\\kern-9em>");
+#endif
 
        //createTemplate("lint",       4, "\\int_#1^#2#3 d#4");
        //createTemplate("silentmult", 0, "\\cdot");
diff --git a/src/mathed/math_noglyphinset.C b/src/mathed/math_noglyphinset.C
deleted file mode 100644 (file)
index a62dc94..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "math_noglyphinset.h"
-#include "math_parser.h"
-#include "support.h"
-#include "support/LOstream.h"
-
-
-using std::ostream;
-
-MathNoglyphInset::MathNoglyphInset(const latexkeys * l)
-       : sym_(l)
-{}
-
-
-MathInset * MathNoglyphInset::clone() const
-{
-       return new MathNoglyphInset(*this);
-}
-
-
-void MathNoglyphInset::write(ostream & os, bool /* fragile */) const
-{
-       os << '\\' << sym_->name << ' ';
-}
-
-
-void MathNoglyphInset::writeNormal(ostream & os) const
-{
-       os << "[bigop " << sym_->name << "] ";
-}
-
-
-void MathNoglyphInset::metrics(MathStyles st) const
-{
-       size(st);
-       mathed_string_dim(LM_TC_TEX, st, sym_->name, ascent_, descent_, width_);
-}
-
-
-void MathNoglyphInset::draw(Painter & pain, int x, int y) const
-{  
-       xo(x);
-       yo(y);
-       drawStr(pain, LM_TC_TEX, size_, x, y, sym_->name);
-}
diff --git a/src/mathed/math_noglyphinset.h b/src/mathed/math_noglyphinset.h
deleted file mode 100644 (file)
index 70ec34b..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// -*- C++ -*-
-#ifndef MATH_NOGLYPHINSET_H
-#define MATH_NOGLYPHINSET_H
-
-#include "math_diminset.h"
-
-struct latexkeys;
-
-// "normal" symbols for which we don't have a glyph aailable to display
-// them properly
-
-class MathNoglyphInset : public MathDimInset {
-public:
-       ///
-       explicit MathNoglyphInset(latexkeys const *);
-       ///
-       MathInset * clone() const;
-       ///
-       void write(std::ostream &, bool fragile) const;
-       ///
-       void writeNormal(std::ostream &) const;
-       ///
-       void metrics(MathStyles st) const;
-       ///
-       void draw(Painter &, int x, int y) const;
-
-private:
-       ///
-       latexkeys const * sym_;
-};
-#endif
index 0d16cd900678e8dadf09cb25a83f77d956918bee..a187a3173fc91269ff38f90b9d268eb42f75b57a 100644 (file)
@@ -31,7 +31,12 @@ void MathNotInset::writeNormal(ostream & os) const
 void MathNotInset::metrics(MathStyles st) const
 {
        size(st);
-       mathed_char_dim(LM_TC_VAR, size_, '/', ascent_, descent_, width_);
+       if (math_font_available(LM_TC_CMSY))
+               mathed_char_dim(LM_TC_CMSY, size_, 54,
+                               ascent_, descent_, width_);
+               else
+                       mathed_char_dim(LM_TC_VAR, size_, '/',
+                                       ascent_, descent_, width_);
        width_ = 0;
 }
 
@@ -41,5 +46,8 @@ void MathNotInset::draw(Painter & pain, int x, int y) const
        xo(x);
        yo(y);
 
-       drawChar(pain, LM_TC_VAR, size_, x, y, '/');
+       if (math_font_available(LM_TC_CMSY))
+               drawChar(pain, LM_TC_CMSY, size_, x, y, 54);
+       else
+               drawChar(pain, LM_TC_VAR, size_, x, y, '/');
 }
index 27f647ead48b34a6cc6f92701ce044324368388d..e1b167a2d4bffde5fc5f7c8ca16f22e818a7e808 100644 (file)
@@ -75,11 +75,7 @@ enum MathTokenEnum
        ///
        LM_TK_FUNCLIM,
        ///
-       LM_TK_BIGSYM,
-       ///
-       LM_TK_NOGLYPH,
-       ///
-       LM_TK_NOGLYPHB,
+       LM_TK_CMR,
        ///
        LM_TK_CMSY,
        ///
index 9983df5dd6139c79ef4a55df1f33f196ca227ff5..cf39db7fc43d8f1034719ab7b2fdb154b4207b7f 100644 (file)
@@ -31,6 +31,8 @@ void MathSymbolInset::writeNormal(ostream & os) const
 MathTextCodes MathSymbolInset::code() const
 {
        switch(sym_->token) {
+       case LM_TK_CMR:
+               return LM_TC_CMR;
        case LM_TK_CMSY:
                return LM_TC_CMSY;
        case LM_TK_CMM:
@@ -46,6 +48,16 @@ MathTextCodes MathSymbolInset::code() const
        }
 }
 
+
+MathTextCodes MathSymbolInset::code2() const
+{
+       if (sym_->token == LM_TK_CMEX)
+               return LM_TC_BOLDSYMB;
+       else
+               return LM_TC_SYMB;
+}
+
+
 void MathSymbolInset::metrics(MathStyles st) const
 {
        size_ = st;
@@ -60,7 +72,7 @@ void MathSymbolInset::metrics(MathStyles st) const
                }
        } else if (sym_->id > 0 && sym_->id < 255 &&
                   math_font_available(LM_TC_SYMB)) {
-               mathed_char_dim(LM_TC_SYMB, size_, sym_->id,
+               mathed_char_dim(code2(), size_, sym_->id,
                                ascent_, descent_, width_);
        } else {
                mathed_string_dim(LM_TC_TEX, size_, sym_->name, ascent_, descent_, width_);
@@ -76,8 +88,8 @@ void MathSymbolInset::draw(Painter & pain, int x, int y) const
        if (sym_->latex_font_id > 0 && math_font_available(Code))
                drawChar(pain, Code, size_, x, y - h_, sym_->latex_font_id);
        else if (sym_->id > 0 && sym_->id < 255 &&
-                  math_font_available(LM_TC_SYMB))
-               drawChar(pain, LM_TC_SYMB, size_, x, y, sym_->id);
+                math_font_available(LM_TC_SYMB))
+               drawChar(pain, code2(), size_, x, y, sym_->id);
        else
                drawStr(pain, LM_TC_TEX, size_, x, y, sym_->name);
 }
index bd3b7b55b94d3a26befcd619aa82fbb34e93cb3b..68054886a4abac389067eb42979141d40b265c28 100644 (file)
@@ -31,6 +31,8 @@ public:
 private:
        ///
        MathTextCodes code() const;
+       ///
+       MathTextCodes code2() const;
 
        ///
        latexkeys const * sym_;
index e9c587e8e6c31ef9a98d4b164f4812b34865789f..ddb3719ff9fcac409c50c23a292da6fc30fb8e8d 100644 (file)
@@ -103,38 +103,61 @@ LyXFont * MathFonts = 0;
 bool font_available[LM_FONT_END];
 bool font_available_initialized[LM_FONT_END];
 
+enum MathFont {
+       FONT_IT,
+       FONT_SYMBOL,
+       FONT_SYMBOLI,
+       FONT_BF,
+       FONT_BB,
+       FONT_CAL,
+       FONT_TT,
+       FONT_RM,
+       FONT_SF,
+       FONT_CMR,
+       FONT_CMSY,
+       FONT_CMM,
+       FONT_CMEX,
+       FONT_MSA,
+       FONT_MSB,
+       FONT_NUM
+};
+
 void mathed_init_fonts()
 {
-       MathFonts = new LyXFont[13]; //DEC cxx cannot initialize all fonts
+       MathFonts = new LyXFont[FONT_NUM]; //DEC cxx cannot initialize all fonts
        //at once (JMarc) rc
 
-       for (int i = 0 ; i < 13 ; ++i) {
+       for (int i = 0 ; i < FONT_NUM ; ++i) {
                MathFonts[i] = LyXFont(LyXFont::ALL_SANE);
        }
 
-       MathFonts[0].setShape(LyXFont::ITALIC_SHAPE);
+       MathFonts[FONT_IT].setShape(LyXFont::ITALIC_SHAPE);
+
+       MathFonts[FONT_SYMBOL].setFamily(LyXFont::SYMBOL_FAMILY);
 
-       MathFonts[1].setFamily(LyXFont::SYMBOL_FAMILY);
+       MathFonts[FONT_SYMBOLI].setFamily(LyXFont::SYMBOL_FAMILY);
+       MathFonts[FONT_SYMBOLI].setShape(LyXFont::ITALIC_SHAPE);
 
-       MathFonts[2].setFamily(LyXFont::SYMBOL_FAMILY);
-       MathFonts[2].setShape(LyXFont::ITALIC_SHAPE);
+       MathFonts[FONT_BF].setSeries(LyXFont::BOLD_SERIES);
 
-       MathFonts[3].setSeries(LyXFont::BOLD_SERIES);
+       MathFonts[FONT_BB].setSeries(LyXFont::BOLD_SERIES);
+       MathFonts[FONT_BB].setFamily(LyXFont::TYPEWRITER_FAMILY);
 
-       MathFonts[4].setFamily(LyXFont::SANS_FAMILY);
-       MathFonts[4].setShape(LyXFont::ITALIC_SHAPE);
+       MathFonts[FONT_CAL].setFamily(LyXFont::SANS_FAMILY);
+       MathFonts[FONT_CAL].setShape(LyXFont::ITALIC_SHAPE);
 
-       MathFonts[5].setFamily(LyXFont::TYPEWRITER_FAMILY);
+       MathFonts[FONT_TT].setFamily(LyXFont::TYPEWRITER_FAMILY);
 
-       MathFonts[6].setFamily(LyXFont::ROMAN_FAMILY);
+       MathFonts[FONT_RM].setFamily(LyXFont::ROMAN_FAMILY);
 
-       MathFonts[7].setFamily(LyXFont::SANS_FAMILY);
+       MathFonts[FONT_SF].setFamily(LyXFont::SANS_FAMILY);
 
-       MathFonts[8].setFamily(LyXFont::CMSY_FAMILY);
-       MathFonts[9].setFamily(LyXFont::CMM_FAMILY);
-       MathFonts[10].setFamily(LyXFont::CMEX_FAMILY);
-       MathFonts[11].setFamily(LyXFont::MSA_FAMILY);
-       MathFonts[12].setFamily(LyXFont::MSB_FAMILY);
+       MathFonts[FONT_CMR].setFamily(LyXFont::CMR_FAMILY);
+       MathFonts[FONT_CMSY].setFamily(LyXFont::CMSY_FAMILY);
+       MathFonts[FONT_CMM].setFamily(LyXFont::CMM_FAMILY);
+       MathFonts[FONT_CMEX].setFamily(LyXFont::CMEX_FAMILY);
+       MathFonts[FONT_MSA].setFamily(LyXFont::MSA_FAMILY);
+       MathFonts[FONT_MSB].setFamily(LyXFont::MSB_FAMILY);
 
        for (int i = 0; i < LM_FONT_END; ++i)
                font_available_initialized[i] = false;
@@ -148,45 +171,57 @@ LyXFont const & whichFontBase(MathTextCodes type)
 
        switch (type) {
        case LM_TC_SYMB:        
-       case LM_TC_BSYM:        
-               return MathFonts[2];
+       case LM_TC_BOLDSYMB:    
+               return MathFonts[FONT_SYMBOLI];
 
        case LM_TC_VAR:
        case LM_TC_IT:
-               return MathFonts[0];
+               return MathFonts[FONT_IT];
 
        case LM_TC_BF:
-               return MathFonts[3];
+               return MathFonts[FONT_BF];
+
+       case LM_TC_BB:
+               if (math_font_available(LM_TC_MSB))
+                       return MathFonts[FONT_MSB];
+               else
+                       return MathFonts[FONT_BB];
 
        case LM_TC_CAL:
-               return MathFonts[4];
+               if (math_font_available(LM_TC_CMSY))
+                       return MathFonts[FONT_CMSY];
+               else
+                       return MathFonts[FONT_CAL];
 
        case LM_TC_TT:
-               return MathFonts[5];
+               return MathFonts[FONT_TT];
 
        case LM_TC_TEXTRM:
        case LM_TC_CONST:
        case LM_TC_TEX:
        case LM_TC_RM:
-               return MathFonts[6];
+               return MathFonts[FONT_RM];
 
        case LM_TC_SF:
-               return MathFonts[7];
+               return MathFonts[FONT_SF];
+
+       case LM_TC_CMR:
+               return MathFonts[FONT_CMR];
 
        case LM_TC_CMSY:
-               return MathFonts[8];
+               return MathFonts[FONT_CMSY];
 
        case LM_TC_CMM:
-               return MathFonts[9];
+               return MathFonts[FONT_CMM];
 
        case LM_TC_CMEX:
-               return MathFonts[10];
+               return MathFonts[FONT_CMEX];
 
        case LM_TC_MSA:
-               return MathFonts[11];
+               return MathFonts[FONT_MSA];
 
        case LM_TC_MSB:
-               return MathFonts[12];
+               return MathFonts[FONT_MSB];
 
        default:
                break;
@@ -201,7 +236,7 @@ LyXFont whichFont(MathTextCodes type, MathStyles size)
 
        switch (size) {
        case LM_ST_DISPLAY:
-               if (type == LM_TC_BSYM || type == LM_TC_CMEX) {
+               if (type == LM_TC_BOLDSYMB || type == LM_TC_CMEX) {
                        f.incSize();
                        f.incSize();
                }