aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/FbString.cc
diff options
context:
space:
mode:
authorKen Bloom <kbloom at gmail com>2010-09-04 13:01:33 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2010-09-04 13:01:33 (GMT)
commitea98db414033aa17aee720135e2f9ee0a08696cc (patch)
tree40f0f68ee4a86289d832713890c226f31cdf853a /src/FbTk/FbString.cc
parentb1b2f47e7dd185fef88a44a318a9b374083ecb40 (diff)
downloadfluxbox-ea98db414033aa17aee720135e2f9ee0a08696cc.zip
fluxbox-ea98db414033aa17aee720135e2f9ee0a08696cc.tar.bz2
added support for bidirectional text
Diffstat (limited to 'src/FbTk/FbString.cc')
-rw-r--r--src/FbTk/FbString.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/FbTk/FbString.cc b/src/FbTk/FbString.cc
index 0164afd..1cef002 100644
--- a/src/FbTk/FbString.cc
+++ b/src/FbTk/FbString.cc
@@ -45,6 +45,11 @@
45 45
46#include <iostream> 46#include <iostream>
47 47
48#ifdef HAVE_FRIBIDI
49#include <fribidi/fribidi.h>
50#endif
51
52
48using std::string; 53using std::string;
49 54
50#ifdef DEBUG 55#ifdef DEBUG
@@ -239,6 +244,37 @@ bool haveUTF8() {
239} 244}
240 245
241 246
247#ifdef HAVE_FRIBIDI
248
249FbString BidiLog2Vis (const FbString& src){
250 FriBidiChar * us, * out_us;
251 FriBidiCharType base;
252 FbString r;
253 char * out;
254
255 us = new FriBidiChar[src.size()+1];
256 out_us = new FriBidiChar[src.size()+1];
257
258 unsigned int len = fribidi_charset_to_unicode(FRIBIDI_CHAR_SET_UTF8, const_cast<char *>(src.c_str()), src.length(), us);
259
260 base = FRIBIDI_TYPE_N;
261 fribidi_log2vis(us, len, &base, out_us, NULL, NULL, NULL);
262
263 out = new char[4*src.size()+1];
264
265 fribidi_unicode_to_charset(FRIBIDI_CHAR_SET_UTF8, out_us, len, out);
266
267 r = out;
268
269 delete[] out_us;
270 delete[] us;
271 delete[] out;
272
273 return r;
274}
275
276#endif
277
242} // end namespace StringUtil 278} // end namespace StringUtil
243 279
244StringConvertor::StringConvertor(EncodingTarget target): 280StringConvertor::StringConvertor(EncodingTarget target):
@@ -289,4 +325,5 @@ string StringConvertor::recode(const string &src) {
289#endif 325#endif
290} 326}
291 327
328
292} // end namespace FbTk 329} // end namespace FbTk