]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/xfont_loader.C
Yet more dialog tweaking from Rob.
[lyx.git] / src / frontends / xforms / xfont_loader.C
index cbadcf99d1bafb29405badfbf2ee53d7f60a8e56..32b5bd09090bcbe748b9ae27fd188d444f02f824 100644 (file)
@@ -1,12 +1,12 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file xfont_loader.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
  *
- *         Copyright 1997 Asger Alstrup
- *           and the LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS
+ */
 
 #include <config.h>
 #include <cmath>       // fabs()
 #include "lyxrc.h"     // lyxrc.font_*
 #include "BufferView.h"
 #include "frontends/LyXView.h"
-#include "frontends/GUIRunTime.h"
-
-using std::endl;
 
-extern BufferView * current_view;
+#include FORMS_H_LOCATION
 
+using std::endl;
 
 // The global fontloader
-FontLoader fontloader;
+xfont_loader fontloader;
 
 
 // Initialize font loader
-FontLoader::FontLoader()
+xfont_loader::xfont_loader()
 {
        reset();
 }
 
 
 // Destroy font loader
-FontLoader::~FontLoader()
+xfont_loader::~xfont_loader()
 {
        unload();
 }
@@ -50,14 +48,14 @@ FontLoader::~FontLoader()
 // Update fonts after zoom, dpi, font names, or norm change
 // For now, we just ditch all fonts we have. Later, we should
 // reuse the ones that are already loaded.
-void FontLoader::update()
+void xfont_loader::update()
 {
        unload();
 }
 
 
 // Reset font loader
-void FontLoader::reset()
+void xfont_loader::reset()
 {
        // Clear font infos, font structs and font metrics
        for (int i1 = 0; i1 < LyXFont::NUM_FAMILIES; ++i1)
@@ -72,7 +70,7 @@ void FontLoader::reset()
 
 
 // Unload all fonts
-void FontLoader::unload()
+void xfont_loader::unload()
 {
        // Unload all fonts
        for (int i1 = 0; i1 < LyXFont::NUM_FAMILIES; ++i1)
@@ -84,7 +82,7 @@ void FontLoader::unload()
                                }
                                for (int i4 = 0; i4 < 10; ++i4) {
                                        if (fontstruct[i1][i2][i3][i4]) {
-                                               XFreeFont(GUIRunTime::x11Display(), fontstruct[i1][i2][i3][i4]);
+                                               XFreeFont(fl_get_display(), fontstruct[i1][i2][i3][i4]);
                                                fontstruct[i1][i2][i3][i4] = 0;
                                        }
                                }
@@ -95,7 +93,7 @@ void FontLoader::unload()
 // Get font info
 /* Takes care of finding which font that can match the given request. Tries
 different alternatives. */
-void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family,
+void xfont_loader::getFontinfo(LyXFont::FONT_FAMILY family,
                             LyXFont::FONT_SERIES series,
                             LyXFont::FONT_SHAPE shape)
 {
@@ -146,6 +144,11 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family,
                                new FontInfo("-*-eufm10-medium-*-*-*-*-*-*-*-*-*-*-*");
                        return;
 
+               case LyXFont::WASY_FAMILY:
+                       fontinfo[family][series][shape] =
+                               new FontInfo("-*-wasy10-medium-*-*-*-*-*-*-*-*-*-*-*");
+                       return;
+
                default:
                        break;
        }
@@ -259,7 +262,7 @@ bool dummyXFontStructisGood = false;
 } // namespace anon
 
 /// Do load font
-XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
+XFontStruct * xfont_loader::doLoad(LyXFont::FONT_FAMILY family,
                                LyXFont::FONT_SERIES series,
                                LyXFont::FONT_SHAPE shape,
                                LyXFont::FONT_SIZE size)
@@ -292,16 +295,15 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
 
        XFontStruct * fs = 0;
 
-       current_view->owner()->messagePush(_("Loading font into X-Server..."));
-
-       fs = XLoadQueryFont(GUIRunTime::x11Display(), font.c_str());
+       fs = XLoadQueryFont(fl_get_display(), font.c_str());
 
        if (fs == 0) {
                if (font == "fixed") {
                        lyxerr << "We're doomed. Can't get 'fixed' font." << endl;
                } else {
-                       lyxerr << "Could not get font. Using 'fixed'." << endl;
-                       fs = XLoadQueryFont(GUIRunTime::x11Display(), "fixed");
+                       lyxerr << "Could not get font '" << font 
+                               << "'. Using 'fixed'." << endl;
+                       fs = XLoadQueryFont(fl_get_display(), "fixed");
                }
        } else if (lyxerr.debugging(Debug::FONT)) {
                // Tell user the font matching
@@ -319,14 +321,12 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
                       << "' matched by\n" << font << endl;
        }
 
-       current_view->owner()->messagePop();
-
        fontstruct[family][series][shape][size] = fs;
        return fs;
 }
 
 
-bool FontLoader::available(LyXFont const & f)
+bool xfont_loader::available(LyXFont const & f)
 {
        if (!lyxrc.use_gui)
                return false;