mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Solve the "soft-hyphen" (0x00ad) symbol problem.
After the str-metrics merge, the kludge for displaying symbols whose code point corresponds to a soft-hyphen was not working anymore. The solution is replicating the offending glyphs with index 0x00ad at a different index. They were replicated at 0x00ac, whose glyph was missing in all affected fonts. However, this would not work by alone because, if a system font with same family name exists, it would be picked up instead of the right one (at least on non-Windows platforms). For this reason, the style of the fonts has been changed from "Regular" to "Lyx", so that we can discriminate the right font. However, this requires using at least Qt 4.8. If an older Qt is used *and* a system font with same family name is already available, the affected glyphs will all turn out on screen as the "logical not" symbol. I have also set the executable flag on the font files, because on Windows they are loaded only in this case. This solves #9229.
This commit is contained in:
parent
6773042d0c
commit
f496ec373b
BIN
lib/fonts/cmex10.ttf
Normal file → Executable file
BIN
lib/fonts/cmex10.ttf
Normal file → Executable file
Binary file not shown.
BIN
lib/fonts/cmmi10.ttf
Normal file → Executable file
BIN
lib/fonts/cmmi10.ttf
Normal file → Executable file
Binary file not shown.
BIN
lib/fonts/cmr10.ttf
Normal file → Executable file
BIN
lib/fonts/cmr10.ttf
Normal file → Executable file
Binary file not shown.
BIN
lib/fonts/cmsy10.ttf
Normal file → Executable file
BIN
lib/fonts/cmsy10.ttf
Normal file → Executable file
Binary file not shown.
BIN
lib/fonts/esint10.ttf
Normal file → Executable file
BIN
lib/fonts/esint10.ttf
Normal file → Executable file
Binary file not shown.
BIN
lib/fonts/eufm10.ttf
Normal file → Executable file
BIN
lib/fonts/eufm10.ttf
Normal file → Executable file
Binary file not shown.
BIN
lib/fonts/msam10.ttf
Normal file → Executable file
BIN
lib/fonts/msam10.ttf
Normal file → Executable file
Binary file not shown.
BIN
lib/fonts/msbm10.ttf
Normal file → Executable file
BIN
lib/fonts/msbm10.ttf
Normal file → Executable file
Binary file not shown.
BIN
lib/fonts/rsfs10.ttf
Normal file → Executable file
BIN
lib/fonts/rsfs10.ttf
Normal file → Executable file
Binary file not shown.
BIN
lib/fonts/stmary10.ttf
Normal file → Executable file
BIN
lib/fonts/stmary10.ttf
Normal file → Executable file
Binary file not shown.
BIN
lib/fonts/wasy10.ttf
Normal file → Executable file
BIN
lib/fonts/wasy10.ttf
Normal file → Executable file
Binary file not shown.
10
lib/symbols
10
lib/symbols
@ -261,7 +261,7 @@ Sigma cmr 167 83 mathalpha Σ
|
||||
Upsilon cmr 168 161 mathalpha ϒ
|
||||
Phi cmr 169 70 mathalpha Φ
|
||||
Psi cmr 170 89 mathalpha Ψ
|
||||
Omega cmr 173 87 mathalpha Ω
|
||||
Omega cmr 172 87 mathalpha Ω
|
||||
aleph cmsy 64 192 mathord ℵ
|
||||
imath cmm 123 0 mathord ı
|
||||
jmath cmm 124 0 mathord ȷ
|
||||
@ -331,7 +331,7 @@ wr cmsy 111 0 mathbin ≀
|
||||
div cmsy 165 184 mathbin ÷
|
||||
odot cmsy 175 0 mathbin ⊙
|
||||
oslash cmsy 174 198 mathbin ø
|
||||
otimes cmsy 173 196 mathbin ⊗
|
||||
otimes cmsy 172 196 mathbin ⊗
|
||||
ominus cmsy 170 0 mathbin ⊖
|
||||
oplus cmsy 169 197 mathbin ⊕
|
||||
mp cmsy 168 0 mathbin ∓
|
||||
@ -435,7 +435,7 @@ ulcorner msa 112 0 mathopen ⌜
|
||||
urcorner msa 113 0 mathclose ⌝
|
||||
llcorner msa 120 0 mathopen ⌞
|
||||
lrcorner msa 121 0 mathclose ⌟
|
||||
rightleftharpoons msa 173 0 mathrel ⇋
|
||||
rightleftharpoons msa 172 0 mathrel ⇋
|
||||
angle msa 92 208 mathord ∠
|
||||
sqsubset msa 64 0 mathrel ⊏
|
||||
sqsupset msa 65 0 mathrel ⊐
|
||||
@ -578,7 +578,7 @@ nprec msb 167 0 mathrel ⊀
|
||||
nsucc msb 168 0 mathrel ⊁
|
||||
lneqq msb 169 0 mathrel ≨
|
||||
gneqq msb 170 0 mathrel ≩
|
||||
nleqslant msb 173 0 mathrel ⩽̸
|
||||
nleqslant msb 172 0 mathrel ⩽̸
|
||||
ngeqslant msb 174 0 mathrel ⩾̸
|
||||
lneq msb 175 0 mathrel ≰
|
||||
gneq msb 176 0 mathrel ⪈
|
||||
@ -735,7 +735,7 @@ varSigma cmm 167 0 mathord x amsmath
|
||||
varUpsilon cmm 168 0 mathord x amsmath
|
||||
varPhi cmm 169 0 mathord x amsmath
|
||||
varPsi cmm 170 0 mathord x amsmath
|
||||
varOmega cmm 173 0 mathord x amsmath
|
||||
varOmega cmm 172 0 mathord x amsmath
|
||||
|
||||
#
|
||||
# wasy astronomy
|
||||
|
@ -139,7 +139,8 @@ bool isSymbolFamily(FontFamily family)
|
||||
#endif
|
||||
|
||||
|
||||
static bool isChosenFont(QFont & font, QString const & family)
|
||||
static bool isChosenFont(QFont & font, QString const & family,
|
||||
QString const & style)
|
||||
{
|
||||
// QFontInfo won't find a font that has only a few glyphs at unusual
|
||||
// positions, e.g. the original esint10 font.
|
||||
@ -149,7 +150,11 @@ static bool isChosenFont(QFont & font, QString const & family)
|
||||
|
||||
LYXERR(Debug::FONT, "got: " << fi.family());
|
||||
|
||||
if (fi.family().contains(family)) {
|
||||
if (fi.family().contains(family)
|
||||
#if QT_VERSION >= 0x040800
|
||||
&& (style.isEmpty() || fi.styleName().contains(style))
|
||||
#endif
|
||||
) {
|
||||
LYXERR(Debug::FONT, " got it ");
|
||||
return true;
|
||||
}
|
||||
@ -166,8 +171,20 @@ QFont symbolFont(QString const & family, bool * ok)
|
||||
|
||||
QFont font;
|
||||
font.setFamily(family);
|
||||
#if QT_VERSION >= 0x040800
|
||||
font.setStyleName("LyX");
|
||||
|
||||
if (isChosenFont(font, family)) {
|
||||
if (isChosenFont(font, family, "LyX")) {
|
||||
LYXERR(Debug::FONT, "lyx!");
|
||||
*ok = true;
|
||||
return font;
|
||||
}
|
||||
|
||||
LYXERR(Debug::FONT, "Trying normal " << family << " ... ");
|
||||
font.setStyleName(QString());
|
||||
#endif
|
||||
|
||||
if (isChosenFont(font, family, QString())) {
|
||||
LYXERR(Debug::FONT, "normal!");
|
||||
*ok = true;
|
||||
return font;
|
||||
@ -176,7 +193,7 @@ QFont symbolFont(QString const & family, bool * ok)
|
||||
LYXERR(Debug::FONT, "Trying " << upper << " ... ");
|
||||
font.setFamily(upper);
|
||||
|
||||
if (isChosenFont(font, upper)) {
|
||||
if (isChosenFont(font, upper, QString())) {
|
||||
LYXERR(Debug::FONT, "upper!");
|
||||
*ok = true;
|
||||
return font;
|
||||
@ -188,7 +205,7 @@ QFont symbolFont(QString const & family, bool * ok)
|
||||
LYXERR(Debug::FONT, "Trying " << raw << " ... ");
|
||||
font.setRawName(raw);
|
||||
|
||||
if (isChosenFont(font, family)) {
|
||||
if (isChosenFont(font, family, QString())) {
|
||||
LYXERR(Debug::FONT, "raw version!");
|
||||
*ok = true;
|
||||
return font;
|
||||
|
@ -333,27 +333,6 @@ int GuiPainter::text(int x, int y, docstring const & s,
|
||||
|
||||
textDecoration(f, x, y, textwidth);
|
||||
|
||||
// Qt4 does not display a glyph whose codepoint is the
|
||||
// same as that of a soft-hyphen (0x00ad), unless it
|
||||
// occurs at a line-break. As a kludge, we force Qt to
|
||||
// render this glyph using a one-column line.
|
||||
// This is needed for some math glyphs.
|
||||
// Should the soft hyphen char be displayed at all?
|
||||
// I don't think so (i.e., Qt is correct as far as
|
||||
// texted is concerned). /spitz
|
||||
if (s.size() == 1 && str[0].unicode() == 0x00ad) {
|
||||
setQPainterPen(computeColor(f.realColor()));
|
||||
QTextLayout adsymbol(str);
|
||||
adsymbol.setFont(ff);
|
||||
adsymbol.beginLayout();
|
||||
QTextLine line = adsymbol.createLine();
|
||||
line.setNumColumns(1);
|
||||
line.setPosition(QPointF(0, -line.ascent()));
|
||||
adsymbol.endLayout();
|
||||
line.draw(this, QPointF(x, y));
|
||||
return textwidth;
|
||||
}
|
||||
|
||||
if (use_pixmap_cache_) {
|
||||
QPixmap pm;
|
||||
QString key = generateStringSignature(str, f);
|
||||
|
Loading…
Reference in New Issue
Block a user