[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: KDE3 thai word break: KLibLoader --> QLibrary
From: "Pattara Kiatisevi \(list\)" <pattara-list () mm ! co ! th>
Date: 2007-09-29 5:43:07
Message-ID: 46FDE5EB.3080706 () mm ! co ! th
[Download RAW message or body]
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
}
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic