Stop using hb_buffer_set_invisible_glyph when Shape 66/277666/5
authorssabah <s.sabah@samsung.com>
Tue, 12 Jul 2022 01:27:14 +0000 (04:27 +0300)
committershrouq Sabah <s.sabah@samsung.com>
Mon, 18 Jul 2022 13:02:58 +0000 (13:02 +0000)
Fix: Emoji character with VS15 at the end of line produces noise

hb_buffer_set_invisible_glyph has been used to solve the invisible unicodes like U+FE0F and U+FE0E.
They should be replaced by zero width glyph.
i.e: This text "&#x262a;&#xfe0f;&#xfe0f;&#xfe0f;&#x262a;&#xfe0f;" should be rendered as two adjacent glyphs.

But, using this function with ZWS produce a noise (un-wanted glyph) when compine "Negative Squared Latin Capital Letter" with U+FE0E at the end of line.
i.e: Like this text "&#x1f170;&#xfe0e;"

Using hb_buffer_set_invisible_glyph has been stopped because the original issue was resolved by other modifications.
Maybe the optimization code has resolved the original issue.

Sample code:

std::string textAtoE = "&#x1f170;&#xfe0e;";

TextLabel textLabel01 = TextLabel::New(textAtoE);
textLabel01.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
textLabel01.SetProperty(Dali::Actor::Property::POSITION, Vector2(10, 40));
textLabel01.SetProperty(Dali::Toolkit::TextLabel::Property::ENABLE_MARKUP, true);
textLabel01.SetProperty(Dali::Toolkit::TextLabel::Property::MULTI_LINE, true);
textLabel01.SetProperty(Dali::Toolkit::TextLabel::Property::ELLIPSIS, false);

Also try, to make sure there is not extra spaces
std::string textAtoE    = "&#x1f170;&#xfe0f;&#xfe0f;&#xfe0f;&#x1f170;&#xfe0e;";

Change-Id: I6750ff0f3f80f329e5ca3c3d921903809a97748e

dali/internal/text/text-abstraction/shaping-impl.cpp

index f966fd6..75074d5 100644 (file)
@@ -186,6 +186,14 @@ struct Shaping::Plugin
         /* Layout the text */
         hb_buffer_add_utf32(harfBuzzBuffer, text, numberOfCharacters, 0u, numberOfCharacters);
 
+        /*
+         * This code has been stopped because the original issue was resolved by other modifications.
+         * Maybe the optimization code has resolved the original issue.
+
+         * The below code produce a noise (un-wanted glyph) when compine "Negative Squared Latin Capital Letter" with U+FE0E at the end of line.
+         * i.e: Like this text "&#x1f170;&#xfe0e;"
+         */
+        /*
         //The invisible unicodes like U+FE0F and U+FE0E should be replaced by zero width glyph
         //i.e: This text "&#x262a;&#xfe0f;&#xfe0f;&#xfe0f;&#x262a;&#xfe0f;" should be rendered as two adjacent glyphs.
         if(TextAbstraction::IsOneOfEmojiScripts(script))
@@ -194,6 +202,7 @@ struct Shaping::Plugin
           //Applied this only on EMOJI scripts to avoid compatibility issues with other scripts
           hb_buffer_set_invisible_glyph(harfBuzzBuffer, TextAbstraction::GetUnicodeForInvisibleGlyph());
         }
+        */
 
         hb_shape(harfBuzzFont, harfBuzzBuffer, NULL, 0u);