Bug 475968. Add padding pixels to loose ink bounds on Windows because of ClearType pixel bleed. r=roc

--HG--
extra : rebase_source : 552a9133411389dd151d2cb04e5b79370ec182d4
This commit is contained in:
Jonathan Kew 2009-04-10 13:22:54 +12:00
Родитель cd71c6c047
Коммит 51157544df
1 изменённых файлов: 18 добавлений и 2 удалений

Просмотреть файл

@ -1138,8 +1138,24 @@ gfxWindowsFont::Measure(gfxTextRun *aTextRun,
}
}
return gfxFont::Measure(aTextRun, aStart, aEnd,
aBoundingBoxType, aRefContext, aSpacing);
gfxFont::RunMetrics metrics = gfxFont::Measure(aTextRun, aStart, aEnd,
aBoundingBoxType, aRefContext,
aSpacing);
// if aBoundingBoxType is LOOSE_INK_EXTENTS
// and the underlying cairo font may be antialiased,
// we can't trust Windows to have considered all the pixels
// so we need to add "padding" to the bounds.
// (see bugs 475968, 439831, compare also bug 445087)
if (aBoundingBoxType == LOOSE_INK_EXTENTS &&
mAntialiasOption != CAIRO_ANTIALIAS_NONE &&
metrics.mBoundingBox.size.width > 0) {
const PRUint32 appUnitsPerDevUnit = aTextRun->GetAppUnitsPerDevUnit();
metrics.mBoundingBox.pos.x -= appUnitsPerDevUnit;
metrics.mBoundingBox.size.width += 3 * appUnitsPerDevUnit;
}
return metrics;
}
FontEntry*