]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiDelimiter.cpp
Amend f441590c
[lyx.git] / src / frontends / qt4 / GuiDelimiter.cpp
index 8303fa64140783ed24b136acbb5b6c544c88feb7..458d05ca6a9c582ef834e0aeea8a51c1d1b16ec5 100644 (file)
@@ -100,14 +100,14 @@ void initMathSymbols()
        // defined with non-unicode ids for use within mathed.
        // FIXME 2: We should fill-in this map with the parsed "symbols"
        // file done in MathFactory.cpp.
-       math_symbols_["("] = MathSymbol('(');
-       math_symbols_[")"] = MathSymbol(')');
-       math_symbols_["{"] = MathSymbol('{');
-       math_symbols_["}"] = MathSymbol('}');
-       math_symbols_["["] = MathSymbol('[');
-       math_symbols_["]"] = MathSymbol(']');
-       math_symbols_["|"] = MathSymbol('|');
-       math_symbols_["/"] = MathSymbol('/', 54, CMSY_FAMILY);
+       math_symbols_["("] = MathSymbol('(', 40, CMR_FAMILY);
+       math_symbols_[")"] = MathSymbol(')', 41, CMR_FAMILY);
+       math_symbols_["{"] = MathSymbol('{', 102, CMSY_FAMILY);
+       math_symbols_["}"] = MathSymbol('}', 103, CMSY_FAMILY);
+       math_symbols_["["] = MathSymbol('[', 91, CMR_FAMILY);
+       math_symbols_["]"] = MathSymbol(']', 93, CMR_FAMILY);
+       math_symbols_["|"] = MathSymbol('|', 106, CMSY_FAMILY);
+       math_symbols_["/"] = MathSymbol('/', 47, CMR_FAMILY);
        math_symbols_["backslash"] = MathSymbol('\\', 110, CMSY_FAMILY);
        math_symbols_["lceil"] = MathSymbol(0x2308, 100, CMSY_FAMILY);
        math_symbols_["rceil"] = MathSymbol(0x2309, 101, CMSY_FAMILY);
@@ -141,7 +141,7 @@ MathSymbol const & mathSymbol(string tex_name)
        map<string, MathSymbol>::const_iterator it =
                math_symbols_.find(tex_name);
 
-       static MathSymbol unknown_symbol;
+       static MathSymbol const unknown_symbol;
        if (it == math_symbols_.end())
                return unknown_symbol;
 
@@ -154,7 +154,7 @@ string const & texName(char_type math_symbol)
        map<char_type, string>::const_iterator it =
                tex_names_.find(math_symbol);
 
-       static string empty_string;
+       static string const empty_string;
        if (it == tex_names_.end())
                return empty_string;
 
@@ -188,13 +188,27 @@ GuiDelimiter::GuiDelimiter(GuiView & lv)
        for (int i = 0; i < end; ++i) {
                string const delim = latex_delimiters[i];
                MathSymbol const & ms = mathSymbol(delim);
+// Due to a bug in Qt 4 on Windows, we need to use our math symbol font
+// on Windows (see #5760).
+// FIXME: Re-check after Windows has settled to Qt 5.
+//        ATM, this doesn't work also with Qt 5.4.1 because of still missing
+//        glyphs for \llbracket and \rrbracket. These last symbols are also
+//        missing when compiling on cygwin using the X11 xcb backend.
+#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN)
                QString symbol(ms.fontcode?
                        QChar(ms.fontcode) : toqstr(docstring(1, ms.unicode)));
                QListWidgetItem * lwi = new QListWidgetItem(symbol);
-               lwi->setToolTip(toqstr(delim));
                FontInfo lyxfont;
                lyxfont.setFamily(ms.fontfamily);
-               lwi->setFont(frontend::getFont(lyxfont));
+               QFont font = frontend::getFont(lyxfont);
+#else
+               QString symbol(QChar(ms.unicode));
+               QListWidgetItem * lwi = new QListWidgetItem(symbol);
+               QFont font = lwi->font();
+               font.setPointSize(2 * font.pointSize());
+#endif
+               lwi->setFont(font);
+               lwi->setToolTip(toqstr(delim));
                list_items[ms.unicode] = lwi;
                leftLW->addItem(lwi);
        }
@@ -206,8 +220,18 @@ GuiDelimiter::GuiDelimiter(GuiView & lv)
        }
 
        // The last element is the empty one.
-       leftLW->addItem(qt_("(None)"));
-       rightLW->addItem(qt_("(None)"));
+       QListWidgetItem * lwi = new QListWidgetItem(qt_("(None)"));
+       QListWidgetItem * rwi = new QListWidgetItem(qt_("(None)"));
+// See above comment.
+// FIXME: Re-check after Windows has settled to Qt 5.
+#if !defined(Q_OS_WIN) && !defined(Q_CYGWIN_WIN)
+       QFont font = lwi->font();
+       font.setPointSize(2 * font.pointSize());
+       lwi->setFont(font);
+       rwi->setFont(font);
+#endif
+       leftLW->addItem(lwi);
+       rightLW->addItem(rwi);
 
        sizeCO->addItem(qt_("Variable"));