From 9020a7fa7eb5ee68b2cda692e1eac7e736bf24fa Mon Sep 17 00:00:00 2001 From: Yunji Park Date: Fri, 26 Apr 2013 14:41:01 +0900 Subject: [PATCH] Fixed Docomo Issue - to prevent to display '. ' character as first character of the line Change-Id: Ib4848a2a50b4e348fc56916aaa7452c4a338c3b4 --- src/graphics/inc/FGrp_TextCommon.h | 2 ++ src/graphics/inc/FGrp_TextTextSimple.h | 2 ++ src/graphics/text/FGrp_TextTextSimple.cpp | 28 ++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/src/graphics/inc/FGrp_TextCommon.h b/src/graphics/inc/FGrp_TextCommon.h index 01140d3..f94d575 100644 --- a/src/graphics/inc/FGrp_TextCommon.h +++ b/src/graphics/inc/FGrp_TextCommon.h @@ -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 diff --git a/src/graphics/inc/FGrp_TextTextSimple.h b/src/graphics/inc/FGrp_TextTextSimple.h index b566f54..979b863 100644 --- a/src/graphics/inc/FGrp_TextTextSimple.h +++ b/src/graphics/inc/FGrp_TextTextSimple.h @@ -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; diff --git a/src/graphics/text/FGrp_TextTextSimple.cpp b/src/graphics/text/FGrp_TextTextSimple.cpp index b15006f..f6e2b7a 100644 --- a/src/graphics/text/FGrp_TextTextSimple.cpp +++ b/src/graphics/text/FGrp_TextTextSimple.cpp @@ -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; } -- 2.7.4