From kde-devel Sat Sep 29 05:43:07 2007 From: "Pattara Kiatisevi \(list\)" Date: Sat, 29 Sep 2007 05:43:07 +0000 To: kde-devel Subject: KDE3 thai word break: KLibLoader --> QLibrary Message-Id: <46FDE5EB.3080706 () mm ! co ! th> X-MARC-Message: https://marc.info/?l=kde-devel&m=119104469320430 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--------------030703090201070209050009" This is a multi-part message in MIME format. --------------030703090201070209050009 Content-Type: text/plain; charset=TIS-620; format=flowed Content-Transfer-Encoding: 7bit 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 --------------030703090201070209050009 Content-Type: text/plain; name*0="kdelibs-3_5_6-thai-break-qlibrary-instead-off-klibloader.patch.t"; name*1="xt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename*0="kdelibs-3_5_6-thai-break-qlibrary-instead-off-klibloader.pat"; filename*1="ch.txt" --- 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 #include +#include #include @@ -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 } --------------030703090201070209050009 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --------------030703090201070209050009--