rev 3851 - in trunk/packages/qt-x11-free/debian: . patches

Christopher Martin chrsmrtn at costa.debian.org
Sat Jun 3 19:52:37 UTC 2006


Author: chrsmrtn
Date: 2006-06-03 19:52:36 +0000 (Sat, 03 Jun 2006)
New Revision: 3851

Added:
   trunk/packages/qt-x11-free/debian/patches/30_qtc_arabic_font_fixes.dpatch
Modified:
   trunk/packages/qt-x11-free/debian/changelog
   trunk/packages/qt-x11-free/debian/patches/00list
Log:
New qt-copy patch; I'll test.


Modified: trunk/packages/qt-x11-free/debian/changelog
===================================================================
--- trunk/packages/qt-x11-free/debian/changelog	2006-06-03 18:59:50 UTC (rev 3850)
+++ trunk/packages/qt-x11-free/debian/changelog	2006-06-03 19:52:36 UTC (rev 3851)
@@ -1,3 +1,12 @@
+qt-x11-free (3:3.3.6-3) UNRELEASED; urgency=low
+
+  +++ Changes by Christopher Martin
+
+  * Add a patch (accepted upstream) that fixes the use of some fonts
+    with broken open type tables.
+
+ -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Sat,  3 Jun 2006 14:06:24 -0400
+
 qt-x11-free (3:3.3.6-2) unstable; urgency=low
 
   +++ Changes by Pierre Habouzit:

Modified: trunk/packages/qt-x11-free/debian/patches/00list
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/00list	2006-06-03 18:59:50 UTC (rev 3850)
+++ trunk/packages/qt-x11-free/debian/patches/00list	2006-06-03 19:52:36 UTC (rev 3851)
@@ -21,6 +21,7 @@
 26_qtc_qpixmap_constants
 27_qtc_qscrollview-windowactivate-fix
 29_qtc_fix_rotated_randr
+30_qtc_arabic_font_fixes
 31_gcc4_buildkey
 32_gtkstyle
 34_qtc_dnd_optimization

Added: trunk/packages/qt-x11-free/debian/patches/30_qtc_arabic_font_fixes.dpatch
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/30_qtc_arabic_font_fixes.dpatch	2006-06-03 18:59:50 UTC (rev 3850)
+++ trunk/packages/qt-x11-free/debian/patches/30_qtc_arabic_font_fixes.dpatch	2006-06-03 19:52:36 UTC (rev 3851)
@@ -0,0 +1,352 @@
+#! /bin/sh -e
+# Qt-Copy patch #70
+
+if [ $# -lt 1 ]; then
+    echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+    exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
+
+case "$1" in
+    -patch) patch -p1 ${patch_opts} < $0;;
+    -unpatch) patch -R -p1 ${patch_opts} < $0;;
+    *)
+        echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+        exit 1;;
+esac
+
+exit 0
+
+ at DPATCH@
+--- qt.orig/src/kernel/qscriptengine.cpp
++++ qt.patched/src/kernel/qscriptengine.cpp
+@@ -289,7 +289,7 @@
+     unsigned short *logClusters = item->log_clusters;
+ 
+     int i;
+-    for (i = 0; i < length; ++i) 
++    for (i = 0; i < length; ++i)
+         logClusters[i] = i;
+ 
+     // first char in a run is never (treated as) a mark
+@@ -304,7 +304,7 @@
+     } else {
+         item->attributes[0].zeroWidth = FALSE;
+     }
+-    
++
+     int lastCat = ::category(uc[0]);
+     for (i = 1; i < length; ++i) {
+         int cat = ::category(uc[i]);
+@@ -381,7 +381,7 @@
+ 
+ static bool basic_shape(QShaperItem *item)
+ {
+-    if (item->font->stringToCMap(item->string->unicode()+item->from, item->length, item->glyphs, item->advances, 
++    if (item->font->stringToCMap(item->string->unicode()+item->from, item->length, item->glyphs, item->advances,
+                                  &item->num_glyphs, item->flags & QTextEngine::RightToLeft) != QFontEngine::NoError)
+         return FALSE;
+ 
+@@ -421,7 +421,7 @@
+ 
+     if (openType && openType->supportsScript(item->script)) {
+         openType->selectScript(item->script, hebrew_features);
+-        
++
+         if (item->font->stringToCMap(item->string->unicode()+item->from, item->length, item->glyphs, item->advances,
+                                      &item->num_glyphs, item->flags & QTextEngine::RightToLeft) != QFontEngine::NoError)
+             return FALSE;
+@@ -437,7 +437,7 @@
+         ShinDot = 0x5c1,
+         SinDot = 0x5c2,
+         Patah = 0x5b7,
+-        Qamats = 0x5b8, 
++        Qamats = 0x5b8,
+         Holam = 0x5b9,
+         Rafe = 0x5bf
+     };
+@@ -446,7 +446,7 @@
+ 
+     const QChar *uc = item->string->unicode() + item->from;
+     unsigned short *logClusters = item->log_clusters;
+-    
++
+     *shapedChars = *uc;
+     logClusters[0] = 0;
+     int slen = 1;
+@@ -460,9 +460,9 @@
+             if (base >= 0x5d0
+                 && base <= 0x5ea
+                 && base != 0x5d7
+-                && base != 0x5dd 
+-                && base != 0x5df 
+-                && base != 0x5e2 
++                && base != 0x5dd
++                && base != 0x5df
++                && base != 0x5e2
+                 && base != 0x5e5) {
+                 shaped = base - 0x5d0 + 0xfb30;
+             } else if (base == 0xfb2a || base == 0xfb2b /* Shin with Shin or Sin dot */) {
+@@ -532,12 +532,12 @@
+         }
+         logClusters[i] = cluster_start;
+     }
+-    
++
+     if (item->font->stringToCMap(shapedChars, slen, item->glyphs, item->advances,
+                                  &item->num_glyphs, item->flags & QTextEngine::RightToLeft) != QFontEngine::NoError)
+         return FALSE;
+     for (i = 0; i < item->num_glyphs; ++i) {
+-        if (item->attributes[i].mark) 
++        if (item->attributes[i].mark)
+             item->advances[i] = 0;
+     }
+     qt_heuristicPosition(item);
+@@ -1461,12 +1461,12 @@
+ 
+ enum {
+     InitProperty = 0x2,
+-    IsolProperty = 0x4, 
++    IsolProperty = 0x4,
+     FinaProperty = 0x8,
+     MediProperty = 0x10,
+-    RligProperty = 0x20, 
+-    CaltProperty = 0x40, 
+-    LigaProperty = 0x80, 
++    RligProperty = 0x20,
++    CaltProperty = 0x40,
++    LigaProperty = 0x80,
+     DligProperty = 0x100,
+     CswhProperty = 0x200,
+     MsetProperty = 0x400
+@@ -1477,14 +1477,14 @@
+     { FT_MAKE_TAG('i', 's', 'o', 'l'), IsolProperty },
+     { FT_MAKE_TAG('f', 'i', 'n', 'a'), FinaProperty },
+     { FT_MAKE_TAG('m', 'e', 'd', 'i'), MediProperty },
+-    { FT_MAKE_TAG('i', 'n', 'i', 't'), InitProperty }, 
+-    { FT_MAKE_TAG('r', 'l', 'i', 'g'), RligProperty }, 
+-    { FT_MAKE_TAG('c', 'a', 'l', 't'), CaltProperty }, 
+-    { FT_MAKE_TAG('l', 'i', 'g', 'a'), LigaProperty }, 
+-    { FT_MAKE_TAG('d', 'l', 'i', 'g'), DligProperty }, 
++    { FT_MAKE_TAG('i', 'n', 'i', 't'), InitProperty },
++    { FT_MAKE_TAG('r', 'l', 'i', 'g'), RligProperty },
++    { FT_MAKE_TAG('c', 'a', 'l', 't'), CaltProperty },
++    { FT_MAKE_TAG('l', 'i', 'g', 'a'), LigaProperty },
++    { FT_MAKE_TAG('d', 'l', 'i', 'g'), DligProperty },
+     { FT_MAKE_TAG('c', 's', 'w', 'h'), CswhProperty },
+     // mset is used in old Win95 fonts that don't have a 'mark' positioning table.
+-    { FT_MAKE_TAG('m', 's', 'e', 't'), MsetProperty }, 
++    { FT_MAKE_TAG('m', 's', 'e', 't'), MsetProperty },
+     {0, 0}
+ };
+ 
+@@ -1496,16 +1496,18 @@
+     { FT_MAKE_TAG('f', 'i', 'n', '3'), FinaProperty },
+     { FT_MAKE_TAG('m', 'e', 'd', 'i'), MediProperty },
+     { FT_MAKE_TAG('m', 'e', 'd', '2'), MediProperty },
+-    { FT_MAKE_TAG('i', 'n', 'i', 't'), InitProperty }, 
+-    { FT_MAKE_TAG('r', 'l', 'i', 'g'), RligProperty }, 
+-    { FT_MAKE_TAG('c', 'a', 'l', 't'), CaltProperty }, 
+-    { FT_MAKE_TAG('l', 'i', 'g', 'a'), LigaProperty }, 
+-    { FT_MAKE_TAG('d', 'l', 'i', 'g'), DligProperty }, 
++    { FT_MAKE_TAG('i', 'n', 'i', 't'), InitProperty },
++    { FT_MAKE_TAG('r', 'l', 'i', 'g'), RligProperty },
++    { FT_MAKE_TAG('c', 'a', 'l', 't'), CaltProperty },
++    { FT_MAKE_TAG('l', 'i', 'g', 'a'), LigaProperty },
++    { FT_MAKE_TAG('d', 'l', 'i', 'g'), DligProperty },
+     {0, 0}
+ };
+ 
+-static bool arabicSyriacOpenTypeShape(QOpenType *openType, QShaperItem *item)
++static bool arabicSyriacOpenTypeShape(QOpenType *openType, QShaperItem *item, bool *ot_ok)
+ {
++    *ot_ok = true;
++
+     openType->selectScript(item->script, item->script == QFont::Arabic ? arabic_features : syriac_features);
+     int nglyphs = item->num_glyphs;
+     if (item->font->stringToCMap(item->string->unicode()+item->from, item->length, item->glyphs, item->advances,
+@@ -1562,7 +1564,10 @@
+             apply[i] |= IsolProperty|MediProperty|FinaProperty;
+     }
+ 
+-    openType->shape(item, apply.data());
++    if (!openType->shape(item, apply.data())) {
++        *ot_ok = false;
++        return false;
++    }
+     item->num_glyphs = nglyphs;
+     return openType->positionAndAdd(item);
+ }
+@@ -1577,8 +1582,14 @@
+ #if defined(Q_WS_X11) && !defined(QT_NO_XFTFREETYPE)
+     QOpenType *openType = item->font->openType();
+ 
+-    if (openType && openType->supportsScript(QFont::Arabic))
+-        return arabicSyriacOpenTypeShape(openType, item);
++    if (openType && openType->supportsScript(QFont::Arabic)) {
++        bool ot_ok;
++        if (arabicSyriacOpenTypeShape(openType, item, &ot_ok))
++            return true;
++        if (ot_ok)
++            return false;
++        // fall through to the non OT code
++    }
+ #endif
+ 
+     QVarLengthArray<ushort> shapedChars(item->length);
+--- qt.orig/src/kernel/qfontengine_p.h
++++ qt.patched/src/kernel/qfontengine_p.h
+@@ -490,8 +490,8 @@
+         return supported_scripts[script];
+     }
+     void selectScript(unsigned int script, const Features *features = 0);
+-    
+-    void shape(QShaperItem *item, const unsigned int *properties = 0);
++
++    bool shape(QShaperItem *item, const unsigned int *properties = 0);
+     bool positionAndAdd(QShaperItem *item, bool doLogClusters = TRUE);
+ 
+     OTL_GlyphItem glyphs() const { return otl_buffer->in_string; }
+@@ -499,7 +499,7 @@
+     void setProperty(int index, uint property) { otl_buffer->in_string[index].properties = property; }
+ 
+ 
+-private: 
++private:
+     bool checkScript(unsigned int script);
+     QFontEngine *fontEngine;
+     FT_Face face;
+--- qt.orig/src/kernel/qfontengine_x11.cpp
++++ qt.patched/src/kernel/qfontengine_x11.cpp
+@@ -154,7 +154,7 @@
+         return;
+ 
+     w += h; // add some pixels to width because of italic correction
+-    QBitmap bm( w, h, TRUE );     // create bitmap 
++    QBitmap bm( w, h, TRUE );     // create bitmap
+     QPainter paint;
+     paint.begin( &bm );             // draw text in bitmap
+     fe->draw( &paint, 0, si->ascent, engine, si, textFlags );
+@@ -2396,7 +2396,7 @@
+         qDebug("error loading gpos table: %d", error);
+ #endif
+     }
+-    
++
+     for (uint i = 0; i < QFont::NScripts; ++i)
+         supported_scripts[i] = checkScript(i);
+ }
+@@ -2427,7 +2427,7 @@
+     if (requirements & RequiresGsub) {
+         if (!gsub)
+             return FALSE;
+-        
++
+         FT_UShort script_index;
+         FT_Error error = TT_GSUB_Select_Script(gsub, tag, &script_index);
+         if (error) {
+@@ -2437,11 +2437,11 @@
+             return FALSE;
+         }
+     }
+-    
++
+     if (requirements & RequiresGpos) {
+         if (!gpos)
+             return FALSE;
+-        
++
+         FT_UShort script_index;
+         FT_Error error = TT_GPOS_Select_Script(gpos, script, &script_index);
+         if (error) {
+@@ -2460,7 +2460,7 @@
+ {
+     if (current_script == script)
+         return;
+-    
++
+     assert(script < QFont::NScripts);
+     // find script in our list of supported scripts.
+     uint tag = ot_scripts[script].tag;
+@@ -2497,7 +2497,7 @@
+             }
+         }
+     }
+-    
++
+     if (gpos) {
+         TT_GPOS_Clear_Features(gpos);
+         FT_UShort script_index;
+@@ -2544,7 +2544,7 @@
+ 
+ extern void qt_heuristicPosition(QShaperItem *item);
+ 
+-void QOpenType::shape(QShaperItem *item, const unsigned int *properties)
++bool QOpenType::shape(QShaperItem *item, const unsigned int *properties)
+ {
+     length = item->num_glyphs;
+ 
+@@ -2571,8 +2571,11 @@
+ 
+     loadFlags = FT_LOAD_DEFAULT;
+ 
+-    if (gsub)
+-        TT_GSUB_Apply_String(gsub, otl_buffer);
++    if (gsub) {
++        uint error = TT_GSUB_Apply_String(gsub, otl_buffer);
++        if (error && error != TTO_Err_Not_Covered)
++            return false;
++    }
+ 
+ #ifdef OT_DEBUG
+ //     qDebug("log clusters before shaping:");
+@@ -2584,6 +2587,8 @@
+     qDebug("-----------------------------------------");
+ //     dump_string(otl_buffer);
+ #endif
++
++    return true;
+ }
+ 
+ bool QOpenType::positionAndAdd(QShaperItem *item, bool doLogClusters)
+@@ -2600,7 +2605,7 @@
+         unlockFTFace(static_cast<QFontEngineXft *>(fontEngine)->font());
+ #endif
+     }
+-    
++
+     // make sure we have enough space to write everything back
+     if (item->num_glyphs < (int)otl_buffer->in_length) {
+         item->num_glyphs = otl_buffer->in_length;
+@@ -2654,11 +2659,11 @@
+             // ###### fix the case where we have y advances. How do we handle this in Uniscribe?????
+             if (positions[i].new_advance) {
+                 item->advances[i] = item->flags & QTextEngine::RightToLeft
+-                                    ? -qRound((positions[i].x_advance >> 6)*scale) 
++                                    ? -qRound((positions[i].x_advance >> 6)*scale)
+                                     :  qRound((positions[i].x_advance >> 6)*scale);
+             } else {
+                 item->advances[i] += item->flags & QTextEngine::RightToLeft
+-                                     ? -qRound((positions[i].x_advance >> 6)*scale) 
++                                     ? -qRound((positions[i].x_advance >> 6)*scale)
+                                      :  qRound((positions[i].x_advance >> 6)*scale);
+             }
+ 	    item->offsets[i].x = qRound((positions[i].x_pos >> 6)*scale);
+--- qt.orig/src/kernel/qscriptengine_x11.cpp
++++ qt.patched/src/kernel/qscriptengine_x11.cpp
+@@ -45,7 +45,12 @@
+ #ifndef QT_NO_XFTFREETYPE
+     QOpenType *openType = item->font->openType();
+     if (openType && openType->supportsScript(QFont::Syriac)) {
+-        return arabicSyriacOpenTypeShape(openType, item);
++        bool ot_ok;
++        if (arabicSyriacOpenTypeShape(openType, item, &ot_ok))
++            return true;
++        if (ot_ok)
++            return false;
++        // fall through to the non OT code
+     }
+ #endif
+     return basic_shape(item);




More information about the pkg-kde-commits mailing list