[Tizen] Added new variation sequence generation rule 13/317913/1
authorBowon Ryu <bowon.ryu@samsung.com>
Thu, 9 Jan 2025 06:52:43 +0000 (15:52 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Thu, 9 Jan 2025 12:05:02 +0000 (21:05 +0900)
Splits the sequence of variation emojis more clearly.

Change-Id: I18f84ce365294158a16d9e37ed3df17a9c1e73d7
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
dali-toolkit/internal/text/emoji-helper.cpp

index cce3f74a08c9f0e052920d78d612865f3e2a4ec2..0000bdde1c0a4b59d9ba5adeece0d76b6c11856b 100644 (file)
@@ -132,9 +132,28 @@ bool IsNewVariationSelectorSequence(const Character* const         textBuffer,
           isNewVariationSelectorSequence = currentRunScript != TextAbstraction::EMOJI_TEXT;
           currentCharacterScript         = TextAbstraction::EMOJI_TEXT;
         }
-
+        else if(!TextAbstraction::IsZeroWidthJoiner(characterVS))
+        {
+          // Start of a new sequence if the next glyph is not a variation selector or zwj.
+          isNewVariationSelectorSequence = true;
+        }
       } // if(!isNewVariationSelectorSequence && currentCharacterIndex + 1 <= lastCharacterIndex)
     }   // if(TextAbstraction::IsEmojiVariationSequences(currentCharacter))
+    else if(!TextAbstraction::IsEmojiPresentationSelector(currentCharacter) &&
+            !TextAbstraction::IsTextPresentationSelector(currentCharacter) &&
+            !TextAbstraction::IsZeroWidthJoiner(currentCharacter) &&
+            !TextAbstraction::IsEmojiModifier(currentCharacter))
+    {
+      if(currentCharacterIndex > 0)
+      {
+        Character prevCharacter = *(textBuffer + currentCharacterIndex - 1);
+        if(TextAbstraction::IsEmojiVariationSequences(prevCharacter))
+        {
+          // The end of a variation sequence, start of a new sequence.
+          isNewVariationSelectorSequence = true;
+        }
+      }
+    }
   }     // if(currentCharacterIndex < lastCharacterIndex)
 
   return isNewVariationSelectorSequence;