]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/xfont_metrics.C
remove defaults stuff, let Qt handle no toolbar
[lyx.git] / src / frontends / xforms / xfont_metrics.C
index 49ff1853a82ca8eb50fa9602bcc0a9838e2b4e34..4412065a12781ce5be6a0d94a38c00b6f0f3c535 100644 (file)
@@ -4,19 +4,15 @@
  * Licence details can be found in the file COPYING.
  *
  * \author unknown
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation "frontends/font_metrics.h"
-#pragma implementation "frontends/xfont_metrics.h"
-#endif
-
 #include "support/lstrings.h"
+#include "frontends/lyx_gui.h"
 #include "xfont_metrics.h"
 #include "xfont_loader.h"
 #include "lyxrc.h"
@@ -44,9 +40,9 @@ XID getFontID(LyXFont const & f)
 
 } // namespace anon
 
+
 namespace font_metrics {
+
 int maxAscent(LyXFont const & f)
 {
        return getXFontstruct(f)->ascent;
@@ -65,7 +61,7 @@ int ascent(char c, LyXFont const & f)
        unsigned int uc = static_cast<unsigned char>(c);
        if (finfo->per_char
            && uc >= finfo->min_char_or_byte2
-           && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) 
+           && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1)
                return finfo->per_char[uc - finfo->min_char_or_byte2].ascent;
        else
                return finfo->ascent;
@@ -78,7 +74,7 @@ int descent(char c, LyXFont const & f)
        unsigned int uc = static_cast<unsigned char>(c);
        if (finfo->per_char
            && uc >= finfo->min_char_or_byte2
-           && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) 
+           && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1)
                return finfo->per_char[uc - finfo->min_char_or_byte2].descent;
        else
                return finfo->descent;
@@ -91,7 +87,7 @@ int lbearing(char c, LyXFont const & f)
        unsigned int uc = static_cast<unsigned char>(c);
        if (finfo->per_char
            && uc >= finfo->min_char_or_byte2
-           && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) 
+           && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1)
                return finfo->per_char[uc - finfo->min_char_or_byte2].lbearing;
        else
                return 0;
@@ -104,7 +100,7 @@ int rbearing(char c, LyXFont const & f)
        unsigned int uc = static_cast<unsigned char>(c);
        if (finfo->per_char
            && uc >= finfo->min_char_or_byte2
-           && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) 
+           && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1)
                return finfo->per_char[uc - finfo->min_char_or_byte2].rbearing;
        else
                return width(c, f);
@@ -113,7 +109,7 @@ int rbearing(char c, LyXFont const & f)
 
 int width(char const * s, size_t n, LyXFont const & f)
 {
-       if (!lyxrc.use_gui)
+       if (!lyx_gui::use_gui)
                return n;
 
        if (lyxrc.font_norm_type == LyXRC::ISO_10646_1) {
@@ -131,7 +127,7 @@ int width(char const * s, size_t n, LyXFont const & f)
                        Uchar c = encoding->ucs(s[i]);
                        xs[i].byte1 = c >> 8;
                        xs[i].byte2 = c & 0xff;
-                }
+               }
                int result = xfont_metrics::width(xs.get(), n, font);
                return result;
        }
@@ -168,8 +164,8 @@ int signedWidth(string const & s, LyXFont const & f)
 
 
 void rectText(string const & str, LyXFont const & font,
-       int & width, 
-       int & ascent, 
+       int & width,
+       int & ascent,
        int & descent)
 {
        static int const d = 2;
@@ -181,26 +177,26 @@ void rectText(string const & str, LyXFont const & font,
 
 
 void buttonText(string const & str, LyXFont const & font,
-       int & width, 
-       int & ascent, 
+       int & width,
+       int & ascent,
        int & descent)
 {
        static int const d = 3;
-       
+
        width = font_metrics::width(str, font) + d * 2 + 2;
        ascent = font_metrics::maxAscent(font) + d;
        descent = font_metrics::maxDescent(font) + d;
 }
 
 } // namespace font_metrics
+
 namespace xfont_metrics {
+
 int width(XChar2b const * s, int n, LyXFont const & f)
 {
-       if (!lyxrc.use_gui)
+       if (!lyx_gui::use_gui)
                return n;
-       
+
        if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) {
                return ::XTextWidth16(getXFontstruct(f), s, n);
        } else {
@@ -225,7 +221,7 @@ int width(XChar2b const * s, int n, LyXFont const & f)
                return result;
        }
 }
+
 
 int XTextWidth(LyXFont const & f, char const * str, int count)
 {
@@ -240,9 +236,9 @@ int XTextWidth16(LyXFont const & f, XChar2b const * str, int count)
 
 
 /// hmm, not a metric !
-void XSetFont(Display * display, GC gc, LyXFont const & f) 
+void XSetFont(Display * display, GC gc, LyXFont const & f)
 {
        ::XSetFont(display, gc, getFontID(f));
 }
+
 } // namespace xfont_metrics