diff options
Diffstat (limited to 'src/FbTk/Font.cc')
-rw-r--r-- | src/FbTk/Font.cc | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/src/FbTk/Font.cc b/src/FbTk/Font.cc index 28341a7..ea0fbde 100644 --- a/src/FbTk/Font.cc +++ b/src/FbTk/Font.cc | |||
@@ -247,14 +247,8 @@ bool Font::load(const string &name) { | |||
247 | return false; | 247 | return false; |
248 | } | 248 | } |
249 | 249 | ||
250 | unsigned int Font::textWidth(const FbString &text, unsigned int size) const { | 250 | unsigned int Font::textWidth(const char* text, unsigned int size) const { |
251 | #ifdef HAVE_FRIBIDI | 251 | return m_fontimp->textWidth(text, size); |
252 | const FbString visualOrder(FbTk::FbStringUtil::BidiLog2Vis(text)); | ||
253 | #else | ||
254 | const FbString &visualOrder = text; | ||
255 | #endif | ||
256 | |||
257 | return m_fontimp->textWidth(visualOrder, size); | ||
258 | } | 252 | } |
259 | 253 | ||
260 | unsigned int Font::height() const { | 254 | unsigned int Font::height() const { |
@@ -274,34 +268,28 @@ bool Font::validOrientation(FbTk::Orientation orient) { | |||
274 | } | 268 | } |
275 | 269 | ||
276 | void Font::drawText(const FbDrawable &w, int screen, GC gc, | 270 | void Font::drawText(const FbDrawable &w, int screen, GC gc, |
277 | const FbString &text, size_t len, int x, int y, | 271 | const char* text, size_t len, int x, int y, |
278 | Orientation orient) const { | 272 | Orientation orient) const { |
279 | if (text.empty() || len == 0) | ||
280 | return; | ||
281 | |||
282 | #ifdef HAVE_FRIBIDI | ||
283 | const FbString visualOrder(FbTk::FbStringUtil::BidiLog2Vis(text)); | ||
284 | #else | ||
285 | const FbString &visualOrder = text; | ||
286 | #endif | ||
287 | 273 | ||
274 | if (!text || !*text || len == 0) | ||
275 | return; | ||
288 | 276 | ||
289 | // draw "effects" first | 277 | // draw "effects" first |
290 | if (m_shadow) { | 278 | if (m_shadow) { |
291 | FbTk::GContext shadow_gc(w); | 279 | FbTk::GContext shadow_gc(w); |
292 | shadow_gc.setForeground(m_shadow_color); | 280 | shadow_gc.setForeground(m_shadow_color); |
293 | m_fontimp->drawText(w, screen, shadow_gc.gc(), visualOrder, len, | 281 | m_fontimp->drawText(w, screen, shadow_gc.gc(), text, len, |
294 | x + m_shadow_offx, y + m_shadow_offy, orient); | 282 | x + m_shadow_offx, y + m_shadow_offy, orient); |
295 | } else if (m_halo) { | 283 | } else if (m_halo) { |
296 | FbTk::GContext halo_gc(w); | 284 | FbTk::GContext halo_gc(w); |
297 | halo_gc.setForeground(m_halo_color); | 285 | halo_gc.setForeground(m_halo_color); |
298 | m_fontimp->drawText(w, screen, halo_gc.gc(), visualOrder, len, x + 1, y + 1, orient); | 286 | m_fontimp->drawText(w, screen, halo_gc.gc(), text, len, x + 1, y + 1, orient); |
299 | m_fontimp->drawText(w, screen, halo_gc.gc(), visualOrder, len, x - 1, y + 1, orient); | 287 | m_fontimp->drawText(w, screen, halo_gc.gc(), text, len, x - 1, y + 1, orient); |
300 | m_fontimp->drawText(w, screen, halo_gc.gc(), visualOrder, len, x - 1, y - 1, orient); | 288 | m_fontimp->drawText(w, screen, halo_gc.gc(), text, len, x - 1, y - 1, orient); |
301 | m_fontimp->drawText(w, screen, halo_gc.gc(), visualOrder, len, x + 1, y - 1, orient); | 289 | m_fontimp->drawText(w, screen, halo_gc.gc(), text, len, x + 1, y - 1, orient); |
302 | } | 290 | } |
303 | 291 | ||
304 | m_fontimp->drawText(w, screen, gc, visualOrder, len, x, y, orient); | 292 | m_fontimp->drawText(w, screen, gc, text, len, x, y, orient); |
305 | 293 | ||
306 | 294 | ||
307 | } | 295 | } |