From 30b9f327d3554e3f48f0cd2e46b63a0fcd948606 Mon Sep 17 00:00:00 2001 From: Roozbeh Pournader Date: Mon, 13 Feb 2017 15:33:47 -0800 Subject: [PATCH] Add U+202F NARROW NO-BREAK SPACE to the sticky white list Mongolian fonts need to shape across U+202F NARROW NO-BREAK SPACE (NNBSP). But if the first font in the fallback chain supports NNBSP, it would break Mongolian shaping since the text would be broken into three font runs. By making NNBSP sticky, we make sure Mongolian text is kept in one font run and is shaped properly. See http://www.unicode.org/L2/L2017/17036-mongolian-suffix.pdf for background. The proposed character in the proposal was not accepted for encoding by the Unicode Techincal Committee, but the document explains in more detail why this change in needed. Bug: 34344220 Test: manual Change-Id: I344a63f383fa5485875603570025eac3c4eb2574 --- engine/src/flutter/libs/minikin/FontCollection.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/engine/src/flutter/libs/minikin/FontCollection.cpp b/engine/src/flutter/libs/minikin/FontCollection.cpp index fbcf1d72b1..9d0e2c8b38 100644 --- a/engine/src/flutter/libs/minikin/FontCollection.cpp +++ b/engine/src/flutter/libs/minikin/FontCollection.cpp @@ -325,19 +325,21 @@ FontFamily* FontCollection::getFamilyForChar(uint32_t ch, uint32_t vs, return bestFamily; } -const uint32_t NBSP = 0xa0; -const uint32_t ZWJ = 0x200c; -const uint32_t ZWNJ = 0x200d; +const uint32_t NBSP = 0xA0; +const uint32_t ZWJ = 0x200C; +const uint32_t ZWNJ = 0x200D; const uint32_t HYPHEN = 0x2010; const uint32_t NB_HYPHEN = 0x2011; +const uint32_t NNBSP = 0x202F; const uint32_t FEMALE_SIGN = 0x2640; const uint32_t MALE_SIGN = 0x2642; const uint32_t STAFF_OF_AESCULAPIUS = 0x2695; // Characters where we want to continue using existing font run instead of // recomputing the best match in the fallback list. -static const uint32_t stickyWhitelist[] = { '!', ',', '-', '.', ':', ';', '?', NBSP, ZWJ, ZWNJ, - HYPHEN, NB_HYPHEN, FEMALE_SIGN, MALE_SIGN, STAFF_OF_AESCULAPIUS }; +static const uint32_t stickyWhitelist[] = { + '!', ',', '-', '.', ':', ';', '?', NBSP, ZWJ, ZWNJ, + HYPHEN, NB_HYPHEN, NNBSP, FEMALE_SIGN, MALE_SIGN, STAFF_OF_AESCULAPIUS }; static bool isStickyWhitelisted(uint32_t c) { for (size_t i = 0; i < sizeof(stickyWhitelist) / sizeof(stickyWhitelist[0]); i++) {