]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FontInfo.C
Introduce LFUN_PRINT.
[lyx.git] / src / frontends / xforms / FontInfo.C
index c9dd2e1839010d434723cf08a355c613dd9deff4..d21f42df7c6c352e6d48f20983ac56f4ca3a0dcc 100644 (file)
@@ -1,32 +1,37 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file FontInfo.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author Asger Alstrup
+ * \author John Levon
  *
- *         Copyright 1997 Asger Alstrup
- *           and the LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS.
+ */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include "FontInfo.h"
+
 #include "debug.h"
 #include "lyxrc.h"     // lyxrc.use_scalable_fonts
 
+#include "frontends/lyx_gui.h"
+
 #include "support/lstrings.h"
 #include "support/lyxlib.h"
+#include "support/tostr.h"
 
-#include "frontends/GUIRunTime.h"
+#include "lyx_forms.h"
 
-#include <cmath>       // abs()
+#include <cmath>
+
+using lyx::support::atoi;
+using lyx::support::token;
 
-using std::endl;
 using std::abs;
+using std::endl;
+using std::string;
 
 
 /// Load font close to this size
@@ -118,8 +123,8 @@ void FontInfo::query()
        }
 
        char ** list = 0;
-       if (lyxrc.use_gui)
-               list = XListFonts(GUIRunTime::x11Display(), pattern.c_str(),
+       if (lyx_gui::use_gui)
+               list = XListFonts(fl_get_display(), pattern.c_str(),
                                  100, &matches);
 
        if (list == 0) {
@@ -133,16 +138,18 @@ void FontInfo::query()
                // We have matches. Run them through
                for (int i = 0; i < matches; ++i) {
                        string name(list[i]);
-                       lyxerr[Debug::FONT] << "match #" << i << " "
+                       lyxerr[Debug::FONT] << "match #" << i << ' '
                                            << name << endl;
-                       sizes[i] = lyx::atoi(token(name, '-', 7));
+                       sizes[i] = atoi(token(name, '-', 7));
                        strings[i] = name;
                        if (sizes[i] == 0) {
                                if (scaleindex == -1) {
                                        scaleindex = i;
                                }
                                scalable = true;
-                       };
+                       } else if (atoi(token(name, '-', 12)) == 0)
+                               // Ignore bogus matches of scalable fonts.
+                               sizes[i] = 0;
                };
                XFreeFontNames(list);
        }