From c985e0ecb59c262d51eb35ce7f06327883914108 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Sat, 21 May 2016 12:28:21 +0100 Subject: [PATCH] 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 --- gfx/thebes/gfxTextRun.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp index f0af2e9feb1c..3ef8325713a2 100644 --- a/gfx/thebes/gfxTextRun.cpp +++ b/gfx/thebes/gfxTextRun.cpp @@ -2637,10 +2637,12 @@ gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh, uint32_t aNextCh, Script aRunScript, gfxFont *aPrevMatchedFont, 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 + // If the char is a cluster extender or NNBSP, 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) && + const uint32_t NARROW_NO_BREAK_SPACE = 0x202f; + if (aPrevMatchedFont && + (IsClusterExtender(aCh) || aCh == NARROW_NO_BREAK_SPACE) && aPrevMatchedFont->HasCharacter(aCh)) { RefPtr ret = aPrevMatchedFont; return ret.forget();