From c1ac09e11fc127b61ecc91ac623791c571f48d34 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sat, 7 Jun 2014 10:50:11 +0200 Subject: [PATCH] Fix bug #7954 (now really) Thanks to maciejr we know now what the remaining problem was with bug 7954: My unicode symbol fallback works fine, the problem was that a font named "Symbol" is available on OS X, but it does not use the font-specific encoding we expect: Almost all glyphs are at their unicode code point. Therefore the bug is fixed by re-enabling the unicode workaround and blocking the Symbol font on OS X. --- lib/symbols | 2 ++ src/frontends/qt4/GuiFontLoader.cpp | 10 ++++++++++ src/mathed/MathFactory.cpp | 7 +------ src/mathed/MathSupport.cpp | 3 +++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/symbols b/lib/symbols index 9f33433cdd..2b5aea2feb 100644 --- a/lib/symbols +++ b/lib/symbols @@ -1173,6 +1173,8 @@ lyxsurd cmsy 112 0 mathord √ \def\surd{^\lyxsurd} \def\textdegree{\kern-1mu^{\circ}\kern-4mu} else +# FIXME: These don't work on OS X, since the Symbol font uses a different +# encoding and is therefore disabled in FontLoader::available(). cong lyxsymbol 64 0 mathrel ≅ surd lyxsymbol 214 0 mathord √ textdegree lyxsymbol 176 0 mathord ° diff --git a/src/frontends/qt4/GuiFontLoader.cpp b/src/frontends/qt4/GuiFontLoader.cpp index 39a4b17a3c..fa5370cfd3 100644 --- a/src/frontends/qt4/GuiFontLoader.cpp +++ b/src/frontends/qt4/GuiFontLoader.cpp @@ -343,6 +343,16 @@ bool FontLoader::available(FontInfo const & f) static vector 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; diff --git a/src/mathed/MathFactory.cpp b/src/mathed/MathFactory.cpp index 85fdf47856..382f037e89 100644 --- a/src/mathed/MathFactory.cpp +++ b/src/mathed/MathFactory.cpp @@ -118,10 +118,8 @@ bool canBeDisplayed(char_type c) } -bool isUnicodeSymbolAvailable(docstring const & /*name*/, char_type & /*c*/) +bool isUnicodeSymbolAvailable(docstring const & name, char_type & c) { - // this is too fragile, e.g. prodes W instead of capital omega on OS X -#if 0 docstring cmd(from_ascii("\\") + name); bool is_combining; bool termination; @@ -135,9 +133,6 @@ bool isUnicodeSymbolAvailable(docstring const & /*name*/, char_type & /*c*/) is_combining, termination); } return c != 0 && !is_combining; -#else - return false; -#endif } diff --git a/src/mathed/MathSupport.cpp b/src/mathed/MathSupport.cpp index ff4702ff71..a715360112 100644 --- a/src/mathed/MathSupport.cpp +++ b/src/mathed/MathSupport.cpp @@ -635,6 +635,9 @@ fontinfo fontinfos[] = { // LyX internal usage {"lyxtex", inh_family, inh_series, UP_SHAPE, Color_latex}, + // FIXME: The following two don't work on OS X, since the Symbol font + // uses a different encoding, and is therefore disabled in + // FontLoader::available(). {"lyxsymbol", SYMBOL_FAMILY, inh_series, inh_shape, Color_math}, {"lyxboldsymbol", SYMBOL_FAMILY, BOLD_SERIES,