Bug 1074735 pt 1 - Use more sensible values for underline and strikeout position in vertical font metrics. r=smontagu
authorJonathan Kew <jkew@mozilla.com>
Wed, 08 Oct 2014 10:32:53 +0100
changeset 209361 b03b61e976fbd87642484a5d1a30ff33e99acaa5
parent 209360 72a705b53e7581e086ee7b4281fad9d45ffd2382
child 209362 9c8f4a869327122f7be19fccefbdb0eb992c40d2
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerssmontagu
bugs1074735
milestone35.0a1
Bug 1074735 pt 1 - Use more sensible values for underline and strikeout position in vertical font metrics. r=smontagu
gfx/thebes/gfxFont.cpp
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -3426,21 +3426,20 @@ gfxFont::CreateVerticalMetrics()
     // come up with for aveCharWidth.
     metrics->maxAdvance = std::max(metrics->maxAdvance, metrics->aveCharWidth);
 
     // Thickness of underline and strikeout may have been read from tables,
     // but in case they were not present, ensure a minimum of 1 pixel.
     // We synthesize our own positions, as font metrics don't provide these
     // for vertical layout.
     metrics->underlineSize = std::max(1.0, metrics->underlineSize);
-    metrics->underlineOffset = 0; // XXX to be adjusted
+    metrics->underlineOffset = - metrics->maxDescent - metrics->underlineSize;
 
     metrics->strikeoutSize = std::max(1.0, metrics->strikeoutSize);
-    metrics->strikeoutOffset =
-        metrics->maxDescent - 0.5 * metrics->strikeoutSize;
+    metrics->strikeoutOffset = - 0.5 * metrics->strikeoutSize;
 
     // Somewhat arbitrary values for now, subject to future refinement...
     metrics->spaceWidth = metrics->aveCharWidth;
     metrics->zeroOrAveCharWidth = metrics->aveCharWidth;
     metrics->maxHeight = metrics->maxAscent + metrics->maxDescent;
     metrics->xHeight = metrics->emHeight / 2;
 
     return metrics;