From ac3844c916eea3eee45212245c7b0f5364bb59fa Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 18 Dec 2017 15:02:16 -0800 Subject: [PATCH] Revert "libtxt: Restore code that had been disabled due to older versions of ICU and HarfBuzz (#4456)" (flutter/engine#4474) This reverts commit 041deb64dcb3c26856e56bcadd1c938edd0d2691. Fuchsia is still pinned to ICU version 57, which doesn't have these APIs --- .../txt/src/minikin/GraphemeBreak.cpp | 32 +++++++++---------- .../txt/src/minikin/HbFontCache.cpp | 11 ++++--- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/engine/src/flutter/third_party/txt/src/minikin/GraphemeBreak.cpp b/engine/src/flutter/third_party/txt/src/minikin/GraphemeBreak.cpp index 7e90735253..6a7775a9e6 100644 --- a/engine/src/flutter/third_party/txt/src/minikin/GraphemeBreak.cpp +++ b/engine/src/flutter/third_party/txt/src/minikin/GraphemeBreak.cpp @@ -113,7 +113,8 @@ bool GraphemeBreak::isGraphemeBreak(const float* advances, return false; } // Rule GB9, x (Extend | ZWJ); Rule GB9a, x SpacingMark; Rule GB9b, Prepend x - if (p2 == U_GCB_EXTEND || p2 == U_GCB_ZWJ || p2 == U_GCB_SPACING_MARK || + // TODO(abarth): Add U_GCB_ZWJ once we update ICU. + if (p2 == U_GCB_EXTEND || /* p2 == U_GCB_ZWJ || */ p2 == U_GCB_SPACING_MARK || p1 == U_GCB_PREPEND) { return false; } @@ -157,26 +158,25 @@ bool GraphemeBreak::isGraphemeBreak(const float* advances, } } + // TODO(abarth): Enablet his code once we update ICU. // Tailored version of Rule GB11, ZWJ × (Glue_After_Zwj | EBG) // We try to make emoji sequences with ZWJ a single grapheme cluster, but only // if they actually merge to one cluster. So we are more relaxed than the UAX // #29 rules in accepting any emoji character after the ZWJ, but are tighter // in that we only treat it as one cluster if a ligature is actually formed - // and we also require the character before the ZWJ to also be an emoji. - if (p1 == U_GCB_ZWJ && isEmoji(c2) && offset_back > start) { - // look at character before ZWJ to see that both can participate in an - // emoji zwj sequence - uint32_t c0 = 0; - size_t offset_backback = offset_back; - U16_PREV(buf, start, offset_backback, c0); - if (c0 == 0xFE0F && offset_backback > start) { - // skip over emoji variation selector - U16_PREV(buf, start, offset_backback, c0); - } - if (isEmoji(c0)) { - return false; - } - } + // and we also require the character before the ZWJ to also be an emoji. if + // (p1 == U_GCB_ZWJ && isEmoji(c2) && offset_back > start) { + // // look at character before ZWJ to see that both can participate in an + // emoji zwj sequence uint32_t c0 = 0; size_t offset_backback = + // offset_back; U16_PREV(buf, start, offset_backback, c0); if (c0 == + // 0xFE0F && offset_backback > start) { + // // skip over emoji variation selector + // U16_PREV(buf, start, offset_backback, c0); + // } + // if (isEmoji(c0)) { + // return false; + // } + // } // Tailored version of Rule GB12 and Rule GB13 that look at even-odd cases. // sot (RI RI)* RI x RI diff --git a/engine/src/flutter/third_party/txt/src/minikin/HbFontCache.cpp b/engine/src/flutter/third_party/txt/src/minikin/HbFontCache.cpp index d60fcc7373..a78ee7a0d3 100644 --- a/engine/src/flutter/third_party/txt/src/minikin/HbFontCache.cpp +++ b/engine/src/flutter/third_party/txt/src/minikin/HbFontCache.cpp @@ -103,11 +103,12 @@ hb_font_t* getHbFontLocked(const MinikinFont* minikinFont) { hb_font_set_scale(parent_font, upem, upem); font = hb_font_create_sub_font(parent_font); - std::vector variations; - for (const FontVariation& variation : minikinFont->GetAxes()) { - variations.push_back({variation.axisTag, variation.value}); - } - hb_font_set_variations(font, variations.data(), variations.size()); + // TODO(abarth): Enable this code once we update harfbuzz. + // std::vector variations; + // for (const FontVariation& variation : minikinFont->GetAxes()) { + // variations.push_back({variation.axisTag, variation.value}); + // } + // hb_font_set_variations(font, variations.data(), variations.size()); hb_font_destroy(parent_font); hb_face_destroy(face); fontCache->put(fontId, font);