diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-01-13 03:51:48 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-01-13 03:51:48 +0000 |
| commit | 4947902d269213edee40f3f31f97721fa0dd3877 (patch) | |
| tree | d8e2af6c768a7e62ebdc7ff55029d6f25ca88acb /otk/font.cc | |
| parent | 2aff07a250930db7e0eb69dd6cd776333fcb8b9a (diff) | |
more conversion to ustring. added more members
Diffstat (limited to 'otk/font.cc')
| -rw-r--r-- | otk/font.cc | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/otk/font.cc b/otk/font.cc index b9cc7075..6fbdb095 100644 --- a/otk/font.cc +++ b/otk/font.cc @@ -94,9 +94,14 @@ 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); - XftDrawStringUtf8(d, &c, _xftfont, x + _offset, - _xftfont->ascent + y + _offset, - (FcChar8*)string.c_str(), string.size()); + if (string.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()); } XftColor c; @@ -106,8 +111,12 @@ 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 - XftDrawStringUtf8(d, &c, _xftfont, x, _xftfont->ascent + y, - (FcChar8*)string.c_str(), string.size()); + if (string.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()); return; } @@ -117,8 +126,12 @@ unsigned int Font::measureString(const ustring &string) const { XGlyphInfo info; - XftTextExtentsUtf8(Display::display, _xftfont, - (FcChar8*)string.c_str(), string.size(), &info); + if (string.utf8()) + XftTextExtentsUtf8(Display::display, _xftfont, + (FcChar8*)string.c_str(), string.size(), &info); + else + XftTextExtents8(Display::display, _xftfont, + (FcChar8*)string.c_str(), string.size(), &info); return info.xOff + (_shadow ? _offset : 0); } |
