SOURCES: mozilla-firefox-pango-cursor-position-more.patch (NEW), m...
arekm
arekm at pld-linux.org
Fri Nov 30 18:40:51 CET 2007
Author: arekm Date: Fri Nov 30 17:40:51 2007 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- add font fixes from fedora
---- Files affected:
SOURCES:
mozilla-firefox-pango-cursor-position-more.patch (NONE -> 1.1) (NEW), mozilla-firefox-pango-cursor-position.patch (NONE -> 1.1) (NEW), mozilla-firefox-pango-justified-range.patch (NONE -> 1.1) (NEW), mozilla-firefox-pango-ligatures.patch (NONE -> 1.1) (NEW), mozilla-firefox-pango-printing.patch (NONE -> 1.1) (NEW), mozilla-firefox-pango-underline.patch (NONE -> 1.1) (NEW), mozilla-firefox-xft-randewidth.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/mozilla-firefox-pango-cursor-position-more.patch
diff -u /dev/null SOURCES/mozilla-firefox-pango-cursor-position-more.patch:1.1
--- /dev/null Fri Nov 30 18:40:51 2007
+++ SOURCES/mozilla-firefox-pango-cursor-position-more.patch Fri Nov 30 18:40:46 2007
@@ -0,0 +1,19 @@
+diff -pruN -x '.moz*' -x .deps -x 'firefox*' -x '*.mk' -x 'config*' -x dist -x build -x toolkit -x '*o' -x '*a' -x '*html' mozilla.orig/layout/generic/nsTextFrame.cpp mozilla/layout/generic/nsTextFrame.cpp
+--- mozilla.orig/layout/generic/nsTextFrame.cpp 2006-08-26 13:33:35.000000000 +0900
++++ mozilla/layout/generic/nsTextFrame.cpp 2006-12-13 20:54:32.000000000 +0900
+@@ -4261,12 +4261,10 @@ nsTextFrame::GetPointFromOffset(nsPresCo
+ if (tc) {
+ totalLength = tc->Text()->GetLength(); // raw value which includes whitespace
+ }
+- if ((hitLength == textLength) && (inOffset = mContentLength) &&
+- (mContentOffset + mContentLength == totalLength)) {
+- // no need to re-measure when at the end of the last-in-flow
+- }
++ if (hitLength > 0)
++ inRendContext->GetRangeWidth(paintBuffer.mBuffer, textLength, 0, hitLength, (PRUint32&)width);
+ else
+- inRendContext->GetWidth(paintBuffer.mBuffer, hitLength, width);
++ width = 0;
+ }
+ if ((hitLength == textLength) && (TEXT_TRIMMED_WS & mState)) {
+ //
================================================================
Index: SOURCES/mozilla-firefox-pango-cursor-position.patch
diff -u /dev/null SOURCES/mozilla-firefox-pango-cursor-position.patch:1.1
--- /dev/null Fri Nov 30 18:40:51 2007
+++ SOURCES/mozilla-firefox-pango-cursor-position.patch Fri Nov 30 18:40:46 2007
@@ -0,0 +1,52 @@
+Index: mozilla/gfx/src/gtk/nsFontMetricsPango.cpp
+===================================================================
+RCS file: /cvsroot/mozilla/gfx/src/gtk/nsFontMetricsPango.cpp,v
+retrieving revision 1.24
+diff -d -u -p -6 -r1.24 nsFontMetricsPango.cpp
+--- mozilla/gfx/src/gtk/nsFontMetricsPango.cpp 25 Aug 2006 01:02:34 -0000 1.24
++++ mozilla/gfx/src/gtk/nsFontMetricsPango.cpp 6 Sep 2006 07:01:49 -0000
+@@ -948,13 +948,12 @@ nsFontMetricsPango::GetClusterInfo(const
+ PRInt32
+ nsFontMetricsPango::GetPosition(const PRUnichar *aText, PRUint32 aLength,
+ nsPoint aPt)
+ {
+ int trailing = 0;
+ int inx = 0;
+- gboolean found = FALSE;
+ const gchar *curChar;
+ PRInt32 retval = 0;
+
+ float f = mDeviceContext->AppUnitsToDevUnits();
+
+ PangoLayout *layout = pango_layout_new(mPangoContext);
+@@ -974,28 +973,18 @@ nsFontMetricsPango::GetPosition(const PR
+ }
+
+ // Set up the pango layout
+ pango_layout_set_text(layout, text, strlen(text));
+ FixupSpaceWidths(layout, text);
+
+- found = pango_layout_xy_to_index(layout, localX, localY,
+- &inx, &trailing);
++ pango_layout_xy_to_index(layout, localX, localY,
++ &inx, &trailing);
+
+ // Convert the index back to the utf-16 index
+ curChar = text;
+
+- // Jump to the end if it's not found.
+- if (!found) {
+- if (inx == 0)
+- retval = 0;
+- else if (trailing)
+- retval = aLength;
+-
+- goto loser;
+- }
+-
+ for (PRUint32 curOffset=0; curOffset < aLength;
+ curOffset++, curChar = g_utf8_find_next_char(curChar, NULL)) {
+
+ // Check for a match before checking for a surrogate pair
+ if (curChar - text == inx) {
+ retval = curOffset;
================================================================
Index: SOURCES/mozilla-firefox-pango-justified-range.patch
diff -u /dev/null SOURCES/mozilla-firefox-pango-justified-range.patch:1.1
--- /dev/null Fri Nov 30 18:40:52 2007
+++ SOURCES/mozilla-firefox-pango-justified-range.patch Fri Nov 30 18:40:46 2007
@@ -0,0 +1,53 @@
+diff -pruN -x '.moz*' -x .deps -x 'thunderbird*' -x '*.mk' -x 'config*' -x dist -x build -x toolkit -x '*o' -x '*a' -x '*html' -x 'firefox*' mozilla.orig/layout/generic/nsTextFrame.cpp mozilla/layout/generic/nsTextFrame.cpp
+--- mozilla.orig/layout/generic/nsTextFrame.cpp 2006-12-20 12:15:38.000000000 +0900
++++ mozilla/layout/generic/nsTextFrame.cpp 2006-12-20 21:29:39.000000000 +0900
+@@ -2973,15 +2973,16 @@ nsTextFrame::RenderString(nsIRenderingCo
+
+ nsIFontMetrics* lastFont = aTextStyle.mLastFont;
+ PRInt32 pendingCount;
+- PRUnichar* runStart = bp;
++ PRUnichar* runStart = bp, *top = aBuffer;
+ nscoord charWidth, width = 0;
+ PRInt32 countSoFar = 0;
++ PRUint32 offset;
+ // Save the color we want to use for the text, since calls to
+ // PaintTextDecorations in this method will call SetColor() on the rendering
+ // context.
+ nscolor textColor;
+ aRenderingContext.GetColor(textColor);
+- for (; --aLength >= 0; aBuffer++) {
++ for (offset = 0; offset < aLength; aBuffer++, offset++) {
+ nsIFontMetrics* nextFont;
+ nscoord glyphWidth = 0;
+ PRUnichar ch = *aBuffer;
+@@ -3038,7 +3039,7 @@ nsTextFrame::RenderString(nsIRenderingCo
+ else if (ch == ' ') {
+ glyphWidth += aTextStyle.mSpaceWidth + aTextStyle.mWordSpacing + aTextStyle.mLetterSpacing;
+ }
+- else if (IS_HIGH_SURROGATE(ch) && aLength > 0 &&
++ else if (IS_HIGH_SURROGATE(ch) && (offset + 1) < aLength &&
+ IS_LOW_SURROGATE(*(aBuffer+1))) {
+
+ // special handling for surrogate pair
+@@ -3046,7 +3047,7 @@ nsTextFrame::RenderString(nsIRenderingCo
+ glyphWidth += charWidth + aTextStyle.mLetterSpacing;
+ // copy the surrogate low
+ *bp++ = ch;
+- --aLength;
++ offset++;
+ aBuffer++;
+ ch = *aBuffer;
+ // put the width into the space buffer
+@@ -3058,10 +3059,10 @@ nsTextFrame::RenderString(nsIRenderingCo
+ glyphWidth = 0;
+ }
+ else {
+- aRenderingContext.GetWidth(ch, charWidth);
++ aRenderingContext.GetRangeWidth(top, aLength, offset, offset + 1, (PRUint32&)charWidth);
+ glyphWidth += charWidth + aTextStyle.mLetterSpacing;
+ }
+- if (justifying && (!isEndOfLine || aLength > 0)
++ if (justifying && (!isEndOfLine || (offset + 1) < aLength)
+ && IsJustifiableCharacter(ch, isCJ)) {
+ glyphWidth += aTextStyle.mExtraSpacePerJustifiableCharacter;
+ if ((PRUint32)--aTextStyle.mNumJustifiableCharacterToRender
================================================================
Index: SOURCES/mozilla-firefox-pango-ligatures.patch
diff -u /dev/null SOURCES/mozilla-firefox-pango-ligatures.patch:1.1
--- /dev/null Fri Nov 30 18:40:52 2007
+++ SOURCES/mozilla-firefox-pango-ligatures.patch Fri Nov 30 18:40:46 2007
@@ -0,0 +1,1932 @@
+--- mozilla.back/gfx/src/gtk/nsFontMetricsPango.cpp.orig 2007-06-28 14:44:31.000000000 +0200
++++ mozilla.back/gfx/src/gtk/nsFontMetricsPango.cpp 2007-06-28 15:48:04.000000000 +0200
+@@ -21,6 +21,8 @@
+ * are Copyright (C) 2004 the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
++ * Christopher Blizzard <blizzard at mozilla.org>
++ * Behdad Esfahbod <behdad at behdad.org>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+@@ -36,6 +38,10 @@
+ *
+ * ***** END LICENSE BLOCK ***** */
+
++#define PANGO_ENABLE_BACKEND
++
++#include "nsFontMetricsPango.h"
++
+ #include <strings.h>
+ #include "nsFont.h"
+ #include "nsIDeviceContext.h"
+@@ -43,27 +49,37 @@
+ #include "nsIPref.h"
+ #include "nsServiceManagerUtils.h"
+
+-#define PANGO_ENABLE_BACKEND
+-#define PANGO_ENABLE_ENGINE
+-
+-#include "nsFontMetricsPango.h"
+-#include "nsRenderingContextGTK.h"
+-#include "nsDeviceContextGTK.h"
+ #include "nsFontConfigUtils.h"
+
+ #include "nsUnicharUtils.h"
+ #include "nsQuickSort.h"
+ #include "nsFontConfigUtils.h"
++#include "mozilla-decoder.h"
++
++#define FORCE_PR_LOG
++#include "prlog.h"
++
+
+ #include <fontconfig/fontconfig.h>
++#include <freetype/tttables.h>
++
++#include <pango/pango.h>
++#include <pango/pangofc-font.h>
++
++#ifdef PSPANGO
++#include <pango/pangoft2.h>
++#include "nsRenderingContextPS.h"
++#include "nsDeviceContextPS.h"
++#include "nsType1.h"
++#else
+ #include <gdk/gdk.h>
+ #include <gdk/gdkx.h>
+-#include <freetype/tttables.h>
++#include "nsRenderingContextGTK.h"
++#include "nsDeviceContextGTK.h"
++#endif
++
+
+-#include "mozilla-decoder.h"
+
+-#define FORCE_PR_LOG
+-#include "prlog.h"
+
+ // Globals
+
+@@ -108,6 +124,49 @@ static nsresult EnumFontsPango (nsI
+ PRUint32* aCount, PRUnichar*** aResult);
+ static int CompareFontNames (const void* aArg1, const void* aArg2,
+ void* aClosure);
++static void utf16_to_utf8 (const PRUnichar* aString, PRUint32 aLength,
++ char *&text, gint &text_len);
++
++#ifdef PSPANGO
++static void
++default_substitute (FcPattern *pattern,
++ gpointer data)
++{
++ FcPatternDel (pattern, FC_HINTING);
++ FcPatternAddBool (pattern, FC_HINTING, 0);
++}
++#endif
++
++static PangoFontMap *
++get_fontmap (void)
++{
++ static PangoFontMap *fontmap = NULL;
++
++ if (!fontmap) {
++#ifdef PSPANGO
++ fontmap = pango_ft2_font_map_new ();
++ pango_ft2_font_map_set_resolution ((PangoFT2FontMap *)fontmap, 72., 72.);
++ pango_ft2_font_map_set_default_substitute ((PangoFT2FontMap *)fontmap, default_substitute, NULL, NULL);
++#else
++ PangoContext* context = gdk_pango_context_get ();
++ fontmap = pango_context_get_font_map (context);
++ g_object_unref (context);
++#endif
++ }
++
++ return fontmap;
++}
++
++static PangoContext *
++get_context (void)
++{
++#ifdef PSPANGO
++ return pango_ft2_font_map_create_context ((PangoFT2FontMap *) get_fontmap ());
++#else
++ return gdk_pango_context_get();
++#endif
++}
++
+
+ nsFontMetricsPango::nsFontMetricsPango()
+ {
+@@ -228,14 +228,20 @@
+ mLangGroup = aLangGroup;
+
+ // Hang on to the device context
++#ifdef PSPANGO
++ mDeviceContext = (nsDeviceContextPS *)aContext;
++#else
+ mDeviceContext = aContext;
++#endif
+
+ mPointSize = NSTwipsToFloatPoints(mFont.size);
+
++#ifndef PSPANGO
+ // Make sure to clamp the pixel size to something reasonable so we
+ // don't make the X server blow up.
+ nscoord screenPixels = gdk_screen_height();
+ mPointSize = PR_MIN((screenPixels - 1) * FONT_MAX_FONT_SCALE, mPointSize);
++#endif
+
+ // enumerate over the font names passed in
+ mFont.EnumerateFamilies(nsFontMetricsPango::EnumFontCallback, this);
+@@ -329,7 +394,7 @@ nsFontMetricsPango::CacheFontMetrics(voi
+
+ // mPangoSpaceWidth
+ PangoLayout *layout = pango_layout_new(mPangoContext);
+- pango_layout_set_text(layout, " ", 1);
++ pango_layout_set_text(layout, " ", -1);
+ int pswidth, psheight;
+ pango_layout_get_size(layout, &pswidth, &psheight);
+ mPangoSpaceWidth = pswidth;
+@@ -337,14 +402,14 @@ nsFontMetricsPango::CacheFontMetrics(voi
+
+ // mSpaceWidth (width of a space)
+ nscoord tmpWidth;
+- GetWidth(" ", 1, tmpWidth, NULL);
++ GetWidth(" ", 1, tmpWidth CONTEXT_ARG_NULL);
+ mSpaceWidth = tmpWidth;
+
+ // mAveCharWidth (width of an 'average' char)
+ // XftTextExtents16(GDK_DISPLAY(), xftFont, &xUnichar, 1, &extents);
+ //rawWidth = extents.width;
+ //mAveCharWidth = NSToCoordRound(rawWidth * f);
+- GetWidth("x", 1, tmpWidth, NULL);
++ GetWidth("x", 1, tmpWidth CONTEXT_ARG_NULL);
+ mAveCharWidth = tmpWidth;
+
+ // mXHeight (height of an 'x' character)
+@@ -460,130 +525,96 @@ nsFontMetricsPango::GetFontHandle(nsFont
+
+ // nsIFontMetricsPango impl
+
+-nsresult
+-nsFontMetricsPango::GetWidth(const char* aString, PRUint32 aLength,
+- nscoord& aWidth,
+- nsRenderingContextGTK *aContext)
++#ifdef PSPANGO
++NS_IMETHODIMP
++nsFontMetricsPSPango::GetStringWidth(const char *String,nscoord &aWidth,nscoord aLength)
+ {
+- PangoLayout *layout = pango_layout_new(mPangoContext);
+-
+- pango_layout_set_text(layout, aString, aLength);
++ return GetWidth (String, (PRUint32) aLength, aWidth CONTEXT_ARG_NULL);
++}
+
+- if (mPangoSpaceWidth)
+- FixupSpaceWidths(layout, aString);
++NS_IMETHODIMP
++nsFontMetricsPSPango::GetStringWidth(const PRUnichar *aString,nscoord &aWidth,nscoord aLength)
++{
++ return GetWidth (aString, (PRUint32)aLength, aWidth, NULL CONTEXT_ARG_NULL);
++}
++#endif
+
++nsresult
++nsFontMetricsPango::GetWidth(const char* aString, PRUint32 aLength,
++ nscoord& aWidth
++ CONTEXT_ARG_DEF)
++{
+ int width, height;
+-
++ PangoLayout *layout = GetLayout(aString, aLength);
+ pango_layout_get_size(layout, &width, &height);
+-
+ g_object_unref(layout);
+
+- float f;
+- f = mDeviceContext->DevUnitsToAppUnits();
++ float f = mDeviceContext->DevUnitsToAppUnits();
+ aWidth = NSToCoordRound(width * f / PANGO_SCALE);
+
+- // printf("GetWidth (char *) %d\n", aWidth);
+-
+ return NS_OK;
+ }
+
+ nsresult
+ nsFontMetricsPango::GetWidth(const PRUnichar* aString, PRUint32 aLength,
+- nscoord& aWidth, PRInt32 *aFontID,
+- nsRenderingContextGTK *aContext)
++ nscoord& aWidth, PRInt32 *aFontID
++ CONTEXT_ARG_DEF)
+ {
+- nsresult rv = NS_OK;
+- PangoLayout *layout = pango_layout_new(mPangoContext);
+-
+- gchar *text = g_utf16_to_utf8(aString, aLength,
+- NULL, NULL, NULL);
+-
+- if (!text) {
+- aWidth = 0;
+-#ifdef DEBUG
+- NS_WARNING("nsFontMetricsPango::GetWidth invalid unicode to follow");
+- DUMP_PRUNICHAR(aString, aLength)
+-#endif
+- rv = NS_ERROR_FAILURE;
+- goto loser;
+- }
+-
+ gint width, height;
+-
+- pango_layout_set_text(layout, text, strlen(text));
+- FixupSpaceWidths(layout, text);
++ PangoLayout *layout = GetLayout(aString, aLength);
+ pango_layout_get_size(layout, &width, &height);
++ g_object_unref(layout);
+
+- float f;
+- f = mDeviceContext->DevUnitsToAppUnits();
++ float f = mDeviceContext->DevUnitsToAppUnits();
+ aWidth = NSToCoordRound(width * f / PANGO_SCALE);
+
+- // printf("GetWidth %d\n", aWidth);
+-
+- loser:
+- g_free(text);
+- g_object_unref(layout);
+-
+- return rv;
++ return NS_OK;
+ }
+
+
+ nsresult
+-nsFontMetricsPango::GetTextDimensions(const PRUnichar* aString,
++nsFontMetricsPango::GetTextDimensions(const char* aString,
+ PRUint32 aLength,
+- nsTextDimensions& aDimensions,
+- PRInt32* aFontID,
+- nsRenderingContextGTK *aContext)
++ nsTextDimensions& aDimensions
++ CONTEXT_ARG_DEF)
+ {
+- nsresult rv = NS_OK;
+-
+- PangoLayout *layout = pango_layout_new(mPangoContext);
++ PangoLayout *layout = GetLayout(aString, aLength);
++ PangoLayoutLine *line = pango_layout_get_line(layout, 0);
+
+- gchar *text = g_utf16_to_utf8(aString, aLength,
+- NULL, NULL, NULL);
+-
+- if (!text) {
+-#ifdef DEBUG
+- NS_WARNING("nsFontMetricsPango::GetTextDimensions invalid unicode to follow");
+- DUMP_PRUNICHAR(aString, aLength)
+-#endif
+- aDimensions.width = 0;
+- aDimensions.ascent = 0;
+- aDimensions.descent = 0;
+-
+- rv = NS_ERROR_FAILURE;
+- goto loser;
+- }
+-
++ PangoRectangle logical;
++ pango_layout_line_get_extents(line, NULL, &logical);
++ g_object_unref(layout);
+
+- pango_layout_set_text(layout, text, strlen(text));
+- FixupSpaceWidths(layout, text);
++ float P2T = mDeviceContext->DevUnitsToAppUnits();
+
+- // Get the logical extents
+- PangoLayoutLine *line;
+- if (pango_layout_get_line_count(layout) != 1) {
+- printf("Warning: more than one line!\n");
+- }
+- line = pango_layout_get_line(layout, 0);
++ aDimensions.ascent = NSToCoordRound(PANGO_ASCENT(logical) * P2T / PANGO_SCALE);
++ aDimensions.descent = NSToCoordRound(PANGO_DESCENT(logical) * P2T / PANGO_SCALE);
++ aDimensions.width = NSToCoordRound(logical.width * P2T / PANGO_SCALE);
+
+- PangoRectangle rect;
+- pango_layout_line_get_extents(line, NULL, &rect);
++ return NS_OK;
++}
+
+- float P2T;
+- P2T = mDeviceContext->DevUnitsToAppUnits();
++nsresult
++nsFontMetricsPango::GetTextDimensions(const PRUnichar* aString,
++ PRUint32 aLength,
++ nsTextDimensions& aDimensions,
++ PRInt32* aFontID
++ CONTEXT_ARG_DEF)
++{
++ PangoLayout *layout = GetLayout(aString, aLength);
++ PangoLayoutLine *line = pango_layout_get_line(layout, 0);
+
+- aDimensions.width = NSToCoordRound(rect.width * P2T / PANGO_SCALE);
+- aDimensions.ascent = NSToCoordRound(PANGO_ASCENT(rect) * P2T / PANGO_SCALE);
+- aDimensions.descent = NSToCoordRound(PANGO_DESCENT(rect) * P2T / PANGO_SCALE);
++ PangoRectangle logical;
++ pango_layout_line_get_extents(line, NULL, &logical);
++ g_object_unref(layout);
+
+- // printf("GetTextDimensions %d %d %d\n", aDimensions.width,
+- //aDimensions.ascent, aDimensions.descent);
++ float P2T = mDeviceContext->DevUnitsToAppUnits();
+
+- loser:
+- g_free(text);
+- g_object_unref(layout);
++ aDimensions.ascent = NSToCoordRound(PANGO_ASCENT(logical) * P2T / PANGO_SCALE);
++ aDimensions.descent = NSToCoordRound(PANGO_DESCENT(logical) * P2T / PANGO_SCALE);
++ aDimensions.width = NSToCoordRound(logical.width * P2T / PANGO_SCALE);
+
+- return rv;
++ return NS_OK;
+ }
+
+ nsresult
+@@ -595,13 +626,13 @@ nsFontMetricsPango::GetTextDimensions(co
+ nsTextDimensions& aDimensions,
+ PRInt32& aNumCharsFit,
+ nsTextDimensions& aLastWordDimensions,
+- PRInt32* aFontID,
+- nsRenderingContextGTK *aContext)
++ PRInt32* aFontID
++ CONTEXT_ARG_DEF)
+ {
+
+ return GetTextDimensionsInternal(aString, aLength, aAvailWidth, aBreaks,
+ aNumBreaks, aDimensions, aNumCharsFit,
+- aLastWordDimensions, aContext);
++ aLastWordDimensions CONTEXT_ARG_PASS);
+
+ }
+
+@@ -614,8 +645,8 @@ nsFontMetricsPango::GetTextDimensions(co
+ nsTextDimensions& aDimensions,
+ PRInt32& aNumCharsFit,
+ nsTextDimensions& aLastWordDimensions,
+- PRInt32* aFontID,
+- nsRenderingContextGTK *aContext)
++ PRInt32* aFontID
++ CONTEXT_ARG_DEF)
+ {
+ nsresult rv = NS_OK;
+ PRInt32 curBreak = 0;
+@@ -623,23 +654,15 @@ nsFontMetricsPango::GetTextDimensions(co
+
+ PRInt32 *utf8Breaks = new PRInt32[aNumBreaks];
+
+- gchar *text = g_utf16_to_utf8(aString, (PRInt32)aLength,
+- NULL, NULL, NULL);
++ gchar* text;
++ gint text_len;
++ utf16_to_utf8 (aString, aLength, text, text_len);
+
+ curChar = text;
+
+- if (!text) {
+-#ifdef DEBUG
+- NS_WARNING("nsFontMetricsPango::GetWidth invalid unicode to follow");
+- DUMP_PRUNICHAR(aString, (PRUint32)aLength)
+-#endif
+- rv = NS_ERROR_FAILURE;
+- goto loser;
+- }
+-
+ // Covert the utf16 break offsets to utf8 break offsets
+ for (PRInt32 curOffset=0; curOffset < aLength;
+- curOffset++, curChar = g_utf8_find_next_char(curChar, NULL)) {
++ curOffset++, curChar = g_utf8_next_char(curChar)) {
+ if (aBreaks[curBreak] == curOffset) {
+ utf8Breaks[curBreak] = curChar - text;
+ curBreak++;
+@@ -653,10 +676,10 @@ nsFontMetricsPango::GetTextDimensions(co
+ utf8Breaks[curBreak] = curChar - text;
+
+ #if 0
+- if (strlen(text) != aLength) {
+- printf("Different lengths for utf16 %d and utf8 %d\n", aLength, strlen(text));
++ if (text_len != aLength) {
++ printf("Different lengths for utf16 %d and utf8 %d\n", aLength, text_len);
+ DUMP_PRUNICHAR(aString, aLength)
+- DUMP_PRUNICHAR(text, strlen(text))
++ DUMP_PRUNICHAR(text, text_len)
+ for (PRInt32 i = 0; i < aNumBreaks; ++i) {
+ printf(" break %d utf16 %d utf8 %d\n", i, aBreaks[i], utf8Breaks[i]);
+ }
+@@ -666,9 +689,9 @@ nsFontMetricsPango::GetTextDimensions(co
+ // We'll use curBreak to indicate which of the breaks end up being
+ // used for the break point for this line.
+ curBreak = 0;
+- rv = GetTextDimensionsInternal(text, strlen(text), aAvailWidth, utf8Breaks,
++ rv = GetTextDimensionsInternal(text, text_len, aAvailWidth, utf8Breaks,
+ aNumBreaks, aDimensions, aNumCharsFit,
+- aLastWordDimensions, aContext);
++ aLastWordDimensions CONTEXT_ARG_PASS);
+
+ // Figure out which of the breaks we ended up using to convert
+ // back to utf16 - start from the end.
+@@ -681,200 +704,365 @@ nsFontMetricsPango::GetTextDimensions(co
+ }
+ }
+
+- loser:
+- if (text)
+- g_free(text);
++ g_free(text);
+
+ delete[] utf8Breaks;
+
+ return rv;
+ }
+
<<Diff was trimmed, longer than 597 lines>>
More information about the pld-cvs-commit
mailing list