summaryrefslogtreecommitdiff
path: root/firefox-1.5-xft-rangewidth.patch
diff options
context:
space:
mode:
authorMartin Stransky <stransky@fedoraproject.org>2007-07-09 10:15:21 +0000
committerMartin Stransky <stransky@fedoraproject.org>2007-07-09 10:15:21 +0000
commit4a48addf3bb0492afd28b1d2c4a057f5c977c1d5 (patch)
tree78dc7a1b808fc229e4a44d0f7f4992f047cf8e4f /firefox-1.5-xft-rangewidth.patch
parent- Properly clean up threads with newer NSPR (diff)
downloadlibrewolf-fedora-ff-4a48addf3bb0492afd28b1d2c4a057f5c977c1d5.tar.gz
librewolf-fedora-ff-4a48addf3bb0492afd28b1d2c4a057f5c977c1d5.tar.bz2
librewolf-fedora-ff-4a48addf3bb0492afd28b1d2c4a057f5c977c1d5.zip
backported pango patches from FC6
Diffstat (limited to 'firefox-1.5-xft-rangewidth.patch')
-rw-r--r--firefox-1.5-xft-rangewidth.patch283
1 files changed, 283 insertions, 0 deletions
diff --git a/firefox-1.5-xft-rangewidth.patch b/firefox-1.5-xft-rangewidth.patch
new file mode 100644
index 0000000..1ecc5f2
--- /dev/null
+++ b/firefox-1.5-xft-rangewidth.patch
@@ -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,
bgstack15