Bug 1082083 - Apply division to the y-coordinate only, not to the point as a whole. r=jdaggett
authorJonathan Kew <jkew@mozilla.com>
Tue, 14 Oct 2014 20:56:08 +0100
changeset 210446 12c7a993e3ad2943240b50ebadaf8c02de525a39
parent 210445 1d5c4859fa41f6cf715c148c4188c69b8e3029b0
child 210447 c3099024c40a418bdfd18b0ba291cc220f38a9fe
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersjdaggett
bugs1082083
milestone36.0a1
Bug 1082083 - Apply division to the y-coordinate only, not to the point as a whole. r=jdaggett
dom/canvas/CanvasRenderingContext2D.cpp
gfx/thebes/gfxFont.cpp
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -3199,17 +3199,17 @@ struct MOZ_STACK_CLASS CanvasBidiProcess
         // in the font, and adjust accordingly.
         // (The same will be true for HTML text layout.)
         const gfxFont::Metrics& metrics = mTextRun->GetFontGroup()->
           GetFirstValidFont()->GetMetrics(gfxFont::eHorizontal);
         mCtx->mTarget->SetTransform(mCtx->mTarget->GetTransform().Copy().
           PreTranslate(baselineOrigin).      // translate origin for rotation
           PreRotate(gfx::Float(M_PI / 2.0)). // turn 90deg clockwise
           PreTranslate(-baselineOrigin).     // undo the translation
-          PreTranslate(Point(0, metrics.emAscent - metrics.emDescent) / 2));
+          PreTranslate(Point(0, (metrics.emAscent - metrics.emDescent) / 2)));
                               // and offset the (alphabetic) baseline of the
                               // horizontally-shaped text from the (centered)
                               // default baseline used for vertical
       }
 
       RefPtr<GlyphRenderingOptions> renderingOptions = font->GetGlyphRenderingOptions();
 
       GlyphBuffer buffer;
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -1899,17 +1899,17 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint
         // vertical baseline). The adjustment here is somewhat ad hoc; we
         // should eventually look for baseline tables[1] in the fonts and use
         // those if available.
         // [1] http://www.microsoft.com/typography/otspec/base.htm
         aRunParams.context->SetMatrix(aRunParams.context->CurrentMatrix().
             Translate(p).       // translate origin for rotation
             Rotate(M_PI / 2.0). // turn 90deg clockwise
             Translate(-p).      // undo the translation
-            Translate(gfxPoint(0, metrics.emAscent - metrics.emDescent) / 2));
+            Translate(gfxPoint(0, (metrics.emAscent - metrics.emDescent) / 2)));
                                 // and offset the (alphabetic) baseline of the
                                 // horizontally-shaped text from the (centered)
                                 // default baseline used for vertical
     }
 
     nsAutoPtr<gfxTextContextPaint> contextPaint;
     if (fontParams.haveSVGGlyphs && !fontParams.contextPaint) {
         // If no pattern is specified for fill, use the current pattern