Fixed N_SE-52923, incorrect cursor position in RTL
authorcheun.hong <cheun.hong@samsung.com>
Wed, 25 Sep 2013 08:06:31 +0000 (17:06 +0900)
committercheun.hong <cheun.hong@samsung.com>
Wed, 25 Sep 2013 08:06:31 +0000 (17:06 +0900)
Change-Id: Ie26528017762edf5db7f8c76b51a3b5f6cfee551
Signed-off-by: cheun.hong <cheun.hong@samsung.com>
src/graphics/text/FGrp_TextTextLine.cpp
src/graphics/text/FGrp_TextTextUtility.cpp
src/graphics/text/FGrp_TextTextUtility.h

index 8e74ed7..3952a7a 100644 (file)
@@ -26,6 +26,7 @@
 #include "FGrp_TextCommon.h"
 #include "FGrp_TextTextComposite.h"
 #include "FGrp_TextTextLine.h"
+#include "FGrp_TextTextUtility.h"
 #include "FGrp_CoordinateSystemUtils.h"
 
 #include <fribidi.h>
@@ -514,10 +515,18 @@ TextLine::GetTextExtentF(int textIndexFromLineOffset, int textLength) const
 
                pEnum->GetCurrent(currentGap);
 
-               FriBidiChar text[1] = { __pCompositeText->GetCharacter(__textOffset + textIndexFromLineOffset - 1) };
-               FriBidiCharType type[1] = { 0 };
-               fribidi_get_bidi_types(text, 1, type);
-               bool isRtl = (type[0] & FRIBIDI_MASK_RTL) > 0;
+               TextBidiHint bidiHint = _GetTextBidiHint();
+               wchar_t ch = __pCompositeText->GetCharacter(__textOffset + textIndexFromLineOffset - 1);
+               bool isRtl = TextUtility::IsRTLCharacter(ch);
+               bool isLtr = TextUtility::IsLTRCharacter(ch);
+               bool isNeutral = TextUtility::IsNeutralCharacter(ch);
+
+               bool isBidiEnabled = (bidiHint == TEXT_BIDI_HINT_RTL) ? true : false;
+               SysLogException(NID_GRP, E_SUCCESS, "[000] isRtl(%d) isLtr(%d) isNeutral(%d) isBidiEnabled(%d)", isRtl, isLtr, isNeutral, isBidiEnabled);
+
+               isRtl = (!isRtl && !isLtr && isNeutral) ? isBidiEnabled : isRtl;
+
+               SysLogException(NID_GRP, E_SUCCESS, "[111] isRtl(%d) isLtr(%d)", isRtl, isLtr);
 
                extent.x = (isRtl == true) ? currentGap.first : currentGap.second;
                extent.width = 0;
index 440247c..8a655a3 100644 (file)
@@ -473,6 +473,21 @@ TextUtility::IsStrongCharacter(wchar_t ch)
        return false;
 }
 
+bool
+TextUtility::IsNeutralCharacter(wchar_t ch)
+{
+       FriBidiChar text[1] = { ch };
+       FriBidiCharType type[1] = { 0 };
+       fribidi_get_bidi_types(text, 1, type);
+
+       if (type[0] & (FRIBIDI_MASK_NEUTRAL | FRIBIDI_MASK_LETTER))
+       {
+               return true;
+       }
+
+       return false;
+}
+
 float
 TextUtility::Abs(const float t)
 {
index 9671132..3eff43e 100644 (file)
@@ -79,6 +79,8 @@ public:
 
        static bool IsStrongCharacter(wchar_t ch);
 
+       static bool IsNeutralCharacter(wchar_t ch);
+
        static float Abs(const float t);
 
        static const float Min(const float a, const float b);