On Fri, Aug 31, 2007 at 06:00:02PM +0200, Jean-Marc Lasgouttes wrote: > "Leuven, E." <[EMAIL PROTECTED]> writes: > > > thanks for reminding people why they are not using linux anymore ... > > It would not be difficult to write the code that lets fontconfig find > LyX' fonts, actually.
I think this is not the problem. The attached patch does exactly that. The problem is that the fonts are "appended" to the configuration, such that other fonts may be found and used instead of ours. Look at the following example. I removed the latex-xft-fonts package, launched "lyx -dbg font", and got what you can see in the dbg_fonts1.txt attachment. As you can see, cmsy10, cmmi10, cmr10, and cmex10 were still found, even without latex-xft-fonts, as they are now coming from /usr/local/share/fonts/mathml/{cmex10,cmmi10,cmr10,cmsy10}.ttf Then I applied the patch and launched again "lyx -dbg font", getting the result you can see in the dbg_fonts2.txt attachment. Curiously, the wasy10 font is not found, even if it is found when its directory is listed in the fontconfig configuration files. However, the point here is that the cmsy10, cmmi10, cmr10, and cmex10 fonts are still those in /usr/local/share/fonts/mathml, and even if their glyphs are correct, they do not match the other bakoma fonts. This can be seen by looking at the \Omega glyph as compared to the \mho glyph. I don't know how to persuade fontconfig into taking our fonts instead of other matching ones. Using the configuration files instead of the API functions, this is accomplished by listing first the right directories. -- Enrico
Index: src/support/os_unix.cpp =================================================================== --- src/support/os_unix.cpp (revisione 19973) +++ src/support/os_unix.cpp (copia locale) @@ -13,14 +13,19 @@ #include <config.h> #include "support/os.h" +#include "debug.h" #ifdef __APPLE__ -#include "debug.h" #include <Carbon/Carbon.h> #include <ApplicationServices/ApplicationServices.h> -using std::endl; +#else +#include "support/filetools.h" +#include "support/Package.h" +#include <fontconfig/fontconfig.h> +using lyx::support::addPath; #endif +using std::endl; using std::string; @@ -224,6 +229,12 @@ kFMLocalActivationContext); if (err) lyxerr << "FMActivateFonts err = " << err << endl; +#else + // Register BaKoMa truetype fonts with fontconfig + string const fonts_dir = + addPath(package().system_support().absFilename(), "fonts"); + if (!FcConfigAppFontAddDir(0, (FcChar8 const *)fonts_dir.c_str())) + lyxerr << "Unable to register fonts with fontconfig." << endl; #endif }
Looking for font family eufm10 ... got: Bitstream Vera Sans Trying Eufm10 ... got: Bitstream Vera Sans Trying -*-eufm10-medium-*-*-*-*-*-*-*-*-*-*-* ... got: Helvetica FAILED :-( Looking for font family cmsy10 ... got: cmsy10 got it normal! Looking for font family cmmi10 ... got: cmmi10 got it normal! Looking for font family cmr10 ... got: cmr10 got it normal! Looking for font family cmex10 ... got: cmex10 got it normal! Looking for font family msam10 ... got: Bitstream Vera Sans Trying Msam10 ... got: Bitstream Vera Sans Trying -*-msam10-*-*-*-*-*-*-*-*-*-*-*-* ... got: Bitstream Vera Sans FAILED :-( Looking for font family symbol ... got: Symbol Trying Symbol ... got: Symbol got it upper! Looking for font family msbm10 ... got: Bitstream Vera Sans Trying Msbm10 ... got: Bitstream Vera Sans Trying -*-msbm10-*-*-*-*-*-*-*-*-*-*-*-* ... got: Bitstream Vera Sans FAILED :-( Looking for font family wasy10 ... got: Bitstream Vera Sans Trying Wasy10 ... got: Bitstream Vera Sans Trying -*-wasy10-medium-*-*-*-*-*-*-*-*-*-*-* ... got: Bitstream Vera Sans FAILED :-( Looking for font family esint10 ... got: Bitstream Vera Sans Trying Esint10 ... got: Bitstream Vera Sans Trying -*-esint10-medium-*-*-*-*-*-*-*-*-*-*-* ... got: Helvetica FAILED :-(
Looking for font family eufm10 ... got: eufm10 got it normal! Looking for font family cmsy10 ... got: cmsy10 got it normal! Looking for font family cmmi10 ... got: cmmi10 got it normal! Looking for font family cmr10 ... got: cmr10 got it normal! Looking for font family cmex10 ... got: cmex10 got it normal! Looking for font family msam10 ... got: msam10 got it normal! Looking for font family msbm10 ... got: msbm10 got it normal! Looking for font family wasy10 ... got: Bitstream Vera Sans Trying Wasy10 ... got: Bitstream Vera Sans Trying -*-wasy10-medium-*-*-*-*-*-*-*-*-*-*-* ... got: Bitstream Vera Sans FAILED :-( Looking for font family esint10 ... got: Bitstream Vera Sans Trying Esint10 ... got: Bitstream Vera Sans Trying -*-esint10-medium-*-*-*-*-*-*-*-*-*-*-* ... got: Helvetica FAILED :-(