]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiFontLoader.cpp
On Linux show in crash message box the backtrace
[lyx.git] / src / frontends / qt4 / GuiFontLoader.cpp
index 9fd2060b429b81a19620aaed115692922f2f57cf..fa5370cfd32497624e11e7efea248de326b78e9c 100644 (file)
@@ -209,7 +209,7 @@ FontLoader::FontLoader()
                toqstr(addPath(package().system_support().absFileName(), "fonts"));
 
        for (int i = 0 ; i < num_math_fonts; ++i) {
-               QString const font_file = fonts_dir + '/' + math_fonts[i] + ".ttf";
+               QString const font_file = fonts_dir + math_fonts[i] + ".ttf";
                int fontID = QFontDatabase::addApplicationFont(font_file);
 
                LYXERR(Debug::FONT, "Adding font " << font_file
@@ -304,8 +304,13 @@ GuiFontInfo::GuiFontInfo(FontInfo const & f)
 
        switch (f.realShape()) {
                case ITALIC_SHAPE:
+                       font.setStyle(QFont::StyleItalic);
+                       break;
                case SLANTED_SHAPE:
-                       font.setItalic(true);
+                       font.setStyle(QFont::StyleOblique);
+                       break;
+               case SMALLCAPS_SHAPE:
+                       font.setCapitalization(QFont::SmallCaps);
                        break;
                default:
                        break;
@@ -327,19 +332,7 @@ GuiFontInfo::GuiFontInfo(FontInfo const & f)
 
        LYXERR(Debug::FONT, "The font has size: " << font.pointSizeF());
 
-       if (f.realShape() != SMALLCAPS_SHAPE) {
-               metrics = GuiFontMetrics(font);
-       } else {
-               // handle small caps ourselves ...
-               FontInfo smallfont = f;
-               smallfont.decSize().decSize().setShape(UP_SHAPE);
-               QFont font2(font);
-               font2.setKerning(false);
-               font2.setPointSizeF(convert<double>(lyxrc.font_sizes[smallfont.size()])
-                              * lyxrc.zoom / 100.0);
-
-               metrics = GuiFontMetrics(font, font2);
-       }
+       metrics = GuiFontMetrics(font);
 }
 
 
@@ -350,6 +343,16 @@ bool FontLoader::available(FontInfo const & f)
        static vector<int> cache(NUM_FAMILIES, false);
 
        FontFamily family = f.family();
+#ifdef Q_WS_MACX
+       // Apple ships a font name "Symbol", which has more or less the same
+       // glyphs as the original PostScript Symbol font, but it uses a different
+       // encoding (see https://en.wikipedia.org/wiki/Symbol_(typeface)#cite_note-2).
+       // Since we expect the font specific encoding of the original
+       // PostScript Symbol font, we can't use the one provided on OS X.
+       // See also the discussion in bug 7954.
+       if (f.family() == SYMBOL_FAMILY)
+               return false;
+#endif
        if (cache_set[family])
                return cache[family];
        cache_set[family] = true;