Here is a proof of concept patch for setting fontpath when LyX is run. This patch is ugly and just works in the simplest cases. However, I will not have time to work on that (I am away until next monday) and I am not sure I know how to do it cleanly.
Known problems: - if you run several instances of LyX, the fontpath will be reset after quitting one of them - does not work when running remotely. I do not know how to handle that, since the fonts should be in the DISPLAY host, and all lyx files are on the running host - using xset is certainly not the nicest thing to do - I am not sure where this code should be and where it should be run Anyone willing to take this over?
Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.636 diff -u -r1.636 ChangeLog --- src/ChangeLog 19 Mar 2002 21:42:48 -0000 1.636 +++ src/ChangeLog 19 Mar 2002 23:40:21 -0000 @@ -1,6 +1,15 @@ +2002-03-20 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> + + * lyx_main.C (init): call FontLoader::setFontPath + + * FontLoader.C (setFontPath): add xfonts/fonts.dir to X font path + if found + (~FontLoader): remove xfonts/fonts.dir from X path if it had been + added in setFontPath + 2002-03-19 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> - * text2.C (setCursorIntern): put debuging code in INSETS channel + * text2.C (setCursorIntern): put debugging code in INSETS channel 2002-03-19 André Pönitz <[EMAIL PROTECTED]> Index: src/FontLoader.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/FontLoader.C,v retrieving revision 1.38 diff -u -r1.38 FontLoader.C --- src/FontLoader.C 16 Feb 2002 15:59:33 -0000 1.38 +++ src/FontLoader.C 19 Mar 2002 23:40:21 -0000 @@ -23,6 +23,8 @@ #include "BufferView.h" #include "LyXView.h" #include "frontends/GUIRunTime.h" +#include "support/systemcall.h" +#include "support/filetools.h" using std::endl; @@ -36,6 +38,14 @@ // Initialize font loader FontLoader::FontLoader() { + fontsdir_ = OnlyPath(LibFileSearch("xfonts", "fonts.dir")); + if (!fontsdir_.empty()) { + string const command = "xset +fp " + fontsdir_; + Systemcall one; + if (one.startscript(Systemcall::Wait, command)) + fontsdir_.clear(); + } + reset(); } @@ -43,6 +53,12 @@ // Destroy font loader FontLoader::~FontLoader() { + if (!fontsdir_.empty()) { + string const command = "xset -fp " + fontsdir_; + Systemcall one; + one.startscript(Systemcall::Wait, command); + } + unload(); } @@ -335,4 +351,15 @@ getFontinfo(f.family(), f.series(), f.realShape()); return fontinfo[f.family()][f.series()][f.realShape()] ->getFontname(f.size()).size(); +} + + +void FontLoader::setFontPath() { + fontsdir_ = OnlyPath(LibFileSearch("xfonts", "fonts.dir")); + if (!fontsdir_.empty()) { + string const command = "xset +fp " + fontsdir_; + Systemcall one; + if (one.startscript(Systemcall::Wait, command)) + fontsdir_.clear(); + } } Index: src/FontLoader.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/FontLoader.h,v retrieving revision 1.12 diff -u -r1.12 FontLoader.h --- src/FontLoader.h 31 Aug 2001 21:15:55 -0000 1.12 +++ src/FontLoader.h 19 Mar 2002 23:40:23 -0000 @@ -50,6 +50,8 @@ }; /// Do we have anything matching? bool available(LyXFont const & f); + /// Add the xfonts/ font directory to X11 fontpath + void setFontPath(); private: /// Array of font structs @@ -74,6 +76,10 @@ LyXFont::FONT_SERIES series, LyXFont::FONT_SHAPE shape, LyXFont::FONT_SIZE size); + + /// The directory where additional X fonts reside + string fontsdir_; + }; /// Index: src/lyx_main.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_main.C,v retrieving revision 1.103 diff -u -r1.103 lyx_main.C --- src/lyx_main.C 16 Feb 2002 15:59:39 -0000 1.103 +++ src/lyx_main.C 19 Mar 2002 23:40:26 -0000 @@ -36,6 +36,7 @@ #include "encoding.h" #include "converter.h" #include "language.h" +#include "FontLoader.h" #include "frontends/Alert.h" #include "frontends/GUIRunTime.h" @@ -455,6 +456,9 @@ } else { lyxrc.dpi = 1; // I hope this is safe } + + // Update X11 font path to inclue TeX fonts + fontloader.setFontPath(); // // Read configuration files