bug 772640 - fix for incorrect glyph positioning in multi-glyph RTL clusters generated by Graphite shaping. r=jdaggett
authorJonathan Kew <jkew@mozilla.com>
Mon, 22 Oct 2012 08:47:03 +0100
changeset 111147 dfdc5378bf097bd3a321912aa4c127693f0c1a72
parent 111146 0e76a54aab6fd0136d82d7e372d59a8e469e8f47
child 111148 57cd42e7b249477c1159b1ec5c1f47d512de1841
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjdaggett
bugs772640
milestone19.0a1
bug 772640 - fix for incorrect glyph positioning in multi-glyph RTL clusters generated by Graphite shaping. r=jdaggett
gfx/thebes/gfxGraphiteShaper.cpp
--- a/gfx/thebes/gfxGraphiteShaper.cpp
+++ b/gfx/thebes/gfxGraphiteShaper.cpp
@@ -335,17 +335,19 @@ gfxGraphiteShaper::SetGlyphsFromSegment(
                 gfxShapedWord::DetailedGlyph* d = details.AppendElement();
                 d->mGlyphID = gids[j];
                 d->mYOffset = -yLocs[j] * dev2appUnits;
                 if (j == c.baseGlyph) {
                     d->mXOffset = 0;
                     d->mAdvance = appAdvance;
                     clusterLoc = xLocs[j];
                 } else {
-                    d->mXOffset = (xLocs[j] - clusterLoc - adv) * dev2appUnits;
+                    d->mXOffset = dev2appUnits *
+                        (rtl ? (xLocs[j] - clusterLoc) :
+                               (xLocs[j] - clusterLoc - adv));
                     d->mAdvance = 0;
                 }
             }
             gfxShapedWord::CompressedGlyph g;
             g.SetComplex(aShapedWord->IsClusterStart(offs),
                          true, details.Length());
             aShapedWord->SetGlyphs(offs, g, details.Elements());
         }