Added ZWJ sequence to solve the issue of ZWJ not working.
this patch processes ZWJ as one sequnce.
and this condition has been merged with the previous emoji logic.
Added exception handling in editable environment.
Removed unnecessary variables related to emoji.
Change-Id: Id7825732d96c3e87a8c93b6c2e8d57e057eb7435
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
if(index < mEventData->mPrimaryCursorPosition)
{
if(index < mEventData->mPrimaryCursorPosition)
{
- cursorIndex -= numberOfCharacters;
+ cursorIndex = cursorIndex < numberOfCharacters ? 0u : cursorIndex - numberOfCharacters;
- cursorIndex += numberOfCharacters;
+ Length textLength = mModel->mVisualModel->mCharactersToGlyph.Count();
+ cursorIndex = cursorIndex + numberOfCharacters > textLength ? textLength : cursorIndex + numberOfCharacters;
}
// Will update the cursor hook position.
}
// Will update the cursor hook position.
Vector<ScriptRun>::ConstIterator scriptRunEndIt = scripts.End();
bool isNewParagraphCharacter = false;
Vector<ScriptRun>::ConstIterator scriptRunEndIt = scripts.End();
bool isNewParagraphCharacter = false;
- FontId previousEmojiFontId = 0u;
FontId currentFontId = 0u;
FontId previousFontId = 0u;
TextAbstraction::Script previousScript = TextAbstraction::UNKNOWN;
FontId currentFontId = 0u;
FontId previousFontId = 0u;
TextAbstraction::Script previousScript = TextAbstraction::UNKNOWN;
isValidFont = fontClient.IsCharacterSupportedByFont(fontId, character);
}
isValidFont = fontClient.IsCharacterSupportedByFont(fontId, character);
}
- bool isCommonScript = false;
- bool isEmojiScript = TextAbstraction::IsOneOfEmojiScripts(script);
+ bool isEmojiScript = IsEmojiColorScript(script) || IsEmojiTextScript(script);
+ bool isZWJ = TextAbstraction::IsZeroWidthJoiner(character);
- if(isEmojiScript && (previousScript == script))
+ if((previousScript == script) &&
+ (isEmojiScript || isZWJ))
- // Emoji sequence should use the previous emoji font.
- if(0u != previousEmojiFontId)
+ // This sequence should use the previous font.
+ if(0u != previousFontId)
- fontId = previousEmojiFontId;
+ fontId = previousFontId;
+ // This is valid after CheckFontSupportsCharacter();
+ bool isCommonScript = false;
+
// If the given font is not valid, it means either:
// - there is no cached font for the current script yet or,
// - the user has set a different font than the default one for the current script or,
// If the given font is not valid, it means either:
// - there is no cached font for the current script yet or,
// - the user has set a different font than the default one for the current script or,
- // Store the font id when the first character is an emoji.
- if(isEmojiScript)
- {
- if(0u != fontId && previousScript != script)
- {
- previousEmojiFontId = fontId;
- }
- }
- else
- {
- previousEmojiFontId = 0u;
- }
-
#ifdef DEBUG_ENABLED
if(gLogFilter->IsEnabledFor(Debug::Verbose))
{
#ifdef DEBUG_ENABLED
if(gLogFilter->IsEnabledFor(Debug::Verbose))
{
// Whether the current character is a new paragraph character.
isNewParagraphCharacter = TextAbstraction::IsNewParagraph(character);
previousScript = script;
// Whether the current character is a new paragraph character.
isNewParagraphCharacter = TextAbstraction::IsNewParagraph(character);
previousScript = script;
+ currentFontId = fontId;
previousFontId = currentFontId;
} // end traverse characters.
previousFontId = currentFontId;
} // end traverse characters.