mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Fix on-screen display of special math fonts
Make sure that the on-screen representation of the special math fonts mathbb, mathds, mathfrak, mathcal, and mathscr matches the latex output.
This commit is contained in:
parent
61739e5aef
commit
062d94c5da
@ -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");
|
||||
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user