diff --git a/src/frontends/qt/GuiFontLoader.cpp b/src/frontends/qt/GuiFontLoader.cpp index c22c7f1c96..afbf03777a 100644 --- a/src/frontends/qt/GuiFontLoader.cpp +++ b/src/frontends/qt/GuiFontLoader.cpp @@ -215,6 +215,7 @@ QFont symbolFont(QString const & family, bool * ok) #else font.setFamily(family); #endif + font.setStyleStrategy(QFont::NoFontMerging); #if QT_VERSION >= 0x040800 font.setStyleName("LyX"); diff --git a/src/mathed/InsetMathChar.cpp b/src/mathed/InsetMathChar.cpp index d5ef8dc1f5..aa1ddf8c5b 100644 --- a/src/mathed/InsetMathChar.cpp +++ b/src/mathed/InsetMathChar.cpp @@ -118,6 +118,13 @@ void InsetMathChar::metrics(MetricsInfo & mi, Dimension & dim) const Changer dummy = mi.base.font.changeShape(UP_SHAPE); dim = theFontMetrics(mi.base.font).dimension(char_); kerning_ = 0; + } else if (!isASCII(char_) && Encodings::unicodeCharInfo(char_).isUnicodeSymbol()) { + Changer dummy1 = mi.base.changeFontSet("mathnormal"); + Changer dummy2 = Encodings::isMathAlpha(char_) + ? Changer() + : mi.base.font.changeShape(UP_SHAPE); + dim = theFontMetrics(mi.base.font).dimension(char_); + kerning_ = -mathed_char_kerning(mi.base.font, char_); } else { frontend::FontMetrics const & fm = theFontMetrics(mi.base.font); dim = fm.dimension(char_); @@ -156,6 +163,13 @@ void InsetMathChar::draw(PainterInfo & pi, int x, int y) const Changer dummy = pi.base.font.changeShape(UP_SHAPE); pi.draw(x, y, char_); return; + } else if (!isASCII(char_) && Encodings::unicodeCharInfo(char_).isUnicodeSymbol()) { + Changer dummy1 = pi.base.changeFontSet("mathnormal"); + Changer dummy2 = Encodings::isMathAlpha(char_) + ? Changer() + : pi.base.font.changeShape(UP_SHAPE); + pi.draw(x, y, char_); + return; } } // cmmi has almost no left bearing: simulate this diff --git a/src/mathed/MathSupport.cpp b/src/mathed/MathSupport.cpp index ef93cb0bf1..f5278b15d0 100644 --- a/src/mathed/MathSupport.cpp +++ b/src/mathed/MathSupport.cpp @@ -692,7 +692,13 @@ int mathedSymbolDim(MetricsBase & mb, Dimension & dim, latexkeys const * sym) sym->extra == "mathalpha" && mb.fontname == "mathit"; std::string const font = italic_upcase_greek ? "cmm" : sym->inset; - Changer dummy = mb.changeFontSet(font); + bool const change_font = font != "cmr" || + (mb.fontname != "mathbb" && + mb.fontname != "mathds" && + mb.fontname != "mathfrak" && + mb.fontname != "mathcal" && + mb.fontname != "mathscr"); + Changer dummy = change_font ? mb.changeFontSet(font) : Changer(); mathed_string_dim(mb.font, mathedSymbol(mb, sym), dim); return mathed_char_kerning(mb.font, mathedSymbol(mb, sym).back()); } @@ -710,8 +716,13 @@ void mathedSymbolDraw(PainterInfo & pi, int x, int y, latexkeys const * sym) sym->extra == "mathalpha" && pi.base.fontname == "mathit"; std::string const font = italic_upcase_greek ? "cmm" : sym->inset; - - Changer dummy = pi.base.changeFontSet(font); + bool const change_font = font != "cmr" || + (pi.base.fontname != "mathbb" && + pi.base.fontname != "mathds" && + pi.base.fontname != "mathfrak" && + pi.base.fontname != "mathcal" && + pi.base.fontname != "mathscr"); + Changer dummy = change_font ? pi.base.changeFontSet(font) : Changer(); pi.draw(x, y, mathedSymbol(pi.base, sym)); }