Hi,

I found another Windows issue, but this time I tried to provide the patch myself :)

Currently, LyX relies on the BaKoMa fonts to be installed as a system font in order to be able to display math. This is not a good thing, it of course requires administrator privileges to install a system font and thus LyX cannot be installed without these rights.

The attached Windows-only patch (this one is against 1.4) solves this problem by loading these math fonts from Resources\fonts at startup.

(Even better would be to keep them private for the LyX process, this however is only supported on Windows 2000 and later. Maybe Q../Free is ever going to support Win98/ME, so let's not stop supporting them yet.)

The location of the code or style of the patch may not be completely right, feel free to change that.

Regards,

Joost
Index: config/cygwin.m4
===================================================================
--- config/cygwin.m4    (revision 13804)
+++ config/cygwin.m4    (working copy)
@@ -19,4 +19,11 @@
     fi
     ;;
   esac
+  
+  case $host_os in
+  cygwin* | mingw* )
+       AC_SUBST(LIBGDI32, [-lgdi32])
+       ;;
+  esac
+ ])  
 ])
Index: src/lyx_main.C
===================================================================
--- src/lyx_main.C      (revision 13804)
+++ src/lyx_main.C      (working copy)
@@ -58,6 +58,10 @@
 #include <iostream>
 #include <csignal>
 
+#ifdef _WIN32
+       #include <windows.h>
+#endif
+
 using lyx::support::AddName;
 using lyx::support::AddPath;
 using lyx::support::bformat;
@@ -124,6 +128,24 @@
        lyxerr << "LyX: " << _("Done!") << endl;
 }
 
+#ifdef _WIN32
+
+void loadPrivateFonts()
+{
+       string const fonts_dir = AddPath(package().system_support(), "fonts");
+       string const fonts[] = {"cmex10", "cmmi10", "cmr10", "cmsy10",
+               "eufm10", "msam10", "msbm10", "wasy10"};
+       string font_current;            
+       
+       for(int i=0; i<(sizeof(fonts)/sizeof(*fonts)); i++)
+       {
+               font_current = os::external_path(AddName(fonts_dir, fonts[i] + 
".ttf"));
+               AddFontResource(font_current.c_str());
+       }
+}
+
+#endif
+
 } // namespace anon
 
 
@@ -425,6 +447,16 @@
        if (lyxrc.lastfiles.empty()) {
                lyxrc.lastfiles = AddName(package().user_support(), 
"lastfiles");
        }
+       
+       //
+       // Initialize fonts
+       //
+       
+#ifdef _WIN32  
+       if (gui) {      
+               loadPrivateFonts();
+       }
+#endif 
 
        if (lyxrc.roman_font_name.empty())
                lyxrc.roman_font_name = lyx_gui::roman_font_name();
Index: src/Makefile.am
===================================================================
--- src/Makefile.am     (revision 13804)
+++ src/Makefile.am     (working copy)
@@ -27,7 +27,7 @@
 
 BOOST_LIBS = $(BOOST_REGEX) $(BOOST_SIGNALS) $(BOOST_FILESYSTEM)
 
-OTHERLIBS = $(BOOST_LIBS) $(INTLLIBS) $(AIKSAURUS_LIBS) @LIBS@ $(SOCKET_LIBS)
+OTHERLIBS = $(BOOST_LIBS) $(INTLLIBS) $(AIKSAURUS_LIBS) @LIBS@ $(SOCKET_LIBS) 
$(LIBGDI32)
 
 bin_PROGRAMS = lyx
 noinst_PROGRAMS = $(FRONTENDS_PROGS)

Reply via email to