Merge "Fixed Docomo Issue - to prevent to display '. ' character as first character...
authorYunji Park <yunji19.park@samsung.com>
Fri, 26 Apr 2013 05:56:10 +0000 (14:56 +0900)
committerGerrit Code Review <gerrit2@kim11>
Fri, 26 Apr 2013 05:56:10 +0000 (14:56 +0900)
src/graphics/inc/FGrp_TextCommon.h
src/graphics/inc/FGrp_TextTextSimple.h
src/graphics/text/FGrp_TextTextSimple.cpp

index 01140d3..f94d575 100644 (file)
@@ -210,6 +210,8 @@ static const unsigned short TEXT_ABBREV_CHARACTER = 0x2026;
 static const unsigned short TEXT_LINE_SEPARATOR = 0x2028;
 static const unsigned short TEXT_PARAGRAPH_SEPARATOR = 0x2029;
 static const unsigned short TEXT_TAB_CHARACTER = 0x09;
+static const unsigned short TEXT_JAPANESE_DOT = 0x3001;
+static const unsigned short TEXT_JAPANESE_COMMA = 0x3002;
 
 }}} // Tizen::Graphics::_Text
 
index b566f54..979b863 100644 (file)
@@ -139,6 +139,8 @@ private:
 
        bool IsChinese(const wchar_t* ch) const;
 
+       bool IsJapanese(const wchar_t* ch) const;
+
        int GetSentenceLength(const wchar_t* pText, int textLength, int& actualLength) const;
 
        int GetWordWrapLength(const wchar_t* pText, int textLength, int& actualLength) const;
index b15006f..f6e2b7a 100644 (file)
@@ -376,6 +376,22 @@ TextSimple::IsChinese(const wchar_t* ch) const
        return false;
 }
 
+bool
+TextSimple::IsJapanese(const wchar_t* ch) const
+{
+       if (0x3040 <= *ch && *ch <= 0x309F)
+       {
+               return true;
+       }
+
+       if (0x30A0 <= *ch && *ch <= 0x30FF)
+       {
+               return true;
+       }
+
+       return false;
+}
+
 result
 TextSimple::GetRegion(int textIndex, int textLength, int& width, int& height) const
 {
@@ -1019,6 +1035,7 @@ TextSimple::GetWordWrapLengthEx(const wchar_t* pText, int textLength, int& actua
                pText++;
        }
 
+       bool hasFirstDot = false;
        int length = textLength;
        actualLength = textLength;
 
@@ -1032,6 +1049,12 @@ TextSimple::GetWordWrapLengthEx(const wchar_t* pText, int textLength, int& actua
                return TEXT_RETBY_NORMAL;
        }
 
+       if ((*pText == TEXT_JAPANESE_DOT || *pText == TEXT_JAPANESE_COMMA)
+               && (IsChinese(pLastCharacter) || IsJapanese(pLastCharacter)))
+       {
+               hasFirstDot = true;
+       }
+
        if (*pText == TEXT_OBJ_CHARACTER)
        {
                return TEXT_RETBY_NORMAL;
@@ -1101,6 +1124,11 @@ TextSimple::GetWordWrapLengthEx(const wchar_t* pText, int textLength, int& actua
 
        if (actualLength == 0)
        {
+               if (hasFirstDot == true)
+               {
+                       actualLength = textLength - 1;
+               }
+
                return TEXT_RETBY_LIMITLENGTH;
        }