aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/FbString.cc
diff options
context:
space:
mode:
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