# HG changeset patch # User Stu Tomlinson # Date 1176808490 0 # Node ID 12e2ee612d5f619ebc1605a9d9cade66f1332952 # Parent 66706d858e9a9075ba44bcffbd00e40d817d897d Fix for using Pango < 1.4, will not have complete RTL support with older Pango though. diff -r 66706d858e9a -r 12e2ee612d5f config.h.mingw --- a/config.h.mingw Tue Apr 17 10:15:54 2007 +0000 +++ b/config.h.mingw Tue Apr 17 11:14:50 2007 +0000 @@ -279,6 +279,9 @@ /* Define to 1 if you have the header file. */ /* #undef HAVE_NSS_H */ +/* Define if we have Pango 1.4 or newer. */ +#define HAVE_PANGO14 1 + /* Define to 1 if you have the header file. */ /* #define HAVE_PATHS_H 1 */ diff -r 66706d858e9a -r 12e2ee612d5f configure.ac --- a/configure.ac Tue Apr 17 10:15:54 2007 +0000 +++ b/configure.ac Tue Apr 17 11:14:50 2007 +0000 @@ -241,6 +241,10 @@ AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) + dnl We only really need Pango >= 1.4 for decent RTL support + PKG_CHECK_MODULES(pango, [pango >= 1.4.0], + AC_DEFINE(HAVE_PANGO14, 1, [Define if we have Pango 1.4 or newer.]),) + dnl ####################################################################### dnl # Check for XScreenSaver dnl ####################################################################### diff -r 66706d858e9a -r 12e2ee612d5f pidgin/gtkconv.c --- a/pidgin/gtkconv.c Tue Apr 17 10:15:54 2007 +0000 +++ b/pidgin/gtkconv.c Tue Apr 17 11:14:50 2007 +0000 @@ -4900,33 +4900,35 @@ static void str_embed_direction_chars(char **str) { +#ifdef HAVE_PANGO14 char pre_str[4]; char post_str[10]; - char *ret = g_malloc(strlen(*str)+13); + char *ret; if (PANGO_DIRECTION_RTL == pango_find_base_dir(*str, -1)) { - g_sprintf(pre_str, "%c%c%c", + sprintf(pre_str, "%c%c%c", 0xE2, 0x80, 0xAB); /* RLE */ - g_sprintf(post_str, "%c%c%c%c%c%c%c%c%c", + sprintf(post_str, "%c%c%c%c%c%c%c%c%c", 0xE2, 0x80, 0xAC, /* PDF */ 0xE2, 0x80, 0x8E, /* LRM */ 0xE2, 0x80, 0xAC); /* PDF */ } else { - g_sprintf(pre_str, "%c%c%c", + sprintf(pre_str, "%c%c%c", 0xE2, 0x80, 0xAA); /* LRE */ - g_sprintf(post_str, "%c%c%c%c%c%c%c%c%c", + sprintf(post_str, "%c%c%c%c%c%c%c%c%c", 0xE2, 0x80, 0xAC, /* PDF */ 0xE2, 0x80, 0x8F, /* RLM */ 0xE2, 0x80, 0xAC); /* PDF */ } - g_sprintf(ret, "%s%s%s", pre_str, *str, post_str); + ret = g_strconcat(pre_str, *str, post_str, NULL); g_free(*str); *str = ret; +#endif } /* Returns true if the given HTML contains RTL text */ diff -r 66706d858e9a -r 12e2ee612d5f pidgin/gtkimhtml.c --- a/pidgin/gtkimhtml.c Tue Apr 17 10:15:54 2007 +0000 +++ b/pidgin/gtkimhtml.c Tue Apr 17 11:14:50 2007 +0000 @@ -4573,12 +4573,14 @@ /* Bi-directional text support */ /* Get to the first non-neutral character */ +#ifdef HAVE_PANGO14 while ((PANGO_DIRECTION_NEUTRAL == pango_unichar_direction(gtk_text_iter_get_char(&non_neutral_iter))) && gtk_text_iter_forward_char(&non_neutral_iter)); if (PANGO_DIRECTION_RTL == pango_unichar_direction(gtk_text_iter_get_char(&non_neutral_iter))) { is_rtl_message = TRUE; g_string_append(str, ""); } +#endif /* First add the tags that are already in progress (we don't care about non-printing tags)*/ tags = gtk_text_iter_get_tags(start);