Could anybody please try the attached patch and report failure or success?

Using this patch, I can see  \oint, \bigsqcup and \sqcup drawn on screen
using -*-cmex-*- and -*-amsa-*- fonts from the te_pscm rpm (requiered by
te_pdf.rpm) on my SuSE 6.1

I do not know how common they are, but I can't remember doing anything
special to get them, so I'd suppose "everybody has/can get them"

And: I do not exactly know what is happening (especially with the "encoding"
stuff in Painter.C), but it seems to work.

Andre'

-- 
André Pönitz ............................................. [EMAIL PROTECTED]
Index: FontLoader.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/FontLoader.C,v
retrieving revision 1.29
diff -u -p -r1.29 FontLoader.C
--- FontLoader.C        2001/08/03 18:28:03     1.29
+++ FontLoader.C        2001/08/22 08:56:20
@@ -60,7 +60,7 @@ void FontLoader::update()
 void FontLoader::reset()
 {
        // Clear font infos, font structs and font metrics
-       for (int i1 = 0; i1 < 4; ++i1)
+       for (int i1 = 0; i1 < 10; ++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 < 4; ++i1)
+       for (int i1 = 0; i1 < 10; ++i1)
                for (int i2 = 0; i2 < 2; ++i2)
                        for (int i3 = 0; i3 < 4; ++i3) {
                                if (fontinfo[i1][i2][i3]) {
@@ -103,11 +103,48 @@ void FontLoader::getFontinfo(LyXFont::FO
        if (fontinfo[family][series][shape] != 0)
                return;
 
-       // Special code for the symbol family
-       if (family == LyXFont::SYMBOL_FAMILY){
-               fontinfo[family][series][shape] = new FontInfo("-*-symbol-*");
-               return;
+       // Special fonts
+       switch (family) 
+       {
+               case LyXFont::SYMBOL_FAMILY:
+                       fontinfo[family][series][shape] =
+                               new FontInfo("-*-symbol-*-*-*-*-*-*-*-*-*-*-*-*");
+                       return;
+
+               case LyXFont::SYMBOLCM_FAMILY:
+                       fontinfo[family][series][shape] =
+                               new FontInfo("-*-cmsy-*-*-*-*-*-*-*-*-*-*-*-*");
+                       return;
+
+               case LyXFont::SYMBOLAMSA_FAMILY:
+                       fontinfo[family][series][shape] =
+                               new FontInfo("-*-msam-*-*-*-*-*-*-*-*-*-*-*-*");
+                       return;
+
+               case LyXFont::SYMBOLEX_FAMILY:
+                       fontinfo[family][series][shape] =
+                               new FontInfo("-*-cmex-*-*-*-*-*-*-*-*-*-*-*-*");
+                       return;
+
+               case LyXFont::FRAKTUR_FAMILY:
+                       fontinfo[family][series][shape] =
+                               new FontInfo("-*-eufrak-*-*-*-*-*-*-*-*-*-*-*-*");
+                       return;
+
+               case LyXFont::MATHSCR_FAMILY:
+                       fontinfo[family][series][shape] =
+                               new FontInfo("-*-eus-*-*-*-*-*-*-*-*-*-*-*-*");
+                       return;
+
+               case LyXFont::SYMBOLAMSB_FAMILY:
+                       fontinfo[family][series][shape] = 
+                               new FontInfo("-*-msbm-*-*-*-*-*-*-*-*-*-*-*-*");
+                       return;
+
+               default:
+                       break;
        }
+ 
 
        // Normal font. Let's search for an existing name that matches.
        string ffamily;
@@ -251,6 +288,7 @@ XFontStruct * FontLoader::doLoad(LyXFont
        XFontStruct * fs = 0;
 
        current_view->owner()->messagePush(_("Loading font into X-Server..."));
+       //lyxerr << "\nTrying to load font '" << font << "'\n";
 
        fs = XLoadQueryFont(GUIRunTime::x11Display(), font.c_str());
        
Index: FontLoader.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/FontLoader.h,v
retrieving revision 1.10
diff -u -p -r1.10 FontLoader.h
--- FontLoader.h        2001/07/03 14:15:39     1.10
+++ FontLoader.h        2001/08/22 08:56:20
@@ -50,10 +50,10 @@ public:
        };
 private:
        /// Array of font structs
-       XFontStruct * fontstruct[4][2][4][10];
+       XFontStruct * fontstruct[10][2][4][10];
 
        /// Array of font infos
-       FontInfo * fontinfo[4][2][4];
+       FontInfo * fontinfo[10][2][4];
 
        /// Reset font handler
        void reset();
Index: Painter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/Painter.C,v
retrieving revision 1.27
diff -u -p -r1.27 Painter.C
--- Painter.C   2001/08/03 18:28:03     1.27
+++ Painter.C   2001/08/22 08:56:20
@@ -284,7 +284,12 @@ PainterBase & Painter::text(int x, int y
                XChar2b * xs = new XChar2b[ls];
                Encoding const * encoding = f.language()->encoding();
                LyXFont font(f);
-               if (f.family() == LyXFont::SYMBOL_FAMILY) {
+               if (f.family() == LyXFont::SYMBOL_FAMILY ||
+                   f.family() == LyXFont::MATHSCR_FAMILY ||
+                   f.family() == LyXFont::FRAKTUR_FAMILY ||
+                   f.family() == LyXFont::SYMBOLEX_FAMILY ||
+                   f.family() == LyXFont::SYMBOLAMSA_FAMILY ||
+                               f.family() == LyXFont::SYMBOLAMSB_FAMILY) {
 #ifdef USE_UNICODE_FOR_SYMBOLS
                        font.setFamily(LyXFont::ROMAN_FAMILY);
                        font.setShape(LyXFont::UP_SHAPE);
Index: font.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/font.C,v
retrieving revision 1.17
diff -u -p -r1.17 font.C
--- font.C      2001/07/24 22:08:45     1.17
+++ font.C      2001/08/22 08:56:20
@@ -114,7 +114,11 @@ int lyxfont::width(char const * s, size_
                Encoding const * encoding = f.language()->encoding();
                //LyXFont const * font = &f;
                LyXFont font(f);
-               if (f.family() == LyXFont::SYMBOL_FAMILY) {
+               if (f.family() == LyXFont::SYMBOL_FAMILY ||
+                   f.family() == LyXFont::SYMBOLCM_FAMILY ||
+                   f.family() == LyXFont::SYMBOLAMSA_FAMILY ||
+                   f.family() == LyXFont::SYMBOLAMSB_FAMILY ||
+                   f.family() == LyXFont::SYMBOLEX_FAMILY) {
 #ifdef USE_UNICODE_FOR_SYMBOLS
                        //LyXFont font2 = f;
                        font.setFamily(LyXFont::ROMAN_FAMILY);
Index: lyxfont.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfont.C,v
retrieving revision 1.65
diff -u -p -r1.65 lyxfont.C
--- lyxfont.C   2001/08/11 18:31:11     1.65
+++ lyxfont.C   2001/08/22 08:56:20
@@ -33,16 +33,16 @@ using std::endl;
 using std::strlen;
 #endif
 
-
 //
 // Names for the GUI
 //
 
 namespace {
 
-char const * GUIFamilyNames[6] = 
-{ N_("Roman"), N_("Sans serif"), N_("Typewriter"), N_("Symbol"), N_("Inherit"),
-  N_("Ignore") };
+char const * GUIFamilyNames[12] = 
+{ N_("Roman"), N_("Sans serif"), N_("Typewriter"), N_("Symbol"),
+       N_("Symbol2"), N_("Symbol3"), N_("SymbolEx"), N_("Fraktur"),
+       N_("Mathscr"), N_("MathBB"), N_("Inherit"), N_("Ignore") };
 
 char const * GUISeriesNames[4] = 
 { N_("Medium"), N_("Bold"), N_("Inherit"), N_("Ignore") };
@@ -63,8 +63,9 @@ char const * GUIMiscNames[5] = 
 //
 // Strings used to read and write .lyx format files
 //
-char const * LyXFamilyNames[6] = 
-{ "roman", "sans", "typewriter", "symbol", "default", "error" };
+char const * LyXFamilyNames[12] = 
+{ "roman", "sans", "typewriter", "symbol", "symbol2", "symbol3", 
+       "symbolex", "fraktur", "mathscr", "mathbb", "default", "error" };
 
 char const * LyXSeriesNames[4] = 
 { "medium", "bold", "default", "error" };
Index: lyxfont.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfont.h,v
retrieving revision 1.41
diff -u -p -r1.41 lyxfont.h
--- lyxfont.h   2001/08/11 18:31:11     1.41
+++ lyxfont.h   2001/08/22 08:56:20
@@ -45,6 +45,18 @@ public:
                ///
                SYMBOL_FAMILY,
                ///
+               SYMBOLCM_FAMILY,
+               ///
+               SYMBOLAMSA_FAMILY,
+               ///
+               SYMBOLEX_FAMILY,
+               ///
+               FRAKTUR_FAMILY,
+               ///
+               MATHSCR_FAMILY,
+               ///
+               SYMBOLAMSB_FAMILY,
+               ///
                INHERIT_FAMILY,
                ///
                IGNORE_FAMILY
Index: mathed/math_defs.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_defs.h,v
retrieving revision 1.56
diff -u -p -r1.56 math_defs.h
--- mathed/math_defs.h  2001/08/17 15:47:02     1.56
+++ mathed/math_defs.h  2001/08/22 08:56:20
@@ -83,8 +83,20 @@ enum MathTextCodes  {
        LM_TC_GREEK1,
        /// Internal code for symbols
        LM_TC_SYMB,
-       /// Internal code for symbols that get bigger in displayed math
+       /// internal code for symbols that get bigger in displayed math
        LM_TC_BSYM,
+       /// 
+       LM_TC_SYMCM,
+       ///
+       LM_TC_SYMAMSA,
+       ///
+       LM_TC_SYMAMSB,
+       ///
+       LM_TC_SYMEX,
+       ///
+       LM_TC_MATHSCR,
+       ///
+       LM_TC_FRAKTUR,
        ///
        LM_FONT_END,
        
Index: mathed/math_factory.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_factory.C,v
retrieving revision 1.6
diff -u -p -r1.6 math_factory.C
--- mathed/math_factory.C       2001/08/21 14:20:50     1.6
+++ mathed/math_factory.C       2001/08/22 08:56:20
@@ -30,6 +30,12 @@ MathInset * createMathInset(latexkeys co
                        return new MathBigopInset(l);
                case LM_TK_FUNCLIM:
                        return new MathFuncLimInset(l);
+               case LM_TK_SYMAMSA: 
+               case LM_TK_SYMAMSB: 
+               case LM_TK_SYMEX: 
+               case LM_TK_SYMCM: 
+               case LM_TK_FRAKTUR: 
+               case LM_TK_MATHSCR: 
                case LM_TK_SYM: 
                        return new MathSymbolInset(l);
                case LM_TK_STACK:
Index: mathed/math_hash.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_hash.C,v
retrieving revision 1.43
diff -u -p -r1.43 math_hash.C
--- mathed/math_hash.C  2001/08/21 14:20:50     1.43
+++ mathed/math_hash.C  2001/08/22 08:56:20
@@ -15,7 +15,6 @@ namespace {
 
 latexkeys wordlist[] = 
 {
-       //{"oint",  LM_TK_BIGSYM, LM_oint, LMB_NONE},
        //{"pmod",  LM_TK_SYM, 0, LMB_NONE},
        {"!",  LM_TK_SPACE, 0, LMB_NONE},
        {"#",  LM_TK_SPECIAL, '#', LMB_NONE},
@@ -78,13 +77,15 @@ latexkeys wordlist[] = 
        {"bigodot",  LM_TK_NOGLYPHB, 0, LMB_NONE},
        {"bigoplus",  LM_TK_NOGLYPHB, 0, LMB_NONE},
        {"bigotimes",  LM_TK_NOGLYPHB, 0, LMB_NONE},
-       {"bigsqcup",  LM_TK_NOGLYPHB, 0, LMB_NONE},
+       {"bigsqcup",  LM_TK_SYMEX, 71, LMB_NONE},
        {"bigtriangledown",  LM_TK_NOGLYPH, 0, LMB_OPERATOR},
        {"bigtriangleup",  LM_TK_NOGLYPH, 0, LMB_OPERATOR},
        {"biguplus",  LM_TK_NOGLYPHB, 0, LMB_NONE},
        {"bigvee",  LM_TK_NOGLYPHB, 0, LMB_NONE},
        {"bigwedge",  LM_TK_NOGLYPHB, 0, LMB_NONE},
        {"binom",  LM_TK_BINOM, 0, LMB_NONE},
+       //
+       {"blacktriangledown", LM_TK_SYMAMSA, 0x48, 0},
        {"bmod",  LM_TK_FUNC, 0, LMB_NONE},
        {"bot",  LM_TK_SYM, LM_bot, LMB_NONE},
        {"bowtie",  LM_TK_NOGLYPH, 0, LMB_RELATION},
@@ -204,6 +205,7 @@ latexkeys wordlist[] = 
        {"nu",  LM_TK_SYM, LM_nu, LMB_NONE},
        {"nwarrow",  LM_TK_NOGLYPH, 0, LMB_NONE},
        {"odot",  LM_TK_NOGLYPH, 0, LMB_OPERATOR},
+       {"oint",  LM_TK_SYMEX, 72, LMB_NONE},
        {"omega",  LM_TK_SYM, LM_omega, LMB_NONE},
        {"ominus",  LM_TK_NOGLYPH, 0, LMB_OPERATOR},
        {"oplus",  LM_TK_SYM, LM_oplus, LMB_OPERATOR},
@@ -219,7 +221,8 @@ latexkeys wordlist[] = 
        {"phi",  LM_TK_SYM, LM_phi, LMB_NONE},
        {"pi",  LM_TK_SYM, LM_pi, LMB_NONE},
        {"pm",  LM_TK_SYM, LM_pm, LMB_OPERATOR},
-       {"prec",  LM_TK_NOGLYPH, 0, LMB_RELATION},
+//     {"prec",  LM_TK_NOGLYPH, 0, LMB_RELATION},
+//     {"prec",  LM_TK_SYMCM, 0xc2, LMB_RELATION},
        {"preceq",  LM_TK_NOGLYPH, 0, LMB_RELATION},
        {"prime",  LM_TK_SYM, LM_prime, LMB_NONE},
        {"prod",  LM_TK_BIGSYM, LM_prod, LMB_NONE},
@@ -252,7 +255,7 @@ latexkeys wordlist[] = 
        {"smile",  LM_TK_NOGLYPH, 0, LMB_RELATION},
        {"spadesuit",  LM_TK_SYM, LM_spadesuit, LMB_NONE},
        {"sqcap",  LM_TK_NOGLYPH, 0, LMB_OPERATOR},
-       {"sqcup",  LM_TK_NOGLYPH, 0, LMB_OPERATOR},
+       {"sqcup",  LM_TK_SYMEX, 70, LMB_OPERATOR},
        {"sqrt",  LM_TK_SQRT, 0, LMB_NONE},
        {"sqsubseteq",  LM_TK_NOGLYPH, 0, LMB_RELATION},
        {"sqsupseteq",  LM_TK_NOGLYPH, 0, LMB_RELATION},
Index: mathed/math_parser.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_parser.h,v
retrieving revision 1.29
diff -u -p -r1.29 math_parser.h
--- mathed/math_parser.h        2001/08/21 14:20:50     1.29
+++ mathed/math_parser.h        2001/08/22 08:56:20
@@ -81,6 +81,18 @@ enum MathTokenEnum
        ///
        LM_TK_NOGLYPHB,
        ///
+       LM_TK_SYMEX,
+       ///
+       LM_TK_SYMCM,
+       ///
+       LM_TK_SYMAMSA,
+       ///
+       LM_TK_SYMAMSB,
+       ///
+       LM_TK_FRAKTUR,
+       ///
+       LM_TK_MATHSCR,
+       ///
        LM_TK_LABEL,
        ///
        LM_TK_NONUM,
Index: mathed/math_symbolinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_symbolinset.C,v
retrieving revision 1.7
diff -u -p -r1.7 math_symbolinset.C
--- mathed/math_symbolinset.C   2001/08/16 12:34:48     1.7
+++ mathed/math_symbolinset.C   2001/08/22 08:56:20
@@ -7,7 +7,7 @@
 using std::ostream;
 
 MathSymbolInset::MathSymbolInset(const latexkeys * l)
-       : sym_(l)
+       : sym_(l), h_(0)
 {}
 
 
@@ -29,10 +29,32 @@ void MathSymbolInset::writeNormal(ostrea
 }
 
 
+MathTextCodes MathSymbolInset::code() const
+{
+       if (sym_->token == LM_TK_SYMAMSA)
+               return LM_TC_SYMAMSA;
+       if (sym_->token == LM_TK_SYMAMSB)
+               return LM_TC_SYMAMSB;
+       if (sym_->token == LM_TK_SYMEX)
+               return LM_TC_SYMEX;
+       if (sym_->token == LM_TK_FRAKTUR)
+               return LM_TC_FRAKTUR;
+       if (sym_->token == LM_TK_SYMCM)
+               return LM_TC_SYMCM;
+       if (sym_->token == LM_TK_MATHSCR)
+               return LM_TC_MATHSCR;
+       return LM_TC_SYMB;
+}
+
 void MathSymbolInset::metrics(MathStyles st) const
 {
        size(st);
-       mathed_char_dim(LM_TC_SYMB, size_, sym_->id, ascent_, descent_, width_);
+       mathed_char_dim(code(), size_, sym_->id, ascent_, descent_, width_);
+       if (code() != LM_TC_SYMB) {
+               h_ = -descent_;
+               ascent_  += h_;
+               descent_ -= h_;
+       }
 }
 
 
@@ -41,7 +63,7 @@ void MathSymbolInset::draw(Painter & pai
        xo(x);
        yo(y);
 
-       drawChar(pain, LM_TC_SYMB, size_, x, y, sym_->id);
+       drawChar(pain, code(), size_, x, y + h_, sym_->id);
 }
 
 
Index: mathed/math_symbolinset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_symbolinset.h,v
retrieving revision 1.6
diff -u -p -r1.6 math_symbolinset.h
--- mathed/math_symbolinset.h   2001/08/09 15:19:31     1.6
+++ mathed/math_symbolinset.h   2001/08/22 08:56:20
@@ -28,6 +28,11 @@ public:
 
 private:
        ///
+       MathTextCodes code() const;
+
+       ///
        latexkeys const * sym_;
+       ///
+       mutable int h_;
 };
 #endif
Index: mathed/support.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/support.C,v
retrieving revision 1.28
diff -u -p -r1.28 support.C
--- mathed/support.C    2001/08/17 15:47:02     1.28
+++ mathed/support.C    2001/08/22 08:56:20
@@ -102,30 +102,28 @@ LyXFont           * Math_Fonts = 0;
 
 void mathed_init_fonts()
 {
-       Math_Fonts = new LyXFont[8]; //DEC cxx cannot initialize all fonts
+       Math_Fonts = new LyXFont[13]; //DEC cxx cannot initialize all fonts
        //at once (JMarc) rc
 
-       for (int i = 0 ; i < 8 ; ++i) {
+       for (int i = 0 ; i < 13 ; ++i) {
                Math_Fonts[i] = LyXFont(LyXFont::ALL_SANE);
        }
 
        Math_Fonts[0].setShape(LyXFont::ITALIC_SHAPE);
-
-       Math_Fonts[1].setFamily(LyXFont::SYMBOL_FAMILY);
-
+       Math_Fonts[1].setFamily(LyXFont::SYMBOLEX_FAMILY);
        Math_Fonts[2].setFamily(LyXFont::SYMBOL_FAMILY);
        Math_Fonts[2].setShape(LyXFont::ITALIC_SHAPE);
-
        Math_Fonts[3].setSeries(LyXFont::BOLD_SERIES);
-
        Math_Fonts[4].setFamily(LyXFont::SANS_FAMILY);
        Math_Fonts[4].setShape(LyXFont::ITALIC_SHAPE);
-
        Math_Fonts[5].setFamily(LyXFont::TYPEWRITER_FAMILY);
-
        Math_Fonts[6].setFamily(LyXFont::ROMAN_FAMILY);
-
        Math_Fonts[7].setFamily(LyXFont::SANS_FAMILY);
+       Math_Fonts[8].setFamily(LyXFont::FRAKTUR_FAMILY);
+       Math_Fonts[9].setFamily(LyXFont::MATHSCR_FAMILY);
+       Math_Fonts[10].setFamily(LyXFont::SYMBOLAMSB_FAMILY);
+       Math_Fonts[11].setFamily(LyXFont::SYMBOLEX_FAMILY);
+       Math_Fonts[12].setFamily(LyXFont::SYMBOLAMSA_FAMILY);
 }
 
 } // namespace
@@ -153,10 +151,6 @@ LyXFont WhichFont(MathTextCodes type, Ma
                f = Math_Fonts[3];
                break;
 
-       case LM_TC_SF:
-               f = Math_Fonts[7];
-               break;
-
        case LM_TC_CAL:
                f = Math_Fonts[4];
                break;
@@ -173,6 +167,30 @@ LyXFont WhichFont(MathTextCodes type, Ma
                f = Math_Fonts[6];
                break;
 
+       case LM_TC_SF:
+               f = Math_Fonts[7];
+               break;
+
+       case LM_TC_FRAKTUR:
+               f = Math_Fonts[8];
+               break;
+
+       case LM_TC_MATHSCR:
+               f = Math_Fonts[9];
+               break;
+
+       case LM_TC_SYMAMSB:
+               f = Math_Fonts[10];
+               break;
+
+       case LM_TC_SYMEX:
+               f = Math_Fonts[11];
+               break;
+
+       case LM_TC_SYMAMSA:
+               f = Math_Fonts[12];
+               break;
+
        default:
                f = Math_Fonts[1];
                break;
@@ -540,8 +558,9 @@ int mathed_char_descent(MathTextCodes ty
 int mathed_char_width(MathTextCodes type, MathStyles size, unsigned char c)
 {
        LyXFont const font = WhichFont(type, size);
+       LyXFont const f1 = WhichFont(LM_TC_TEXTRM, size);
        if (isBinaryOp(c))
-               return lyxfont::width(c, font) + 2 * lyxfont::width(' ', font);
+               return lyxfont::width(c, font) + 2 * lyxfont::width(' ', f1);
        else
                return lyxfont::width(c, font);
 }

Reply via email to