Dear all,

While performing some test about Mozilla Bugzilla Bug #187377 [1], I
found that XRenderCompositeText16 function in Render extension does
not draw text as intended when multiple glyphsets are involved in one
call.

According to the code of the Render extension on X server side,
XRenderCompositeText16 should send a "glyphset-switch sign" (a glyph
element with len = 0xff) to the X server when it encounters a glyph
element whose glyphset is different from the one of the previous glyph
element.  However, it actually sends the glyphset-switch sign when it
encounters a glyph element whose glyphset is different from the one of
the _first_ glyph element.  XRenderCompositeText{8,32} probably have
the same problem.

On my environment (FreeBSD 4.7-RELEASE-p4, XFree86 4.2.1 and Mozilla
1.2.1 with Japanese Language Pack with xft enabled), the attached
patch (against XFree86 4.2.1 release) corrected this behavior, and
solved part of Bug #187377.  I will be glad if anyone tests it or
gives comment on it.  Thank you in advance.

[1] Mozilla Bugzilla Bug #187377: Characters disappear with xft if
    fallback triggered twice on the same line
    http://bugzilla.mozilla.org/show_bug.cgi?id=187377

Best regards,
Tsuyoshi

---   ITO Tsuyoshi  <[EMAIL PROTECTED]>   ---
--- Dept. of Computer Science, University of Tokyo. ---
--- lib/Xrender/Glyph.c.orig    Thu Dec 27 10:16:00 2001
+++ lib/Xrender/Glyph.c Wed Feb 19 05:29:36 2003
@@ -421,7 +421,7 @@
     
     for (i = 0; i < nelt; i++)
     {
-       if (elts[i].glyphset != req->glyphset)
+       if (i != 0 && elts[i].glyphset != elts[i - 1].glyphset)
            len += (SIZEOF (xGlyphElt) + 4) >> 2;
        nchars = elts[i].nchars;
        /*
@@ -447,7 +447,7 @@
        /*
         * Switch glyphsets
         */
-       if (elts[i].glyphset != req->glyphset)
+       if (i != 0 && elts[i].glyphset != elts[i - 1].glyphset)
        {
            BufAlloc (xGlyphElt *, elt, SIZEOF (xGlyphElt));
            elt->len = 0xff;
@@ -523,7 +523,7 @@
     
     for (i = 0; i < nelt; i++)
     {
-       if (elts[i].glyphset != req->glyphset)
+       if (i != 0 && elts[i].glyphset != elts[i - 1].glyphset)
            len += (SIZEOF (xGlyphElt) + 4) >> 2;
        nchars = elts[i].nchars;
        /*
@@ -549,7 +549,7 @@
        /*
         * Switch glyphsets
         */
-       if (elts[i].glyphset != req->glyphset)
+       if (i != 0 && elts[i].glyphset != elts[i - 1].glyphset)
        {
            BufAlloc (xGlyphElt *, elt, SIZEOF (xGlyphElt));
            elt->len = 0xff;
@@ -625,7 +625,7 @@
     
     for (i = 0; i < nelt; i++)
     {
-       if (elts[i].glyphset != req->glyphset)
+       if (i != 0 && elts[i].glyphset != elts[i - 1].glyphset)
            len += (SIZEOF (xGlyphElt) + 4) >> 2;
        nchars = elts[i].nchars;
        elen = SIZEOF(xGlyphElt) * ((nchars + MAX_32) / MAX_32) + nchars *4;
@@ -646,7 +646,7 @@
        /*
         * Switch glyphsets
         */
-       if (elts[i].glyphset != req->glyphset)
+       if (i != 0 && elts[i].glyphset != elts[i - 1].glyphset)
        {
            BufAlloc (xGlyphElt *, elt, SIZEOF (xGlyphElt));
            elt->len = 0xff;

Reply via email to