[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fwd: Re: [Issue N28387] QTextEdit wraps at the middle of arabic words with harakat
- To: developer at arabeyes dot org
- Subject: Fwd: Re: [Issue N28387] QTextEdit wraps at the middle of arabic words with harakat
- From: Mohammed Yousif <mhdyousif at gmx dot net>
- Date: Tue, 12 Aug 2003 04:17:40 +0300
- User-agent: KMail/1.5.1
---------- Forwarded Message ----------
Subject: Re: [Issue N28387] QTextEdit wraps at the middle of arabic words with
harakat
Date: Monday 11 August 2003 17:36
From: qt-bugs at trolltech dot com
To: Mohammed Yousif <mhdyousif at gmx dot net>
Cc: qt-bugs at trolltech dot com
Hi,
thanks a lot for your report. I have fixed this now for the upcoming Qt
3.2.1 release. In case you need a fix now, I attached a diff against
the 3.2.0 release you can apply locally to get proper line breaking for
arabic.
Best regards,
Lars
On Thursday, 07. Aug 2003 01:30 Mohammed Yousif wrote:
> Hi,
> Sorry for disturbing but whenever I use arabic text with harakat
> on a QTextBrowser or a QTextEdit with WordWrapping enabled
> with policy AtWordBoundary or AtWordOrDocumentBoundary,
> it wraps at the middle of words rather than at a breakable char.
> But for arabic text without harakat, it wraps nicely.
> This is a screenshot of the problem:
> http://mhdyousif.hypermart.net/quran/qtquran-0.09.jpg
> As you see, it is serious :-)
--
Lars Knoll, Senior Software Engineer
Trolltech AS, Waldemar Thranes gt. 98, N-0175 Oslo, Norway
-------------------------------------------------------
--
Mohammed Yousif
We _will_ restore OUR Jerusalem.
--- src/kernel/qtextengine.cpp 2003-08-11 14:14:18 -0000
+++ src/kernel/qtextengine.cpp 2003-08-11 14:14:18 -0000
@@ -706,32 +706,43 @@
//
// -----------------------------------------------------------------------------------------------------
+/* The Unicode algorithm does in our opinion allow line breaks at some
+ places they shouldn't be allowed. The following changes were thus
+ made in comparison to the Unicode reference:
+
+ CL->AL from Dbk to Ibk
+ Al->OP from Dbk to Ibk
+ EX->AL from Dbk to Ibk
+ IS->AL from Dbk to Ibk
+ AL->HY from Dbk to Ibk
+*/
+
enum break_action {
Dbk, // Direct break
Ibk, // Indirect break; only allowed if space between the two chars
Pbk // Prohibited break; no break allowed even if space between chars
};
-// The folowing line break classes are not treated by the table:
+// The following line break classes are not treated by the table:
// SA, BK, CR, LF, SG, CB, SP
static const Q_UINT8 breakTable[QUnicodeTables::LineBreak_CM+1][QUnicodeTables::LineBreak_CM+1] =
{
// OP, CL, QU, GL, NS, EX, SY, IS, PR, PO, NU, AL, ID, IN, HY, BA, BB, B2, ZW, CM
{ Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk }, // OP
- { Dbk, Pbk, Ibk, Pbk, Pbk, Pbk, Pbk, Pbk, Dbk, Ibk, Dbk, Dbk, Dbk, Dbk, Ibk, Ibk, Pbk, Pbk, Pbk, Pbk }, // CL
+ { Dbk, Pbk, Ibk, Pbk, Pbk, Pbk, Pbk, Pbk, Dbk, Ibk, Dbk, Ibk, Dbk, Dbk, Ibk, Ibk, Pbk, Pbk, Pbk, Pbk }, // CL
{ Pbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Pbk, Pbk }, // QU
{ Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Pbk, Pbk }, // GL
{ Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // NS
- { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // EX
+ { Dbk, Pbk, Ib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ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // ID
{ Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Dbk, Dbk, Dbk, Ibk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // IN
- { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Ibk, Dbk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // HY
+ { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // HY
{ Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // BA
{ Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Pbk, Ibk }, // BB
{ Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Ibk, Ibk, Dbk, Pbk, Pbk, Ibk }, // B2
@@ -756,7 +767,7 @@
for (int i = 1; i < len; ++i) {
int ncls = lineBreakClass(uc[i]);
- if (ncls == QUnicodeTables::LineBreak_SP) {
+ if (ncls == QUnicodeTables::LineBreak_SP || ncls == QUnicodeTables::LineBreak_CM) {
charAttributes[i].softBreak = FALSE;
continue;
}