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

Re: Request for pango-libthai 0.1.6-3 in Etch



On 12/26/06, Theppitak Karoonboonyanan <thep@linux.thai.net> wrote:

Resent, as it has not appeared in archive for 2 days.

Umm.. I just missed the search in mail archive. Sorry for duplicated
messages.

However, let me add some more details with this.

pango-libthai, a package providing third-party module for Thai language
engine in pango, has now been merged upstream, with some changes
according to pango maintainer's comments. It has now been shipped
with upstream pango 1.14.9 (stable) and 1.15.1 (development).
Neither is provided by etch. (Latest = 0.14.8-3).

My proposal in debian-gtk-gnome mailing list [1] is to eventually drop it
in favor of the upstream version.

 [1] http://lists.debian.org/debian-gtk-gnome/2006/12/msg00021.html

However, that would take too much for etch. Therefore, Loic Minier's
suggestion is to back port the fixes from upstream instead.
And that has been done in 0.1.6-3, which I would like to request
to get into etch.

Since the mentioned bugs are discussed via personal mails, they
have not been archived anywhere. The problems are:

- character set conversion, which would fail if strings with
 non-English and non-Thai are passed to the engine.
 So, it has been fixed by using character-wise conversion
 with graceful fallback instead of a single g_convert() call.

- logical attribute overriding, by initialization loop that overwrote
 all default logical attributes well-analyzed by pango default
 engine. This caused information lost for some positions,
 such as word start, word end, etc. at text chunk boundaries.
 So, this has been fixed by mere removal of such re-initialization.

- off-by-one buffer allocation, which could cause problem
 in some extreme cases.

All changes have been tested before accepted upstream in
GNOME Bug #371388. And the back-ported package is
already 16 days old. The change, with config.sub substitution
removed, is small:

diff -Nru /tmp/1RkvHqDL2G/pango-libthai-0.1.6/debian/changelog
/tmp/TKZqZG3rnx/pango-libthai-0.1.6/debian/changelog
--- /tmp/1RkvHqDL2G/pango-libthai-0.1.6/debian/changelog
2006-12-26 22:44:37.000000000 +0700
+++ /tmp/TKZqZG3rnx/pango-libthai-0.1.6/debian/changelog
2006-12-26 22:44:38.000000000 +0700
@@ -1,3 +1,11 @@
+pango-libthai (0.1.6-3) unstable; urgency=low
+
+  * Backport fixes for bugs about logical attributes overriding and character
+    set conversion from upstream CVS, in sync to stock engine shipped with
+    pango 1.14.9.
+
+ -- Theppitak Karoonboonyanan <thep@linux.thai.net>  Sat,  9 Dec 2006
08:53:51 +0700
+
pango-libthai (0.1.6-2) unstable; urgency=low

  * Use new Pango modules handling. Thanks to Loic Minier for the patch.
diff -Nru /tmp/1RkvHqDL2G/pango-libthai-0.1.6/src/libthai-lang.c
/tmp/TKZqZG3rnx/pango-libthai-0.1.6/src/libthai-lang.c
--- /tmp/1RkvHqDL2G/pango-libthai-0.1.6/src/libthai-lang.c
2006-07-03 12:06:11.000000000 +0700
+++ /tmp/TKZqZG3rnx/pango-libthai-0.1.6/src/libthai-lang.c
2006-12-26 22:44:38.000000000 +0700
@@ -24,7 +24,7 @@
#include <glib.h>
#include <pango/pango-engine.h>
#include <pango/pango-break.h>
-#include <thai/thctype.h>
+#include <thai/thwchar.h>
#include <thai/thbrk.h>

/* No extra fields needed */
@@ -46,6 +46,28 @@
  }
};

+static thchar_t *
+utf8_to_tis (const char *text, int len)
+{
+  thchar_t   *tis_text;
+  thchar_t   *tis_p;
+  const char *text_p;
+
+  if (len < 0)
+    len = strlen (text);
+
+  tis_text = g_new (thchar_t, g_utf8_strlen (text, len) + 1);
+  if (!tis_text)
+    return NULL;
+
+  tis_p = tis_text;
+  for (text_p = text; text_p < text + len; text_p = g_utf8_next_char (text_p))
+    *tis_p++ = th_uni2tis (g_utf8_get_char (text_p));
+  *tis_p = '\0';
+
+  return tis_text;
+}
+
static void
libthai_engine_break (PangoEngineLang *engine,
                      const char      *text,
@@ -56,36 +78,16 @@
{
  thchar_t *tis_text;

-  tis_text = (thchar_t *) g_convert (text, len, "TIS-620", "UTF-8",
-                                     NULL, NULL, NULL);
+  tis_text = utf8_to_tis (text, len);
  if (tis_text)
    {
-      int tis_len = strlen ((const char*)tis_text);
-      int *brk_pnts = g_new (int, tis_len);
+      int brk_len = strlen ((const char*)tis_text) + 1;
+      int *brk_pnts = g_new (int, brk_len);
      int brk_n;
      int i;

-      /* set & initialize general attribs */
-      for (i = 0; i < attrs_len; i++)
-        {
-          attrs[i].is_line_break = FALSE;
-          attrs[i].is_mandatory_break = FALSE;
-          attrs[i].is_cursor_position = th_iscombchar (tis_text[i]) ?
FALSE : TRUE;
-          attrs[i].is_char_break = attrs[i].is_cursor_position;
-          attrs[i].is_white = isspace (tis_text[i]) ? TRUE : FALSE;
-
-          attrs[i].is_word_start = FALSE;
-          attrs[i].is_word_end = FALSE;
-
-          attrs[i].is_sentence_boundary = FALSE;
-          attrs[i].is_sentence_start = FALSE;
-          attrs[i].is_sentence_end = FALSE;
-
-          attrs[i].backspace_deletes_character = attrs[i].is_cursor_position;
-        }
-
      /* find line break positions */
-      brk_n = th_brk (tis_text, brk_pnts, tis_len);
+      brk_n = th_brk (tis_text, brk_pnts, brk_len);
      for (i = 0; i < brk_n; i++)
        {
          attrs[brk_pnts[i]].is_line_break = TRUE;

So, could you please unblock the package?

Thanks,
--
Theppitak Karoonboonyanan
http://linux.thai.net/~thep/



Reply to: