summaryrefslogtreecommitdiff
path: root/otk/font.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-01-12 23:55:30 +0000
committerDana Jansens <danakj@orodu.net>2003-01-12 23:55:30 +0000
commitbc99e6a420c04b4607bffc90e528d9572649f95f (patch)
tree4f6fd77cc1da27aa838ebd9d7de392a38248ef8e /otk/font.cc
parent703ef4df2278adef66a65bcfc9455da41d0413e6 (diff)
remove userstring
Diffstat (limited to 'otk/font.cc')
-rw-r--r--otk/font.cc22
1 files changed, 15 insertions, 7 deletions
diff --git a/otk/font.cc b/otk/font.cc
index 6932971c..0f1ad8c1 100644
--- a/otk/font.cc
+++ b/otk/font.cc
@@ -10,7 +10,15 @@ extern "C" {
#endif // HAVE_STDLIB_H
}
+#include <iostream>
+#include <algorithm>
+
+using std::string;
+using std::cerr;
+using std::endl;
+
#include "font.hh"
+#include "util.hh"
#include "display.hh"
#include "color.hh"
#include "screeninfo.hh"
@@ -26,10 +34,10 @@ extern "C" {
namespace otk {
-std::string Font::_fallback_font = "fixed";
+string Font::_fallback_font = "fixed";
bool Font::_xft_init = false;
-Font::Font(int screen_num, const std::string &fontstring,
+Font::Font(int screen_num, const string &fontstring,
bool shadow, unsigned char offset, unsigned char tint)
: _screen_num(screen_num),
_fontstring(fontstring),
@@ -78,7 +86,7 @@ Font::~Font(void)
void Font::drawString(XftDraw *d, int x, int y, const Color &color,
- const userstring &string) const
+ const string &string, bool utf8) const
{
assert(d);
@@ -90,7 +98,7 @@ void Font::drawString(XftDraw *d, int x, int y, const Color &color,
c.color.alpha = _tint | _tint << 8; // transparent shadow
c.pixel = BlackPixel(Display::display, _screen_num);
- if (string.utf8())
+ if (utf8)
XftDrawStringUtf8(d, &c, _xftfont, x + _offset,
_xftfont->ascent + y + _offset,
(FcChar8*)string.c_str(), string.size());
@@ -107,7 +115,7 @@ void Font::drawString(XftDraw *d, int x, int y, const Color &color,
c.pixel = color.pixel();
c.color.alpha = 0xff | 0xff << 8; // no transparency in Color yet
- if (string.utf8())
+ if (utf8)
XftDrawStringUtf8(d, &c, _xftfont, x, _xftfont->ascent + y,
(FcChar8*)string.c_str(), string.size());
else
@@ -118,11 +126,11 @@ void Font::drawString(XftDraw *d, int x, int y, const Color &color,
}
-unsigned int Font::measureString(const userstring &string) const
+unsigned int Font::measureString(const string &string, bool utf8) const
{
XGlyphInfo info;
- if (string.utf8())
+ if (utf8)
XftTextExtentsUtf8(Display::display, _xftfont,
(FcChar8*)string.c_str(), string.size(), &info);
else