]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/gtk/xftFontMetrics.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / gtk / xftFontMetrics.C
index dd10bd537405b38f9dd6a3e9e535c0be064d3a12..09d76a80e4b620579636efcdbe9eb29e0268aca2 100644 (file)
@@ -5,15 +5,17 @@
  *
  * \author Huang Ying
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
-#include <gtkmm.h>
 
-#include <algorithm>
+// Too hard to make concept checks work with this file
+#ifdef _GLIBCPP_CONCEPT_CHECKS
+#undef _GLIBCPP_CONCEPT_CHECKS
+#endif
+
 #include "GtkmmX.h"
-#include "support/lstrings.h"
 #include "xftFontLoader.h"
 #include "font_metrics.h"
 #include "lyxrc.h"
 #include "language.h"
 #include "codeConvert.h"
 
+#include "support/lstrings.h"
+
+#include <gtkmm.h>
+
 #include <boost/scoped_array.hpp>
 
+#include <algorithm>
+
+using std::string;
+
 
 namespace {
 
@@ -99,7 +109,7 @@ int ascent(wchar_t c,LyXFont const & f)
        XftFont * font = getXftFont(f);
        XGlyphInfo glyph;
        XftTextExtents32(getDisplay(), font,
-                        wcsToFcChar32StrFast(&c),
+                        wcsToXftChar32StrFast(&c),
                         1,
                         &glyph);
        return XGlyphAscent(glyph);
@@ -117,7 +127,7 @@ int descent(wchar_t c,LyXFont const & f)
        XftFont * font = getXftFont(f);
        XGlyphInfo glyph;
        XftTextExtents32(getDisplay(), font,
-                        wcsToFcChar32StrFast(&c),
+                        wcsToXftChar32StrFast(&c),
                         1,
                         &glyph);
        return XGlyphDescent(glyph);
@@ -131,15 +141,15 @@ int descent(char c, LyXFont const & f)
 
 
 int lbearing(wchar_t c,LyXFont const & f)
- {
+{
        XftFont * font = getXftFont(f);
        XGlyphInfo glyph;
        XftTextExtents32(getDisplay(), font,
-                        wcsToFcChar32StrFast(&c),
+                        wcsToXftChar32StrFast(&c),
                         1,
                         &glyph);
        return XGlyphLbearing(glyph);
- }
+}
 
 
 int rbearing(wchar_t c,LyXFont const & f)
@@ -147,7 +157,7 @@ int rbearing(wchar_t c,LyXFont const & f)
        XftFont * font = getXftFont(f);
        XGlyphInfo glyph;
        XftTextExtents32(getDisplay(), font,
-                        wcsToFcChar32StrFast(&c),
+                        wcsToXftChar32StrFast(&c),
                         1,
                         &glyph);
        return XGlyphRbearing(glyph);
@@ -172,7 +182,8 @@ int width(wchar_t const * s, size_t n, LyXFont const & f)
        XGlyphInfo glyph;
        if (f.realShape() != LyXFont::SMALLCAPS_SHAPE){
                XftTextExtents32(getDisplay(), font,
-                                wcsToFcChar32StrFast(s),
+                                const_cast<XftChar32 *>(
+                                        wcsToXftChar32StrFast(s)),
                                 n,
                                 &glyph);
                return XGlyphLogWidth(glyph);
@@ -185,13 +196,13 @@ int width(wchar_t const * s, size_t n, LyXFont const & f)
                        wchar_t wc = lyx::support::uppercase(s[i]);
                        if (wc != s[i]) {
                                XftTextExtents32(getDisplay(), fontS,
-                                                wcsToFcChar32StrFast(&wc),
+                                                wcsToXftChar32StrFast(&wc),
                                                 1,
                                                 &glyph);
                                result += XGlyphLogWidth(glyph);
                        } else {
                                XftTextExtents32(getDisplay(), font,
-                                                wcsToFcChar32StrFast(&wc),
+                                                wcsToXftChar32StrFast(&wc),
                                                 1,
                                                 &glyph);
                                result += XGlyphLogWidth(glyph);
@@ -208,7 +219,7 @@ int width(wchar_t c,LyXFont const & f)
 }
 
 
-int width(char const * s, size_t n,LyXFont const & f)
+int width(char const * s, size_t n, LyXFont const & f)
 {
        boost::scoped_array<wchar_t> wcs(new wchar_t[n]);
        size_t len;
@@ -229,10 +240,10 @@ int signedWidth(string const & s, LyXFont const & f)
                return 0;
        boost::scoped_array<wchar_t> wcs(new wchar_t[s.length() + 1]);
        int len = mbstowcs(wcs.get(), s.c_str(), s.length());
-       if (wcs[0] == '-')
-               return width(wcs.get() + 1, len - 1, f);
-       else
-               return width(wcs.get(), len, f);
+       if (wcs[0] == '-')
+               return width(wcs.get() + 1, len - 1, f);
+       else
+               return width(wcs.get(), len, f);
 }
 
 
@@ -262,4 +273,3 @@ void buttonText(string const & str, LyXFont const & font,
 
 
 } // namespace font_metrics
-