author | Jonathan Kew <jkew@mozilla.com> |
Tue, 06 Jan 2015 20:56:02 +0000 | |
changeset 222267 | d260f281dfe6dc46fb7398f86e5ed77d1f5ebf45 |
parent 222266 | 67960aabce3a3bbd721fe910060d0a418123c84b |
child 222268 | 6536d9885d2e2cc7fab98f5518fb23ad5e1251cf |
push id | 28061 |
push user | kwierso@gmail.com |
push date | Wed, 07 Jan 2015 03:24:49 +0000 |
treeherder | mozilla-central@33781a3a5201 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | smontagu |
bugs | 1115916 |
milestone | 37.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
|
--- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -3398,24 +3398,29 @@ gfxFont::CreateVerticalMetrics() gfxFontEntry::AutoTable os2Table(mFontEntry, kOS_2TableTag); if (os2Table && mFUnitsConvFactor > 0.0) { const OS2Table *os2 = reinterpret_cast<const OS2Table*>(hb_blob_get_data(os2Table, &len)); // These fields should always be present in any valid OS/2 table if (len >= offsetof(OS2Table, sTypoLineGap) + sizeof(int16_t)) { SET_SIGNED(strikeoutSize, os2->yStrikeoutSize); - SET_SIGNED(aveCharWidth, int16_t(os2->sTypoAscender) - - int16_t(os2->sTypoDescender)); - metrics->maxAscent = - std::max(metrics->maxAscent, int16_t(os2->xAvgCharWidth) * - gfxFloat(mFUnitsConvFactor)); - metrics->maxDescent = - std::max(metrics->maxDescent, int16_t(os2->xAvgCharWidth) * - gfxFloat(mFUnitsConvFactor)); + // Use ascent+descent from the horizontal metrics as the default + // advance (aveCharWidth) in vertical mode + gfxFloat ascentDescent = gfxFloat(mFUnitsConvFactor) * + (int16_t(os2->sTypoAscender) - int16_t(os2->sTypoDescender)); + metrics->aveCharWidth = + std::max(metrics->emHeight, ascentDescent); + // Use xAvgCharWidth from horizontal metrics as minimum font extent + // for vertical layout, applying half of it to ascent and half to + // descent (to work with a default centered baseline). + gfxFloat halfCharWidth = + int16_t(os2->xAvgCharWidth) * gfxFloat(mFUnitsConvFactor) / 2; + metrics->maxAscent = std::max(metrics->maxAscent, halfCharWidth); + metrics->maxDescent = std::max(metrics->maxDescent, halfCharWidth); } } // If we didn't set aveCharWidth from OS/2, try to read 'hhea' metrics // and use the line height from its ascent/descent. if (!metrics->aveCharWidth) { gfxFontEntry::AutoTable hheaTable(mFontEntry, kHheaTableTag); if (hheaTable && mFUnitsConvFactor > 0.0) {