Add BiDi infrastructure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following patch adds reliance on the fribidi infrastructure into Wine.

License: LGPL

Changelog:
    Shachar Shemesh <winecode@sun.consumer.org.il>

    configure.ac:
        Added a check for the existance of the fribidi include file. No 
check for the library, as we do not statically link with it.

    include/config.h.in:
        Added a couple of defines marking whether the libfribidi headers 
are available during compilation (a run time check is performed as well).

    include/bidi.h: (new file)
        Prototyping the bidi system.

    dlls/gdi/Makefile.in:
        Added "fribidi.c" to the makefile.

    dlls/gdi/fribidi.c: (new file)
        Initial code. Just try to load libfribidi.so and link with the 
relecant functions. Mark a global variable upon success.

    objects/gdiobj.c:
        Added a call to initialize the BiDi system.

Index: configure.ac
===================================================================
RCS file: /home/sun/sources/wine/cvs/wine/configure.ac,v
retrieving revision 1.69
diff -u -r1.69 configure.ac
--- configure.ac	9 Aug 2002 19:49:32 -0000	1.69
+++ configure.ac	14 Aug 2002 18:45:09 -0000
@@ -434,6 +434,18 @@
 fi
 AC_SUBST(FREETYPEINCL)
 
+dnl **** Check for fribidi ****
+# AC_CHECK_LIB(libfribidi,fribidi_log2vis,fribidi_lib=yes,fribidi_lib=no,)
+AC_CHECK_HEADER([fribidi/fribidi.h],fbd_lib=yes,fbd_lib=no)
+if test "$fbd_lib"="yes"
+then
+	AC_DEFINE(HAVE_FRIBIDI,1)
+	AC_DEFINE(HAVE_FRIBIDI_H,1)
+else		
+	AC_DEFINE(HAVE_FRIBIDI,0)
+	AC_DEFINE(HAVE_FRIBIDI_H,0)
+fi
+
 dnl **** Check for parport (currently Linux only) ****
 AC_CACHE_CHECK([for parport header/ppdev.h], ac_cv_c_ppdev,
  AC_TRY_COMPILE(
Index: dlls/gdi/Makefile.in
===================================================================
RCS file: /home/sun/sources/wine/cvs/wine/dlls/gdi/Makefile.in,v
retrieving revision 1.31
diff -u -r1.31 Makefile.in
--- dlls/gdi/Makefile.in	1 Aug 2002 18:36:58 -0000	1.31
+++ dlls/gdi/Makefile.in	14 Aug 2002 18:32:40 -0000
@@ -42,6 +42,7 @@
 	enhmfdrv/mapping.c \
 	enhmfdrv/objects.c \
 	freetype.c \
+	fribidi.c \
 	gdi_main.c \
 	mfdrv/bitblt.c \
 	mfdrv/dc.c \
Index: include/config.h.in
===================================================================
RCS file: /home/sun/sources/wine/cvs/wine/include/config.h.in,v
retrieving revision 1.127
diff -u -r1.127 config.h.in
--- include/config.h.in	9 Aug 2002 19:49:32 -0000	1.127
+++ include/config.h.in	14 Aug 2002 18:48:23 -0000
@@ -113,6 +113,12 @@
 /* Define to 1 if you have the <freetype/tttables.h> header file. */
 #undef HAVE_FREETYPE_TTTABLES_H
 
+/* Define to 1 if fribidi is available during compilation */
+#undef HAVE_FRIBIDI
+
+/* Define to 1 if you have the <fribidi/fribidi.h> header file. */
+#undef HAVE_FRIBIDI_H
+
 /* Define to 1 if you have the `ftruncate' function. */
 #undef HAVE_FTRUNCATE
 
Index: objects/gdiobj.c
===================================================================
RCS file: /home/sun/sources/wine/cvs/wine/objects/gdiobj.c,v
retrieving revision 1.76
diff -u -r1.76 gdiobj.c
--- objects/gdiobj.c	13 Jun 2002 23:59:53 -0000	1.76
+++ objects/gdiobj.c	14 Aug 2002 19:25:39 -0000
@@ -633,6 +633,10 @@
 
     WineEngInit();
 
+#if HAVE_FRIBIDI
+    WineBidiInit();
+#endif
+
     return TRUE;
 }
 
--- /dev/null	2002-07-08 21:54:59.000000000 +0300
+++ dlls/gdi/fribidi.c	2002-08-15 17:33:03.000000000 +0300
@@ -0,0 +1,108 @@
+/*
+ * The main BiDirectional functions, and interface to FriBiDi
+ *
+ * Copyright 2002 Shachar Shemesh.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+
+#include "windef.h"
+#include "winerror.h"
+#include "winreg.h"
+#include "wingdi.h"
+#include "wine/unicode.h"
+#include "wine/port.h"
+#include "wine/debug.h"
+#include "gdi.h"
+#include "font.h"
+
+#include "bidi.h"
+#if HAVE_FRIBIDI_H
+#include <fribidi/fribidi.h>
+#endif /* HAVE_FRIBIDI_H */
+
+#ifndef SONAME_LIBFRIBIDI
+#define SONAME_LIBFRIBIDI "libfribidi.so"
+#endif
+
+WINE_DEFAULT_DEBUG_CHANNEL(text);
+
+/*
+ * A global variable stating whether runtime support for BiDi
+ * is available
+ */
+BOOL bidi_available=FALSE;
+
+static void *fbd_handle = NULL;
+
+#define MAKE_FUNCPTR(f) static typeof(f) * p##f = NULL;
+
+MAKE_FUNCPTR(fribidi_log2vis)
+MAKE_FUNCPTR(fribidi_remove_bidi_marks)
+MAKE_FUNCPTR(fribidi_mirroring_status)
+MAKE_FUNCPTR(fribidi_set_mirroring)
+
+
+/*
+ * Load the fribidi library, and initialize the "bidi_available" var.
+ */
+BOOL WineBidiInit(void)
+{
+	if( bidi_available || fbd_handle!=NULL )
+	{
+		WARN("WineBidiInit called after already being initialized\n");
+
+		return TRUE;
+	}
+
+	fbd_handle = wine_dlopen(SONAME_LIBFRIBIDI, RTLD_NOW, NULL, 0 );
+	if( !fbd_handle ) {
+		TRACE("Wine cannot find the FriBiDi library. Wine will not have Bidirectional\n"
+		      "support. To gain BiDirectional support, install libfribidi (available\n"
+		      "as a package to your system, or from http://fribidi.sourceforge.net)\n"
+		     );
+
+		return FALSE;
+	}
+
+#define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(fbd_handle, #f, NULL, 0)) == NULL){WARN("Can't find symbol %s\n", #f); goto sym_not_found;}
+	
+	LOAD_FUNCPTR(fribidi_log2vis)
+	LOAD_FUNCPTR(fribidi_remove_bidi_marks)
+	LOAD_FUNCPTR(fribidi_mirroring_status)
+	LOAD_FUNCPTR(fribidi_set_mirroring)
+	
+#undef LOAD_FUNCPTR
+
+	bidi_available=TRUE;
+
+	return TRUE;
+
+sym_not_found:
+	WINE_MESSAGE(
+	  "Wine cannot find some of the libfribidi function necessary for proper BiDirectional\n"
+	  "support. Please make sure you are using at least version 0.10.4 of libfribidi. If\n"
+	  "it is not available as a package for your system, you can download it from\n"
+	  "http://fribidi.sf.net/\n";
+		    );
+
+	wine_dlclose(fbd_handle, NULL, 0);
+	fbd_handle=NULL;
+	
+	return FALSE;
+}
+
--- /dev/null	2002-07-08 21:54:59.000000000 +0300
+++ include/bidi.h	2002-08-15 16:59:35.000000000 +0300
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2002 Shachar Shemesh
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#if HAVE_FRIBIDI
+
+/*
+ * A global variable stating whether runtime support for BiDi
+ * is available
+ */
+extern BOOL bidi_available;
+
+/*
+ * Load the fribidi library, and initialize the "bidi_available" var.
+ */
+BOOL WineBidiInit(void);
+
+#endif /* HAVE_FRIBIDI */
+

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux