[arch-commits] CVS update of extra/network/firefox (2 files)

Alexander Baldeck alexander at archlinux.org
Sat Oct 20 13:57:55 UTC 2007


    Date: Saturday, October 20, 2007 @ 09:57:55
  Author: alexander
    Path: /home/cvs-extra/extra/network/firefox

   Added: firefox-1.5-xft-rangewidth.patch (1.1)
Modified: PKGBUILD (1.17 -> 1.18)

* fixes FS#8352


----------------------------------+
 PKGBUILD                         |    7 
 firefox-1.5-xft-rangewidth.patch |  283 +++++++++++++++++++++++++++++++++++++
 2 files changed, 288 insertions(+), 2 deletions(-)


Index: extra/network/firefox/PKGBUILD
diff -u extra/network/firefox/PKGBUILD:1.17 extra/network/firefox/PKGBUILD:1.18
--- extra/network/firefox/PKGBUILD:1.17	Fri Oct 19 07:07:17 2007
+++ extra/network/firefox/PKGBUILD	Sat Oct 20 09:57:54 2007
@@ -1,10 +1,10 @@
-# $Id: PKGBUILD,v 1.17 2007/10/19 11:07:17 alexander Exp $
+# $Id: PKGBUILD,v 1.18 2007/10/20 13:57:54 alexander Exp $
 # Maintainer: Alexander Baldeck <alexander at archlinux.org>
 # Contributor: Dale Blount <dale at archlinux.org>
 # Contributer: Nick Penwarden <toth64 at yahoo.com>
 pkgname=firefox
 pkgver=2.0.0.8
-pkgrel=1
+pkgrel=2
 pkgdesc="Standalone web browser from mozilla.org"
 arch=(i686 x86_64)
 license=('MPL' 'GPL' 'LGPL')
@@ -29,6 +29,7 @@
         firefox-2.0-pango-ligatures.patch
         firefox-1.5-pango-underline.patch
         firefox-1.5-pango-justified-range.patch
+        firefox-1.5-xft-rangewidth.patch
         firefox.desktop
 	firefox-safe.desktop)
 options=('!makeflags')
@@ -46,6 +47,7 @@
   patch -Np1 -i ${startdir}/src/firefox-2.0-pango-ligatures.patch || return 1
   patch -Np1 -i ${startdir}/src/firefox-1.5-pango-underline.patch || return 1
   patch -Np1 -i ${startdir}/src/firefox-1.5-pango-justified-range.patch || return 1
+  patch -Np1 -i ${startdir}/src/firefox-1.5-xft-rangewidth.patch || return 1
 
   if [ "$CARCH" = "x86_64" ]; then
     patch -Np0 -i ../firefox-visibility.patch || return 1
@@ -100,5 +102,6 @@
          '505728f57ff903e68afd3abea01be2e4'
          '713a9587dd024f5d03f1fe9c095da9de'
          '4d0713c0a94a367a4e84d5f7e56de631'
+         'affb470ca6bac11a7f3005e2508621a8'
          '74ea70c9e935f0e7f7b75436fe33efd5'
          '5e68cabfcf3c021806b326f664ac505e')
Index: extra/network/firefox/firefox-1.5-xft-rangewidth.patch
diff -u /dev/null extra/network/firefox/firefox-1.5-xft-rangewidth.patch:1.1
--- /dev/null	Sat Oct 20 09:57:55 2007
+++ extra/network/firefox/firefox-1.5-xft-rangewidth.patch	Sat Oct 20 09:57:54 2007
@@ -0,0 +1,283 @@
+diff -pruN -x '.moz*' -x .libs -x .deps -x dist -x 'config*' -x 'firefox*' -x '*a' -x '*so' -x '*o' -x build -x '*html' mozilla.orig/gfx/src/gtk/nsFontMetricsXft.cpp mozilla/gfx/src/gtk/nsFontMetricsXft.cpp
+--- mozilla.orig/gfx/src/gtk/nsFontMetricsXft.cpp	2006-04-25 08:58:36.000000000 +0900
++++ mozilla/gfx/src/gtk/nsFontMetricsXft.cpp	2007-02-08 01:50:05.000000000 +0900
+@@ -227,10 +227,14 @@ static nsresult EnumFontsXft     (nsIAto
+ 
+ static        void ConvertCharToUCS4    (const char *aString,
+                                          PRUint32 aLength,
++                                         PRUint32 aStart,
++                                         PRUint32 aEnd,
+                                          nsAutoFcChar32Buffer &aOutBuffer,
+                                          PRUint32 *aOutLen);
+ static        void ConvertUnicharToUCS4 (const PRUnichar *aString,
+                                          PRUint32 aLength,
++                                         PRUint32 aStart,
++                                         PRUint32 aEnd,
+                                          nsAutoFcChar32Buffer &aOutBuffer,
+                                          PRUint32 *aOutLen);
+ static    nsresult ConvertUCS4ToCustom  (FcChar32 *aSrc, PRUint32 aSrcLen,
+@@ -507,7 +511,7 @@ nsFontMetricsXft::GetWidth(const PRUnich
+         return NS_OK;
+     }
+ 
+-    gint rawWidth = RawGetWidth(aString, aLength);
++    gint rawWidth = RawGetWidth(aString, aLength, 0, aLength);
+ 
+     float f;
+     f = mDeviceContext->DevUnitsToAppUnits();
+@@ -533,7 +537,7 @@ nsFontMetricsXft::GetTextDimensions(cons
+         return NS_OK;
+ 
+     nsresult rv;
+-    rv = EnumerateGlyphs(aString, aLength,
++    rv = EnumerateGlyphs(aString, aLength, 0, aLength,
+                          &nsFontMetricsXft::TextDimensionsCallback,
+                          &aDimensions);
+ 
+@@ -608,7 +612,7 @@ nsFontMetricsXft::DrawString(const char 
+     nsAutoDrawSpecBuffer drawBuffer(data.draw, &data.color);
+     data.drawBuffer = &drawBuffer;
+ 
+-    return EnumerateGlyphs(aString, aLength,
++    return EnumerateGlyphs(aString, aLength, 0, aLength,
+                            &nsFontMetricsXft::DrawStringCallback, &data);
+ }
+ 
+@@ -638,7 +642,7 @@ nsFontMetricsXft::DrawString(const PRUni
+     nsAutoDrawSpecBuffer drawBuffer(data.draw, &data.color);
+     data.drawBuffer = &drawBuffer;
+ 
+-    return EnumerateGlyphs(aString, aLength,
++    return EnumerateGlyphs(aString, aLength, 0, aLength,
+                            &nsFontMetricsXft::DrawStringCallback, &data);
+ }
+ 
+@@ -662,7 +666,7 @@ nsFontMetricsXft::GetBoundingMetrics(con
+     data.firstTime = PR_TRUE; 
+ 
+     nsresult rv;
+-    rv = EnumerateGlyphs(aString, aLength,
++    rv = EnumerateGlyphs(aString, aLength, 0, aLength,
+                          &nsFontMetricsXft::BoundingMetricsCallback, &data);
+     NS_ENSURE_SUCCESS(rv, rv);
+ 
+@@ -700,7 +704,7 @@ nsFontMetricsXft::GetBoundingMetrics(con
+     data.firstTime = PR_TRUE; 
+ 
+     nsresult rv;
+-    rv = EnumerateGlyphs(aString, aLength,
++    rv = EnumerateGlyphs(aString, aLength, 0, aLength,
+                          &nsFontMetricsXft::BoundingMetricsCallback, &data);
+     NS_ENSURE_SUCCESS(rv, rv);
+ 
+@@ -758,7 +762,17 @@ nsFontMetricsXft::GetRangeWidth(const PR
+                                 PRUint32 aEnd,
+                                 PRUint32 &aWidth)
+ {
+-    return NS_ERROR_NOT_IMPLEMENTED;
++    if (!aLength) {
++        aWidth = 0;
++        return NS_OK;
++    }
++
++    gint rawWidth = RawGetWidth(aText, aLength, aStart, aEnd);
++    float f = mDeviceContext->DevUnitsToAppUnits();
++
++    aWidth = NSToCoordRound(rawWidth * f);
++
++    return NS_OK;
+ }
+ 
+ nsresult
+@@ -768,7 +782,17 @@ nsFontMetricsXft::GetRangeWidth(const ch
+                                 PRUint32 aEnd,
+                                 PRUint32 &aWidth)
+ {
+-    return NS_ERROR_NOT_IMPLEMENTED;
++    if (!aLength) {
++        aWidth = 0;
++        return NS_OK;
++    }
++
++    gint rawWidth = RawGetWidth(aText, aLength, aStart, aEnd);
++    float f = mDeviceContext->DevUnitsToAppUnits();
++
++    aWidth = NSToCoordRound(rawWidth * f);
++
++    return NS_OK;
+ }
+ 
+ PRUint32
+@@ -850,12 +874,12 @@ nsFontMetricsXft::CacheFontMetrics(void)
+     // mSpaceWidth (width of a space)
+     gint rawWidth;
+     PRUnichar unispace(' ');
+-    rawWidth = RawGetWidth(&unispace, 1);
++    rawWidth = RawGetWidth(&unispace, 1, 0, 1);
+     mSpaceWidth = NSToCoordRound(rawWidth * f);
+ 
+     // mAveCharWidth (width of an 'average' char)
+     PRUnichar xUnichar('x');
+-    rawWidth = RawGetWidth(&xUnichar, 1);
++    rawWidth = RawGetWidth(&xUnichar, 1, 0, 1);
+     mAveCharWidth = NSToCoordRound(rawWidth * f);
+ 
+     // mXHeight (height of an 'x' character)
+@@ -1226,12 +1250,27 @@ nsFontMetricsXft::DoMatch(PRBool aMatchA
+ }
+ 
+ gint
+-nsFontMetricsXft::RawGetWidth(const PRUnichar* aString, PRUint32 aLength)
++nsFontMetricsXft::RawGetWidth(const PRUnichar* aString, PRUint32 aLength, PRUint32 aStart, PRUint32 aEnd)
++{
++    nscoord width = 0;
++    nsresult rv;
++
++    rv = EnumerateGlyphs(aString, aLength, aStart, aEnd,
++                         &nsFontMetricsXft::GetWidthCallback, &width);
++
++    if (NS_FAILED(rv))
++        width = 0;
++
++    return width;
++}
++
++gint
++nsFontMetricsXft::RawGetWidth(const char* aString, PRUint32 aLength, PRUint32 aStart, PRUint32 aEnd)
+ {
+     nscoord width = 0;
+     nsresult rv;
+ 
+-    rv = EnumerateGlyphs(aString, aLength,
++    rv = EnumerateGlyphs(aString, aLength, aStart, aEnd,
+                          &nsFontMetricsXft::GetWidthCallback, &width);
+ 
+     if (NS_FAILED(rv))
+@@ -1457,6 +1496,8 @@ nsFontMetricsXft::EnumerateXftGlyphs(con
+ nsresult
+ nsFontMetricsXft::EnumerateGlyphs(const PRUnichar *aString,
+                                   PRUint32 aLen,
++                                  PRUint32 aStart,
++                                  PRUint32 aEnd,
+                                   GlyphEnumeratorCallback aCallback,
+                                   void *aCallbackData)
+ {
+@@ -1465,7 +1506,7 @@ nsFontMetricsXft::EnumerateGlyphs(const 
+ 
+     NS_ENSURE_TRUE(aLen, NS_OK); 
+ 
+-    ConvertUnicharToUCS4(aString, aLen, charBuffer, &len);
++    ConvertUnicharToUCS4(aString, aLen, aStart, aEnd, charBuffer, &len);
+     if (!len)
+         return NS_ERROR_OUT_OF_MEMORY;
+ 
+@@ -1475,6 +1516,8 @@ nsFontMetricsXft::EnumerateGlyphs(const 
+ nsresult
+ nsFontMetricsXft::EnumerateGlyphs(const char *aString,
+                                   PRUint32 aLen,
++                                  PRUint32 aStart,
++                                  PRUint32 aEnd,
+                                   GlyphEnumeratorCallback aCallback,
+                                   void *aCallbackData)
+ {
+@@ -1484,7 +1527,7 @@ nsFontMetricsXft::EnumerateGlyphs(const 
+     NS_ENSURE_TRUE(aLen, NS_OK); 
+ 
+     // Convert the incoming string into an array of UCS4 chars
+-    ConvertCharToUCS4(aString, aLen, charBuffer, &len);
++    ConvertCharToUCS4(aString, aLen, aStart, aEnd, charBuffer, &len);
+     if (!len)
+         return NS_ERROR_OUT_OF_MEMORY;
+ 
+@@ -2343,7 +2386,7 @@ EnumFontsXft(nsIAtom* aLangGroup, const 
+ 
+ /* static */
+ void
+-ConvertCharToUCS4(const char *aString, PRUint32 aLength, 
++ConvertCharToUCS4(const char *aString, PRUint32 aLength, PRUint32 aStart, PRUint32 aEnd,
+                   nsAutoFcChar32Buffer &aOutBuffer, PRUint32 *aOutLen)
+ {
+     *aOutLen = 0;
+@@ -2352,19 +2395,21 @@ ConvertCharToUCS4(const char *aString, P
+     if (!aOutBuffer.EnsureElemCapacity(aLength))
+         return;
+     outBuffer  = aOutBuffer.get();
++    if (aEnd > aLength)
++        aEnd = aLength;
+     
+-    for (PRUint32 i = 0; i < aLength; ++i) {
+-        outBuffer[i] = PRUint8(aString[i]); // to convert char >= 0x80 correctly
++    for (PRUint32 i = aStart; i < aLength && i < aEnd; ++i) {
++        outBuffer[i - aStart] = PRUint8(aString[i]); // to convert char >= 0x80 correctly
+     }
+ 
+-    *aOutLen = aLength;
++    *aOutLen = aEnd - aStart;
+ }
+ 
+ // Convert the incoming string into an array of UCS4 chars
+   
+ /* static */
+ void
+-ConvertUnicharToUCS4(const PRUnichar *aString, PRUint32 aLength,
++ConvertUnicharToUCS4(const PRUnichar *aString, PRUint32 aLength, PRUint32 aStart, PRUint32 aEnd,
+                      nsAutoFcChar32Buffer &aOutBuffer, PRUint32 *aOutLen)
+ {
+     *aOutLen = 0;
+@@ -2378,7 +2423,7 @@ ConvertUnicharToUCS4(const PRUnichar *aS
+ 
+     // Walk the passed in string looking for surrogates to convert to
+     // their full ucs4 representation.
+-    for (PRUint32 i = 0; i < aLength; ++i) {
++    for (PRUint32 i = aStart; i < aLength && i < aEnd; ++i) {
+         PRUnichar c = aString[i];
+ 
+         // Optimized for the non-surrogate case
+@@ -2693,12 +2738,12 @@ ConvertUCS4ToCustom(FcChar32 *aSrc,  PRU
+ #endif
+         // Convert 16bit  custom font codes to UCS4
+         ConvertUnicharToUCS4(NS_REINTERPRET_CAST(PRUnichar *, med),
+-                             medLen >> 1, aResult, &aDestLen);
++                             medLen >> 1, 0, medLen >> 1, aResult, &aDestLen);
+         rv = aDestLen ? rv : NS_ERROR_OUT_OF_MEMORY;
+     }
+     else {
+         // Convert 8bit custom font codes to UCS4
+-        ConvertCharToUCS4(med, medLen, aResult, &aDestLen);
++        ConvertCharToUCS4(med, medLen, 0, medLen, aResult, &aDestLen);
+         rv = aDestLen ? rv : NS_ERROR_OUT_OF_MEMORY;
+     }
+ 
+diff -pruN -x '.moz*' -x .libs -x .deps -x dist -x 'config*' -x 'firefox*' -x '*a' -x '*so' -x '*o' -x build -x '*html' mozilla.orig/gfx/src/gtk/nsFontMetricsXft.h mozilla/gfx/src/gtk/nsFontMetricsXft.h
+--- mozilla.orig/gfx/src/gtk/nsFontMetricsXft.h	2005-05-03 05:48:30.000000000 +0900
++++ mozilla/gfx/src/gtk/nsFontMetricsXft.h	2007-02-08 01:38:27.000000000 +0900
+@@ -259,7 +259,13 @@ private:
+     void        DoMatch            (PRBool aMatchAll);
+ 
+     gint        RawGetWidth        (const PRUnichar* aString,
+-                                    PRUint32         aLength);
++                                    PRUint32         aLength,
++                                    PRUint32         aStart,
++                                    PRUint32         aEnd);
++    gint        RawGetWidth        (const char* aString,
++                                    PRUint32    aLength,
++                                    PRUint32    aStart,
++                                    PRUint32    aEnd);
+     nsresult    SetupMiniFont      (void);
+     nsresult    DrawUnknownGlyph   (FcChar32   aChar,
+                                     nscoord    aX,
+@@ -272,10 +278,14 @@ private:
+                                     void     *aCallbackData);
+     nsresult    EnumerateGlyphs    (const char *aString,
+                                     PRUint32  aLen,
++                                    PRUint32  aStart,
++                                    PRUint32  aEnd,
+                                     GlyphEnumeratorCallback aCallback,
+                                     void     *aCallbackData);
+     nsresult    EnumerateGlyphs    (const PRUnichar *aString,
+                                     PRUint32  aLen,
++                                    PRUint32  aStart,
++                                    PRUint32  aEnd,
+                                     GlyphEnumeratorCallback aCallback,
+                                     void     *aCallbackData);
+     void        PrepareToDraw      (nsRenderingContextGTK *aContext,




More information about the arch-commits mailing list