Bug 1130429 - Try to avoid font changes within a cluster. r=roc

This commit is contained in:
Jonathan Kew 2015-02-07 20:45:06 +00:00
Родитель 237682e666
Коммит 34d9d8895f
1 изменённых файлов: 9 добавлений и 0 удалений

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

@ -2642,6 +2642,15 @@ gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh, uint32_t aNextCh,
int32_t aRunScript, gfxFont *aPrevMatchedFont, int32_t aRunScript, gfxFont *aPrevMatchedFont,
uint8_t *aMatchType) uint8_t *aMatchType)
{ {
// If the char is a cluster extender, we want to use the same font
// as the preceding character if possible. This is preferable to using
// the font group because it avoids breaks in shaping within a cluster.
if (aPrevMatchedFont && IsClusterExtender(aCh) &&
aPrevMatchedFont->HasCharacter(aCh)) {
nsRefPtr<gfxFont> ret = aPrevMatchedFont;
return ret.forget();
}
// To optimize common cases, try the first font in the font-group // To optimize common cases, try the first font in the font-group
// before going into the more detailed checks below // before going into the more detailed checks below
uint32_t nextIndex = 0; uint32_t nextIndex = 0;