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 id27615
push userkwierso@gmail.com
push dateWed, 08 Oct 2014 23:37:42 +0000
treeherdermozilla-central@7b16babf6a73 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmontagu
bugs1074735
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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;