]> git.lyx.org Git - features.git/commitdiff
Solve the "soft-hyphen" (0x00ad) symbol problem.
authorEnrico Forestieri <forenr@lyx.org>
Wed, 21 Jan 2015 12:57:55 +0000 (13:57 +0100)
committerEnrico Forestieri <forenr@lyx.org>
Wed, 21 Jan 2015 13:12:42 +0000 (14:12 +0100)
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.

14 files changed:
lib/fonts/cmex10.ttf [changed mode: 0644->0755]
lib/fonts/cmmi10.ttf [changed mode: 0644->0755]
lib/fonts/cmr10.ttf [changed mode: 0644->0755]
lib/fonts/cmsy10.ttf [changed mode: 0644->0755]
lib/fonts/esint10.ttf [changed mode: 0644->0755]
lib/fonts/eufm10.ttf [changed mode: 0644->0755]
lib/fonts/msam10.ttf [changed mode: 0644->0755]
lib/fonts/msbm10.ttf [changed mode: 0644->0755]
lib/fonts/rsfs10.ttf [changed mode: 0644->0755]
lib/fonts/stmary10.ttf [changed mode: 0644->0755]
lib/fonts/wasy10.ttf [changed mode: 0644->0755]
lib/symbols
src/frontends/qt4/GuiFontLoader.cpp
src/frontends/qt4/GuiPainter.cpp

old mode 100644 (file)
new mode 100755 (executable)
index e4b468d..aed7e86
Binary files a/lib/fonts/cmex10.ttf and b/lib/fonts/cmex10.ttf differ
old mode 100644 (file)
new mode 100755 (executable)
index af48386..9b2b430
Binary files a/lib/fonts/cmmi10.ttf and b/lib/fonts/cmmi10.ttf differ
old mode 100644 (file)
new mode 100755 (executable)
index 8bc4496..e405536
Binary files a/lib/fonts/cmr10.ttf and b/lib/fonts/cmr10.ttf differ
old mode 100644 (file)
new mode 100755 (executable)
index e0f4fa8..40cb3a8
Binary files a/lib/fonts/cmsy10.ttf and b/lib/fonts/cmsy10.ttf differ
old mode 100644 (file)
new mode 100755 (executable)
index b803a15..deb6e5f
Binary files a/lib/fonts/esint10.ttf and b/lib/fonts/esint10.ttf differ
old mode 100644 (file)
new mode 100755 (executable)
index eb126a0..0e670d4
Binary files a/lib/fonts/eufm10.ttf and b/lib/fonts/eufm10.ttf differ
old mode 100644 (file)
new mode 100755 (executable)
index 8a83d1f..3b0cd89
Binary files a/lib/fonts/msam10.ttf and b/lib/fonts/msam10.ttf differ
old mode 100644 (file)
new mode 100755 (executable)
index 728d1e8..04a4717
Binary files a/lib/fonts/msbm10.ttf and b/lib/fonts/msbm10.ttf differ
old mode 100644 (file)
new mode 100755 (executable)
index 2fa353e..4160bcf
Binary files a/lib/fonts/rsfs10.ttf and b/lib/fonts/rsfs10.ttf differ
old mode 100644 (file)
new mode 100755 (executable)
index 692a30e..bafedc4
Binary files a/lib/fonts/stmary10.ttf and b/lib/fonts/stmary10.ttf differ
old mode 100644 (file)
new mode 100755 (executable)
index 673085f..a4e32d2
Binary files a/lib/fonts/wasy10.ttf and b/lib/fonts/wasy10.ttf differ
index f6d59b8d9b964f6bfc009fef00037d8df2055e5b..d4a9f655420d2fb9d6b5a71af69902a89a1cc93f 100644 (file)
@@ -261,7 +261,7 @@ Sigma              cmr         167  83 mathalpha  &Sigma;
 Upsilon            cmr         168 161 mathalpha  &Upsi;
 Phi                cmr         169  70 mathalpha  &Phi;
 Psi                cmr         170  89 mathalpha  &Psi;
-Omega              cmr         173  87 mathalpha  &Omega;
+Omega              cmr         172  87 mathalpha  &Omega;
 aleph              cmsy         64 192 mathord  &aleph;
 imath              cmm         123   0 mathord  &imath;
 jmath              cmm         124   0 mathord  &jmath;
@@ -331,7 +331,7 @@ wr                 cmsy        111   0 mathbin  &wreath;
 div                cmsy        165 184 mathbin  &divide;
 odot               cmsy        175   0 mathbin  &odot;
 oslash             cmsy        174 198 mathbin  &oslash;
-otimes             cmsy        173 196 mathbin  &otimes;
+otimes             cmsy        172 196 mathbin  &otimes;
 ominus             cmsy        170   0 mathbin  &ominus;
 oplus              cmsy        169 197 mathbin  &oplus;
 mp                 cmsy        168   0 mathbin  &mnplus;
@@ -435,7 +435,7 @@ ulcorner           msa         112   0 mathopen  &ulcorn;
 urcorner           msa         113   0 mathclose  &urcorn;
 llcorner           msa         120   0 mathopen  &dlcorn;
 lrcorner           msa         121   0 mathclose  &drcorn;
-rightleftharpoons  msa         173   0 mathrel  &lrhar;
+rightleftharpoons  msa         172   0 mathrel  &lrhar;
 angle              msa          92 208 mathord  &ang;
 sqsubset           msa          64   0 mathrel  &sqsub;
 sqsupset           msa          65   0 mathrel  &sqsup;
@@ -578,7 +578,7 @@ nprec              msb         167   0 mathrel  &npr;
 nsucc              msb         168   0 mathrel  &nsc;
 lneqq              msb         169   0 mathrel  &lnE;
 gneqq              msb         170   0 mathrel  &gnE;
-nleqslant          msb         173   0 mathrel  &nles;
+nleqslant          msb         172   0 mathrel  &nles;
 ngeqslant          msb         174   0 mathrel  &nges;
 lneq               msb         175   0 mathrel  &nle;
 gneq               msb         176   0 mathrel  &gne;
@@ -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
index 8512189963cb4be86605271916f3bd311c4bf33a..69f1ed2439dbe279f49b6edc9c54066a0cd8331b 100644 (file)
@@ -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, "LyX")) {
+               LYXERR(Debug::FONT, "lyx!");
+               *ok = true;
+               return font;
+       }
+
+       LYXERR(Debug::FONT, "Trying normal " << family << " ... ");
+       font.setStyleName(QString());
+#endif
 
-       if (isChosenFont(font, family)) {
+       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;
index de1ca71d2b53427cc8893190dd3860cc2d7bc6f0..ce0290cdccec05f8ec03d89cd8657120583a9f70 100644 (file)
@@ -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);