summaryrefslogtreecommitdiff
path: root/otk/font.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-01-13 01:08:54 +0000
committerDana Jansens <danakj@orodu.net>2003-01-13 01:08:54 +0000
commit8b73f6f02517e717842d122d82e1eb08cda95e19 (patch)
tree33fd49f2649b3d6e530d7c904913d75f58f436d4 /otk/font.cc
parentecfac5f20c72647b4865a14ccffc307c2b116319 (diff)
begin conversion to ustring. add some more members.
Diffstat (limited to 'otk/font.cc')
-rw-r--r--otk/font.cc39
1 files changed, 11 insertions, 28 deletions
diff --git a/otk/font.cc b/otk/font.cc
index 0f1ad8c1..b9cc7075 100644
--- a/otk/font.cc
+++ b/otk/font.cc
@@ -13,10 +13,6 @@ extern "C" {
#include <iostream>
#include <algorithm>
-using std::string;
-using std::cerr;
-using std::endl;
-
#include "font.hh"
#include "util.hh"
#include "display.hh"
@@ -34,10 +30,10 @@ extern "C" {
namespace otk {
-string Font::_fallback_font = "fixed";
+std::string Font::_fallback_font = "fixed";
bool Font::_xft_init = false;
-Font::Font(int screen_num, const string &fontstring,
+Font::Font(int screen_num, const std::string &fontstring,
bool shadow, unsigned char offset, unsigned char tint)
: _screen_num(screen_num),
_fontstring(fontstring),
@@ -86,7 +82,7 @@ Font::~Font(void)
void Font::drawString(XftDraw *d, int x, int y, const Color &color,
- const string &string, bool utf8) const
+ const ustring &string) const
{
assert(d);
@@ -98,14 +94,9 @@ 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 (utf8)
- XftDrawStringUtf8(d, &c, _xftfont, x + _offset,
- _xftfont->ascent + y + _offset,
- (FcChar8*)string.c_str(), string.size());
- else
- XftDrawString8(d, &c, _xftfont, x + _offset,
- _xftfont->ascent + y + _offset,
- (FcChar8*)string.c_str(), string.size());
+ XftDrawStringUtf8(d, &c, _xftfont, x + _offset,
+ _xftfont->ascent + y + _offset,
+ (FcChar8*)string.c_str(), string.size());
}
XftColor c;
@@ -115,27 +106,19 @@ 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 (utf8)
- XftDrawStringUtf8(d, &c, _xftfont, x, _xftfont->ascent + y,
- (FcChar8*)string.c_str(), string.size());
- else
- XftDrawString8(d, &c, _xftfont, x, _xftfont->ascent + y,
- (FcChar8*)string.c_str(), string.size());
+ XftDrawStringUtf8(d, &c, _xftfont, x, _xftfont->ascent + y,
+ (FcChar8*)string.c_str(), string.size());
return;
}
-unsigned int Font::measureString(const string &string, bool utf8) const
+unsigned int Font::measureString(const ustring &string) const
{
XGlyphInfo info;
- if (utf8)
- XftTextExtentsUtf8(Display::display, _xftfont,
- (FcChar8*)string.c_str(), string.size(), &info);
- else
- XftTextExtents8(Display::display, _xftfont,
- (FcChar8*)string.c_str(), string.size(), &info);
+ XftTextExtentsUtf8(Display::display, _xftfont,
+ (FcChar8*)string.c_str(), string.size(), &info);
return info.xOff + (_shadow ? _offset : 0);
}