1 --- iceweasel-2.0.0.12.orig/gfx/src/gtk/nsFontMetricsPango.cpp
2 +++ iceweasel-2.0.0.12/gfx/src/gtk/nsFontMetricsPango.cpp
4 nsRenderingContextGTK *aContext)
9 PangoLayout *layout = pango_layout_new(mPangoContext);
11 - gchar *text = g_utf16_to_utf8(aString, aLength,
13 + // Just copy the aString to ensure the alignment,
14 + // it is not used anywhere else.
15 + PRUnichar* dummy = (PRUnichar *) PR_Malloc(aLength*sizeof(PRUnichar));
18 + NS_WARNING("nsFontMetricsPango::GetTextDimensions malloc() failed");
20 + rv = NS_ERROR_FAILURE;
23 + memcpy(dummy, aString, aLength*sizeof(PRUnichar));
24 + text = g_utf16_to_utf8(dummy, aLength,
35 g_object_unref(layout);
42 - gboolean found = FALSE;
47 pango_layout_set_text(layout, text, strlen(text));
48 FixupSpaceWidths(layout, text);
50 - found = pango_layout_xy_to_index(layout, localX, localY,
52 + pango_layout_xy_to_index(layout, localX, localY,
55 // Convert the index back to the utf-16 index
58 - // Jump to the end if it's not found.
68 for (PRUint32 curOffset=0; curOffset < aLength;
69 curOffset++, curChar = g_utf8_find_next_char(curChar, NULL)) {
71 --- iceweasel-2.0.0.12.orig/gfx/src/gtk/nsFontMetricsXft.cpp
72 +++ iceweasel-2.0.0.12/gfx/src/gtk/nsFontMetricsXft.cpp
73 @@ -2200,19 +2200,27 @@
74 nsAutoDrawSpecBuffer::Flush()
77 - // Some Xft libraries will crash if none of the glyphs have any
78 - // area. So before we draw, we scan through the glyphs. If we
79 - // find any that have area, we can draw.
80 - for (PRUint32 i = 0; i < mSpecPos; i++) {
81 - XftGlyphFontSpec *sp = &mSpecBuffer[i];
83 - XftGlyphExtents(GDK_DISPLAY(), sp->font, &sp->glyph, 1, &info);
84 - if (info.width && info.height) {
85 - // If we get here it means we found a drawable glyph. We will
86 - // Draw all the remaining glyphs and then break out of the loop
87 - XftDrawGlyphFontSpec(mDraw, mColor, mSpecBuffer+i, mSpecPos-i);
89 + // There are two Xft problems to work around here:
90 + // 1. Some Xft libraries reportedly crash if none of the
91 + // glyphs have any area.
92 + // 2. Because of an apparent X server bug (see bug 252033),
93 + // a glyph with no area may cause all following glyphs to be
94 + // dropped under some circumstances.
95 + // For this reason, we manually ship out blocks of glyphs with
96 + // area and skip blocks of glyphs with no area.
98 + while (start < mSpecPos) {
100 + for (i = start; i < mSpecPos; i++) {
101 + XftGlyphFontSpec *sp = &mSpecBuffer[i];
103 + XftGlyphExtents(GDK_DISPLAY(), sp->font, &sp->glyph, 1, &info);
104 + if (!info.width || !info.height)
108 + XftDrawGlyphFontSpec(mDraw, mColor, mSpecBuffer+start, i-start);