Package: fluxbox
Version: 1.1.1-7
Severity: wishlist
Tags: patch

It would be nice to have more window managers in Debian that support
bidirectional Hebrew window titles. To that end, please add fribidi
support to Fluxbox using the attached patch.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-4-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages fluxbox depends on:
ii  libc6                   2.10.2-6         Embedded GNU C Library: Shared lib
ii  libfontconfig1          2.8.0-2          generic font configuration library
ii  libfreetype6            2.3.11-1         FreeType 2 font engine, shared lib
ii  libgcc1                 1:4.4.3-7        GCC support library
ii  libice6                 2:1.0.6-1        X11 Inter-Client Exchange library
ii  libimlib2               1.4.2-8+b1       powerful image loading and renderi
ii  libsm6                  2:1.1.1-1        X11 Session Management library
ii  libstdc++6              4.4.3-7          The GNU Standard C++ Library v3
ii  libx11-6                2:1.3.3-3        X11 client-side library
ii  libxext6                2:1.1.1-3        X11 miscellaneous extension librar
ii  libxft2                 2.1.14-2         FreeType-based font drawing librar
ii  libxinerama1            2:1.1-3          X11 Xinerama extension library
ii  libxpm4                 1:3.5.8-1        X11 pixmap library
ii  libxrandr2              2:1.3.0-3        X11 RandR extension library
ii  libxrender1             1:0.9.5-2        X Rendering Extension client libra
ii  menu                    2.1.43           generates programs menu for all me
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

Versions of packages fluxbox recommends:
ii  xfonts-terminus               4.30-2     Fixed-width fonts for fast reading

Versions of packages fluxbox suggests:
pn  fbdesk                        <none>     (no description available)
pn  fbpager                       <none>     (no description available)
pn  fluxconf                      <none>     (no description available)

-- no debconf information
>From 412063d025e728cef88ec6acde42f5a4f188f211 Mon Sep 17 00:00:00 2001
From: Ken Bloom <[email protected]>
Date: Fri, 5 Jun 2009 10:42:29 -0500
Subject: [PATCH] Bidi Support

Add support for bidirectional text using the fribidi library.
The function FbTk::FbStringUtil::BidiLog2Vis is based on the function
utils::makebidi from the newsbeuter console text reader
(git://github.com/akrennmair/newsbeuter.git, www.newsbeuter.org),
copyright Andreas Krennmair, released under what appears to be the same
license as FluxBox.

Bidi support is enabled by default, but can be disabled with the
--disable-fribidi configure switch.
---
 configure.in         |   22 ++++++++++++++++++++++
 src/FbTk/FbString.cc |   37 +++++++++++++++++++++++++++++++++++++
 src/FbTk/FbString.hh |    5 +++++
 src/FbTk/Font.cc     |    7 ++++++-
 4 files changed, 70 insertions(+), 1 deletions(-)

diff --git a/configure.in b/configure.in
index 73662ae..b209dde 100644
--- a/configure.in
+++ b/configure.in
@@ -141,7 +141,29 @@ dnl Check if iconv uses const in prototype declaration
     fi
 fi
 
+#fribidi support - OPTIONAL!
+
+want_fribidi="auto"
+AC_ARG_ENABLE(fribidi,
+ AC_HELP_STRING(
+   [--disable-fribidi],
+   [disable bidirectional text support. [[default=enabled]]]
+ ),
+ [ want_fribidi=$enableval ]
+)
 
+if test "x$want_fribidi" = "xyes" -o "x$want_fribidi" = "xauto" ; then
+ # Check if really available
+ PKG_CHECK_MODULES(FRIBIDI, fribidi,
+   [
+     AC_DEFINE(HAVE_FRIBIDI, 1, [have fribidi support])
+   ],
+   [
+     AC_MSG_ERROR([Fribidi not found (strict dependencies checking)])
+   ])
+fi
+LIBS="$LIBS $FRIBIDI_LIBS"
+CFLAGS="$CFLAGS $FRIBIDI_CFLAGS"
 
 AC_CHECK_LIB(nsl, t_open, LIBS="$LIBS -lnsl")
 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
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 @@
 
 #include <iostream>
 
+#ifdef HAVE_FRIBIDI
+#include <fribidi/fribidi.h>
+#endif
+
+
 using std::string;
 
 #ifdef DEBUG
@@ -239,6 +244,37 @@ bool haveUTF8() {
 }
 
 
+#ifdef HAVE_FRIBIDI
+
+FbString BidiLog2Vis (const FbString& src){
+       FriBidiChar * us, * out_us;
+       FriBidiCharType base;
+       FbString r;
+       char * out;
+
+       us = new FriBidiChar[src.size()+1];
+       out_us = new FriBidiChar[src.size()+1];
+
+       unsigned int len = fribidi_charset_to_unicode(FRIBIDI_CHAR_SET_UTF8, 
const_cast<char *>(src.c_str()), src.length(), us);
+
+       base = FRIBIDI_TYPE_N;
+       fribidi_log2vis(us, len, &base, out_us, NULL, NULL, NULL);
+
+       out = new char[4*src.size()+1];
+
+       fribidi_unicode_to_charset(FRIBIDI_CHAR_SET_UTF8, out_us, len, out);
+
+       r = out;
+
+       delete[] out_us;
+       delete[] us;
+       delete[] out;
+
+       return r;
+}
+
+#endif
+
 } // end namespace StringUtil
 
 StringConvertor::StringConvertor(EncodingTarget target):
@@ -289,4 +325,5 @@ string StringConvertor::recode(const string &src) {
 #endif
 }
 
+
 } // end namespace FbTk
diff --git a/src/FbTk/FbString.hh b/src/FbTk/FbString.hh
index 1e473cc..e1a5dc5 100644
--- a/src/FbTk/FbString.hh
+++ b/src/FbTk/FbString.hh
@@ -52,6 +52,11 @@ std::string FbStrToX(const FbString &src);
 FbString LocaleStrToFb(const std::string &src);
 std::string FbStrToLocale(const FbString &src);
 
+#ifdef HAVE_FRIBIDI
+/// Make Bidi
+FbString BidiLog2Vis (const FbString& src);
+#endif
+
 bool haveUTF8();
 
 } // namespace FbStringUtil
diff --git a/src/FbTk/Font.cc b/src/FbTk/Font.cc
index f0951ff..7773430 100644
--- a/src/FbTk/Font.cc
+++ b/src/FbTk/Font.cc
@@ -297,8 +297,13 @@ void Font::drawText(const FbDrawable &w, int screen, GC gc,
         }
     }
 
-    m_fontimp->drawText(w, screen, gc, text, len, x, y, orient);
+#ifdef HAVE_FRIBIDI
+    FbString visualorder=FbTk::FbStringUtil::BidiLog2Vis(text);
 
+    m_fontimp->drawText(w, screen, gc, visualorder, len, x, y, orient);
+#else
+    m_fontimp->drawText(w, screen, gc, text, len, x, y, orient);
+#endif
 }
 
 };
-- 
1.6.3.1


                 

Reply via email to