You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
138 lines
4.3 KiB
138 lines
4.3 KiB
From 800fc7caa9728cebafee86d841ac23b6ffaa896b Mon Sep 17 00:00:00 2001
|
|
From: Brian Bidulock <bidulock@openss7.org>
|
|
Date: Wed, 5 Nov 2014 03:25:44 -0700
|
|
Subject: [PATCH] fribidi support (gentoo icewm-1.3.9-fribidi.patch)
|
|
|
|
Also fixes several problems with the gentoo patch:
|
|
|
|
1) the patch modifies CORE_CFLAGS and CORE_LIBS before they
|
|
are first defined, confusing later PKG_CONFIG([CORE], ...)
|
|
so I moved it later in configure.ac
|
|
|
|
2) the patch uses the deprecated fribidi_log2vis, so I modified
|
|
src/yfontxft.cc to disabled deprecated symbols (because I
|
|
always test build with -Werror).
|
|
|
|
3) the patch ignores the return value of fribidi_log2vis()
|
|
causing another warning which -Werror turns into an error.
|
|
Changed to "if (fribidi_log2vis(...)) ;" to disable that.
|
|
|
|
4) fixed the configure.ac macro check for fribidi to only warn
|
|
when the library is not present but the feature has not
|
|
been disabled
|
|
|
|
5) add fribidi to configure.ac features list shown at end of
|
|
./configure run (added xrandr and xinerama too...)
|
|
---
|
|
configure.ac | 17 +++++++++++++++--
|
|
src/yfontxft.cc | 47 +++++++++++++++++++++++++++++++++++++++++++++++
|
|
2 files changed, 62 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index dce4f1e..63d362f 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -158,7 +158,8 @@ if test x$enable_xrandr != xno; then
|
|
PKG_CHECK_MODULES([XRANDR],[xrandr],[
|
|
CORE_CFLAGS="$XRANDR_CFLAGS $CORE_CFLAGS"
|
|
CORE_LIBS="$XRANDR_LIBS $CORE_LIBS"
|
|
- AC_DEFINE([CONFIG_XRANDR],[1],[Define to enable XRANDR extension.])],
|
|
+ AC_DEFINE([CONFIG_XRANDR],[1],[Define to enable XRANDR extension.])
|
|
+ features="$features xrandr"],
|
|
[AC_MSG_WARN([XRANDR not supported.])])
|
|
fi
|
|
|
|
@@ -270,10 +271,22 @@ if test x$enable_xinerama != xno ; then
|
|
PKG_CHECK_MODULES([XINERAMA],[xinerama],[
|
|
CORE_CFLAGS="$XINERAMA_CFLAGS $CORE_CFLAGS"
|
|
CORE_LIBS="$XINERAMA_LIBS $CORE_LIBS"
|
|
- AC_DEFINE([XINERAMA],[1],[Define to enable Xinerama support.])],
|
|
+ AC_DEFINE([XINERAMA],[1],[Define to enable Xinerama support.])
|
|
+ features="$features xinerama"],
|
|
[AC_MSG_WARN([XINERAMA is not supported.])])
|
|
fi
|
|
|
|
+AC_ARG_ENABLE([fribidi],
|
|
+ AC_HELP_STRING([--disable-fribidi],[Disable right to left support.]))
|
|
+if test "$enable_fribidi" != "no" && test "$enable_i18n" != "no"; then
|
|
+ PKG_CHECK_MODULES([FRIBIDI], [fribidi],[
|
|
+ CORE_CFLAGS="$FRIBIDI_CFLAGS $CORE_CFLAGS"
|
|
+ CORE_LIBS="$FRIBIDI_LIBS $CORE_LIBS"
|
|
+ AC_DEFINE([CONFIG_FRIBIDI],[1],[Define to enable fribidi support.])
|
|
+ features="$features fribidi"],
|
|
+ [AC_MSG_WARN([FRIBIDI is not supported.])])
|
|
+fi
|
|
+
|
|
AC_ARG_ENABLE([prefs],
|
|
AC_HELP_STRING([--disable-prefs],[Disable configurable preferences.]))
|
|
if test x$enable_prefs = xno ; then
|
|
diff --git a/src/yfontxft.cc b/src/yfontxft.cc
|
|
index c200dc6..01b52f9 100644
|
|
--- a/src/yfontxft.cc
|
|
+++ b/src/yfontxft.cc
|
|
@@ -6,6 +6,18 @@
|
|
#include "ypaint.h"
|
|
#include "yxapp.h"
|
|
#include "intl.h"
|
|
+#include <stdio.h>
|
|
+
|
|
+#ifdef CONFIG_FRIBIDI
|
|
+ // remove deprecated warnings for now...
|
|
+ #include <fribidi/fribidi-config.h>
|
|
+ #if FRIBIDI_USE_GLIB+0
|
|
+ #include <glib.h>
|
|
+ #undef G_GNUC_DEPRECATED
|
|
+ #define G_GNUC_DEPRECATED
|
|
+ #endif
|
|
+ #include <fribidi/fribidi.h>
|
|
+#endif
|
|
|
|
/******************************************************************************/
|
|
|
|
@@ -69,10 +81,45 @@ class XftGraphics {
|
|
char_t * str, size_t len)
|
|
{
|
|
XftColor *c = *g.color();
|
|
+
|
|
+#ifdef CONFIG_FRIBIDI
|
|
+
|
|
+#define STATIS_STRING_SIZE 256
|
|
+
|
|
+ // Based around upstream (1.3.2) patch with some optimization
|
|
+ // on my end. (reduce unnecessary memory allocation)
|
|
+ // - Gilboa
|
|
+
|
|
+ char_t static_str[STATIS_STRING_SIZE];
|
|
+ char_t *vis_str = static_str;
|
|
+
|
|
+ if (len >= STATIS_STRING_SIZE)
|
|
+ {
|
|
+ vis_str = new char_t[len+1];
|
|
+ if (!vis_str)
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ FriBidiCharType pbase_dir = FRIBIDI_TYPE_N;
|
|
+ if (fribidi_log2vis(str, len, &pbase_dir, //input
|
|
+ vis_str, // output
|
|
+ NULL, NULL, NULL // "statistics" that we don't need
|
|
+ )) ;
|
|
+ str = vis_str;
|
|
+#endif
|
|
+
|
|
XftDrawString(g.handleXft(), c, font,
|
|
x - g.xorigin(),
|
|
y - g.yorigin(),
|
|
str, len);
|
|
+
|
|
+#ifdef CONFIG_FRIBIDI
|
|
+
|
|
+ if (vis_str != static_str)
|
|
+ delete[] str;
|
|
+
|
|
+#endif
|
|
+
|
|
}
|
|
|
|
static void textExtents(XftFont * font, char_t * str, size_t len,
|