aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/XFontImp.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/XFontImp.cc')
-rw-r--r--src/FbTk/XFontImp.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/FbTk/XFontImp.cc b/src/FbTk/XFontImp.cc
index 257a2a0..fa88593 100644
--- a/src/FbTk/XFontImp.cc
+++ b/src/FbTk/XFontImp.cc
@@ -97,8 +97,9 @@ bool XFontImp::load(const string &fontname) {
97 return true; 97 return true;
98} 98}
99 99
100void XFontImp::drawText(const FbDrawable &w, int screen, GC gc, const FbString &text, size_t len, int x, int y, FbTk::Orientation orient) { 100void XFontImp::drawText(const FbDrawable &w, int screen, GC gc, const char* text, size_t len, int x, int y, FbTk::Orientation orient) {
101 if (m_fontstruct == 0) 101
102 if (!text || !*text || m_fontstruct == 0)
102 return; 103 return;
103 104
104 // use roated font functions? 105 // use roated font functions?
@@ -107,21 +108,18 @@ void XFontImp::drawText(const FbDrawable &w, int screen, GC gc, const FbString &
107 return; 108 return;
108 } 109 }
109 110
110 string localestr = text; 111 std::string localestr = FbStringUtil::FbStrToLocale(FbString(text, 0, len));
111 localestr.erase(len, string::npos);
112 localestr = FbStringUtil::FbStrToLocale(localestr);
113 112
114 XSetFont(w.display(), gc, m_fontstruct->fid); 113 XSetFont(w.display(), gc, m_fontstruct->fid);
115 XDrawString(w.display(), w.drawable(), gc, x, y, localestr.data(), localestr.size()); 114 XDrawString(w.display(), w.drawable(), gc, x, y, localestr.data(), localestr.size());
116} 115}
117 116
118unsigned int XFontImp::textWidth(const FbString &text, unsigned int size) const { 117unsigned int XFontImp::textWidth(const char* text, unsigned int size) const {
119 if (text.empty() || m_fontstruct == 0) 118
119 if (!text || !*text || m_fontstruct == 0)
120 return 0; 120 return 0;
121 121
122 string localestr = text; 122 std::string localestr = FbStringUtil::FbStrToLocale(FbString(text, size));
123 localestr.erase(size, string::npos);
124 localestr = FbStringUtil::FbStrToLocale(localestr);
125 123
126 return XTextWidth(m_fontstruct, localestr.data(), localestr.size()); 124 return XTextWidth(m_fontstruct, localestr.data(), localestr.size());
127} 125}