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

Bug#444284: [Fwd: KDE3 thai word break: KLibLoader --> QLibrary]



Dear Sune,

Another solution is to fix the kdelibs to use QLibrary to load libthai instead of KLibLoder, as QLibrary won't need libthai.la. The patch is attached:

I did send this patch to the kde-devel list since September 2007. And the answers were:

"This is a Debian specific packaging bug. Many distributions are still shipping libtool archive files. Please contact the packagers of KDE for Debian via http://bugs.debian.org/. "
( http://lists.kde.org/?l=kde-devel&m=119104527320060&w=2 )

"it's a distro bug if they make KDE 3 stop working -- it's been working for years like that.:"
( http://lists.kde.org/?l=kde-devel&m=119105494901329&w=2 )

In a sense they are right. It's been working for years like that. So maybe it should be fixed at the distro level.

What do you think?

Cheers,
Pattara

-------- Original Message --------
Subject: 	KDE3 thai word break: KLibLoader --> QLibrary
Date: 	Sat, 29 Sep 2007 12:43:07 +0700
From: 	Pattara Kiatisevi (list) <pattara-list@mm.co.th>
Reply-To: 	kde-devel@kde.org
To: 	kde-devel@kde.org



Hi kde-devel,

Currently rendering Thai text in KDE3's KHTML on Linux platform makes use of libthai's th_brk() to identify suitable word break positions (as Thai sentences have no space between words). If libthai is not linked to kdelibs (done so by configure --enable-libthai=yes), kdelibs will try to dynamically load libthai.so using KLibLoader (see kdelibs/khtml/rendering/break_lines.cpp).

KLibLoader requires libthai.la, which recently has been removed from Linux distro's libthai-dev packages (e.g., in Debian), resulting in it couldn't load libthai at all, and all Thai web pages are incorrectly rendered, i.e., word breaking at wrong positions.

One solution suggested by Theppitak as discussed in http://groups.google.com/group/thai-linux-foss-devel/ is to switch to use QLibrary instead, which won't need libthai.la. It will look for libthai.so directly (would be even better though if it will look for libthai.so.0 directly so that libthai-dev package needs not be installed).

The attached patch is tested against kdelibs-3.5.6 on Ubuntu 7.04. Or you can grab it here:
http://www.suriyan.in.th/patches/kdelibs-3.5.6-thai-break-qlibrary-instead-off-klibloader.patch

Are we gonna have another release of KDE3? Is it possible to include this patch?

Cheers,
Pattara




--- kdelibs-3.5.6.org/khtml/rendering/break_lines.cpp	2005-09-10 15:27:15.000000000 +0700
+++ kdelibs-3.5.6/khtml/rendering/break_lines.cpp	2007-09-28 00:21:20.000000000 +0700
@@ -3,6 +3,7 @@
 #include "qcstring.h"
 #include <qtextcodec.h>
 #include <qcleanuphandler.h>
+#include <qlibrary.h>
 #include <config.h>
 
 
@@ -31,19 +32,19 @@
             numwbrpos = 0;
             numisbreakable = 0x400;
             isbreakable = (int *) malloc(numisbreakable*sizeof(int));
-	    library = 0;
+	    //library = 0;
         }
         ~ThaiCache() {
             free(wbrpos);
             free(isbreakable);
-            if (library) library->unload();
+            //if (library) library->unload();
         }
         const QChar *string;
         int *wbrpos;
         int *isbreakable;
         int allocated;
         int numwbrpos,numisbreakable;
-        KLibrary *library;
+        //KLibrary *library;
     };
     static ThaiCache *cache = 0;
 
@@ -63,9 +64,12 @@
 
 #ifndef HAVE_LIBTHAI
 	
+/*
 	KLibrary *lib = 0;
+*/
 
         /* load libthai dynamically */
+/*
 	if (( !th_brk ) && thaiCodec  ) {
 	    printf("Try to load libthai dynamically...\n");
             KLibLoader *loader = KLibLoader::self();
@@ -80,6 +84,19 @@
                     lib->unload();
             }
         }
+*/
+
+	// KLibLoader requires libthai.la which is usually in libthai-dev package or doesn't exist at all
+	// QLibrary::resolve will look for libthai.so.0 directly
+	/* load libthai dynamically */
+	if (!th_brk && thaiCodec) {
+	    printf("Try to load libthai dynamically...\n");
+	    th_brk = (th_brk_def)QLibrary::resolve("thai", "th_brk");
+	    if (!th_brk) {
+		printf("Error, can't load libthai...\n");
+	        thaiCodec = 0;
+            }
+	}
 
         if (!th_brk ) {
             return true;
@@ -89,7 +106,7 @@
 	if (!cache ) {
             cache = new ThaiCache;
 #ifndef HAVE_LIBTHAI
-            cache->library = lib;
+            //cache->library = lib;
 #endif
 	}
 


Reply to: