]> git.lyx.org Git - lyx.git/blobdiff - src/FontInfo.C
Andres fixes to sstrem problems
[lyx.git] / src / FontInfo.C
index 95f44c8f2eb90f04ed42adb59c0f90d40be04341..c61d6662bb8ff680209ea98e5ecfb94ac6104245 100644 (file)
@@ -13,6 +13,8 @@
 #include <cmath>       // fabs()
 #include <cstdlib>     // atoi()
 
+#include FORMS_H_LOCATION
+
 #ifdef __GNUG__
 #pragma implementation "FontInfo.h"
 #endif
@@ -22,7 +24,7 @@
 #include "lyxrc.h"     // lyxrc.use_scalable_fonts
 #include "support/lstrings.h"
 
-extern LyXRC * lyxrc;
+using std::endl;
 
 /// Load font close to this size
 string FontInfo::getFontname(int size)
@@ -46,7 +48,7 @@ string FontInfo::getFontname(int size)
                }
        }
 
-       if (scalable && lyxrc->use_scalable_fonts) {
+       if (scalable && lyxrc.use_scalable_fonts) {
                // We can use scalable
                string font = resize(strings[scaleindex], size);
                lyxerr[Debug::FONT] << "Using scalable font to get\n"
@@ -74,8 +76,8 @@ string FontInfo::resize(string const & font, int size) const
        string ret(font);
        // Find the position of the size spec
        int cut = 0;
-       string::iterator before = 0;
-       string::iterator after = 0;
+       string::iterator before = string::iterator(0);
+       string::iterator after = string::iterator(0);
        for (string::iterator sit = ret.begin();
             sit != ret.end(); ++sit)
                if ((*sit) == '-') {
@@ -113,7 +115,9 @@ void FontInfo::query()
                return;
        }
 
-       char ** list = XListFonts(fl_display, pattern.c_str(), 100, &matches);
+       char ** list = 0;
+       if (lyxrc.use_gui)
+               list = XListFonts(fl_display, pattern.c_str(), 100, &matches);
 
        if (list == 0) {
                // No fonts matched
@@ -142,6 +146,17 @@ void FontInfo::query()
 }
 
 
+void FontInfo::init()
+{
+       sizes = 0;
+       strings = 0;
+       matches = 0;
+       queried = false;
+       scalable = false;
+       scaleindex = -1;
+}
+
+
 /// Release allocated stuff
 void FontInfo::release()
 {