Bug 1273154 - Avoid breaking a font run at U+202F (NNBSP) if possible, because Mongolian shaping depends on the text run continuing across it. r=jrmuizel

This commit is contained in:
Jonathan Kew 2016-05-21 12:28:21 +01:00
Родитель 790ccce521
Коммит c985e0ecb5
1 изменённых файлов: 5 добавлений и 3 удалений

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

@ -2637,10 +2637,12 @@ gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh, uint32_t aNextCh,
Script aRunScript, gfxFont *aPrevMatchedFont, Script aRunScript, gfxFont *aPrevMatchedFont,
uint8_t *aMatchType) uint8_t *aMatchType)
{ {
// If the char is a cluster extender, we want to use the same font // If the char is a cluster extender or NNBSP, we want to use the same
// as the preceding character if possible. This is preferable to using // font as the preceding character if possible. This is preferable to using
// the font group because it avoids breaks in shaping within a cluster. // the font group because it avoids breaks in shaping within a cluster.
if (aPrevMatchedFont && IsClusterExtender(aCh) && const uint32_t NARROW_NO_BREAK_SPACE = 0x202f;
if (aPrevMatchedFont &&
(IsClusterExtender(aCh) || aCh == NARROW_NO_BREAK_SPACE) &&
aPrevMatchedFont->HasCharacter(aCh)) { aPrevMatchedFont->HasCharacter(aCh)) {
RefPtr<gfxFont> ret = aPrevMatchedFont; RefPtr<gfxFont> ret = aPrevMatchedFont;
return ret.forget(); return ret.forget();