зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1115916 - Improve synthetic vertical metrics for fonts that don't have actual vhea/vmtx tables. r=smontagu
This commit is contained in:
Родитель
2cef5d1c88
Коммит
ff9f031360
|
@ -3403,14 +3403,19 @@ gfxFont::CreateVerticalMetrics()
|
|||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче