Intend to fix the problems documented in the thread:

Notes:
1. I use pkg-config to test for both fribid2 and fribidi. Even
   in the old fribidi, pkg-config support was committed to upstream
   3 years ago, so that's how far I went back. If any distribution
   still has problems with that -- please speak up.

2. The older <fribidi/fribidi.h> was used in the past because fribidi-config
   wrongly passed -I${includedir}. pkg-config in both fribidi and fribidi2
   passes the correct -I{$includedir}/fribidi. As a result the include
   in font.cpp was fixed.

3. In a separate mail Mark noted that the new widget system in wesnoth
   uses Pango and therefore would deprecate fribidi -- great move, as
   it would remove the need for all the previous right-to-left display
   hacks. An interesting paper from the maintainer or Pango and fribidi:
      http://behdad.org/text
   And the related slides:
      http://behdad.org/download/Presentations/slippy/stateoftext_slides.pdf

Please test with different distibutions so we can fix this. It's important
that distro packagers would test this with their wesnoth-1.6.x and 1.4.x as
it would provide them migration path when fribidi2 hits their distros.

Thanks,
   
-- 
Oron Peled                                 Voice: +972-4-8228492
[email protected]                  http://users.actcom.co.il/~oron
"In theory, there is no difference between theory and practice.
In practice, there is."
        -- Yogi Berra

Index: src/font.cpp
===================================================================
--- src/font.cpp	(revision 36863)
+++ src/font.cpp	(working copy)
@@ -50,7 +50,7 @@
 #define ERR_FT LOG_STREAM(err, log_font)
 
 #ifdef	HAVE_FRIBIDI
-#include <fribidi/fribidi.h>
+#include <fribidi.h>
 #endif
 
 namespace {
@@ -471,9 +471,18 @@
 	FriBidiCharType	base_dir = FRIBIDI_TYPE_ON;
 	FriBidiStrIndex n;
 
+
+#ifdef	OLD_FRIBIDI
+	n = fribidi_utf8_to_unicode (c_str, len, bidi_logical);
+#else
 	n = fribidi_charset_to_unicode(FRIBIDI_CHAR_SET_UTF8, c_str, len, bidi_logical);
+#endif
 	fribidi_log2vis(bidi_logical, n, &base_dir, bidi_visual, NULL, NULL, NULL);
+#ifdef	OLD_FRIBIDI
+	fribidi_unicode_to_utf8 (bidi_visual, n, utf8str);
+#else
 	fribidi_unicode_to_charset(FRIBIDI_CHAR_SET_UTF8, bidi_visual, n, utf8str);
+#endif
 	is_rtl_ = base_dir == FRIBIDI_TYPE_RTL;
 	str_ = std::string(utf8str);
 	delete[] bidi_logical;
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 36863)
+++ src/Makefile.am	(working copy)
@@ -477,10 +477,16 @@
 	-DLOCALEDIR=\"$(LOCALEDIR)\" -DHAS_RELATIVE_LOCALEDIR=$(HAS_RELATIVE_LOCALEDIR)
 
 if FRIBIDI
-    AM_CXXFLAGS += -DHAVE_FRIBIDI @FRIBIDI_CFLAGS@
-    AM_CFLAGS += -DHAVE_FRIBIDI @FRIBIDI_CFLAGS@
+if OLD_FRIBIDI
+    CXXFLAGS += -DOLD_FRIBIDI @FRIBIDI_CFLAGS@
+    CFLAGS += -DOLD_FRIBIDI @FRIBIDI_CFLAGS@
     THELIBS += @FRIBIDI_LIBS@
+else
+    CXXFLAGS += -DHAVE_FRIBIDI @FRIBIDI2_CFLAGS@
+    CFLAGS += -DHAVE_FRIBIDI @FRIBIDI2_CFLAGS@
+    THELIBS += @FRIBIDI2_LIBS@
 endif
+endif
 
 if X11
     CXXFLAGS += -D_X11 @X_CFLAGS@
Index: configure.ac
===================================================================
--- configure.ac	(revision 36863)
+++ configure.ac	(working copy)
@@ -417,10 +417,24 @@
 # fribidi-config
 
 if test "x$fribidi" != "xno"; then
-	PKG_CHECK_MODULES([FRIBIDI], [fribidi >= 0.10.9],
-		[ fribidifound=yes ],
-		[ fribidifound=no ])
+	PKG_CHECK_MODULES([FRIBIDI2], [fribidi >= 0.19.0],
+		[
+			fribidifound=yes
+		],
+		[
+			AC_MSG_RESULT(no)
+			PKG_CHECK_MODULES([FRIBIDI], [fribidi],
+				[
+					fribidifound=yes
+					oldfribidi=yes
+				],
+				[
+					fribidifound=no
+					AC_MSG_RESULT(no)
+				])
+		])
 	AM_CONDITIONAL([FRIBIDI], [test "x$fribidifound" = xyes])
+	AM_CONDITIONAL([OLD_FRIBIDI], [test "x$oldfribidi" = xyes])
 fi
 
 # python
_______________________________________________
Wesnoth-dev mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-dev

Reply via email to