Added to draw ellipsis for bidi
authorYunji Park <yunji19.park@samsung.com>
Thu, 11 Apr 2013 13:30:59 +0000 (22:30 +0900)
committerYunji Park <yunji19.park@samsung.com>
Thu, 11 Apr 2013 14:08:37 +0000 (23:08 +0900)
Change-Id: I0742d650c41f624b05d7c7b39a3f697cb9e42367

src/graphics/text/FGrp_TextTextComposite.cpp
src/graphics/text/FGrp_TextTextComposite.h
src/graphics/text/FGrp_TextTextObject.cpp
src/graphics/text/FGrp_TextTextSimple.cpp
src/graphics/text/FGrp_TextTextSimpleList.cpp
src/graphics/text/FGrp_TextTextUtility.cpp
src/graphics/text/FGrp_TextTextUtility.h

index 3cc4907..055bfb1 100644 (file)
@@ -22,6 +22,7 @@
 
 // Includes
 #include <new>
+#include <fribidi.h>
 #include <FBaseSysLog.h>
 #include <FApp_AppInfo.h>
 #include "FGrp_TextCommon.h"
@@ -685,6 +686,22 @@ TextComposite::Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int st
                SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Fail to move next element.", GetErrorMessage(r));
        }
 
+       if (drawAbbrevText && IsRTL(startTextIndex, textLength))
+       {
+               if (pTextElement->IsBackGroundDrawingModeEnable())
+               {
+                       r = canvasImpl.FillRectangle(pTextElement->GetBackgroundColor(), FloatRectangle(adjustedRect.x, displayRect.y, abbrevTextDim.width, displayRect.height));
+                       SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+               }
+
+               __pAbbrevTextElement->Draw(canvasImpl, adjustedRect, 0, 1, (TextObjectAlignment)(TEXT_OBJECT_ALIGNMENT_TOP | TEXT_OBJECT_ALIGNMENT_LEFT), action);
+
+               adjustedRect.x += abbrevTextDim.width;
+               adjustedRect.width -= abbrevTextDim.width;
+
+               drawAbbrevText = false;
+       }
+
        blockRect = FloatRectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height);
        currentLength = Math::Min(textLength, currentLength);
 
@@ -722,8 +739,561 @@ TextComposite::Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int st
                        DrawBlock(canvasImpl, blockRect, startTextIndex, currentLength, alignment, action);
                }
 
-               pTextElement->Draw(canvasImpl, adjustedRect, textIndexFromElementOffset, currentLength, alignment, action);
-
+               pTextElement->Draw(canvasImpl, adjustedRect, textIndexFromElementOffset, currentLength, alignment, action);
+
+               adjustedRect.x += textSize.width;
+               adjustedRect.width -= textSize.width;
+
+               if (!textLength || adjustedRect.width <= 0)
+               {
+                       break;
+               }
+
+               startTextIndex += currentLength;
+
+               if (pEnum->MoveNext() != E_SUCCESS)
+               {
+                       break;
+               }
+
+               pTextElement = static_cast < TextElement* >(pEnum->GetCurrent());
+               SysTryCatch(NID_GRP, pTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
+
+               textIndexFromElementOffset = pTextElement->GetValue(SET_TEXT_OFFSET);
+               currentLength = Math::Min(textLength, pTextElement->GetTextLength());
+
+               if (currentLength == 0)
+               {
+                       break;
+               }
+       }
+
+       if (drawAbbrevText)
+       {
+               if (pTextElement->IsBackGroundDrawingModeEnable())
+               {
+                       r = canvasImpl.FillRectangle(pTextElement->GetBackgroundColor(), FloatRectangle(adjustedRect.x, displayRect.y, abbrevTextDim.width, displayRect.height));
+                       SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+               }
+
+               __pAbbrevTextElement->Draw(canvasImpl, adjustedRect, 0, 1, (TextObjectAlignment)(TEXT_OBJECT_ALIGNMENT_TOP | TEXT_OBJECT_ALIGNMENT_LEFT), action);
+
+               adjustedRect.x += abbrevTextDim.width;
+               adjustedRect.width -= abbrevTextDim.width;
+       }
+
+       Release(pEnum);
+       return E_SUCCESS;
+
+CATCH:
+       Release(pEnum);
+       return r;
+}
+
+result
+TextComposite::DrawWithEliipsis(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
+                                        const TextObjectActionType action)
+{
+       if (textLength == 0)
+       {
+               return E_SUCCESS;
+       }
+
+       SysTryReturn(NID_GRP, 0 <= startTextIndex && startTextIndex < __length, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+       SysTryReturn(NID_GRP, textLength <= __length, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+       result r = E_SUCCESS;
+       IEnumerator* pEnum = null;
+       TextElement* pTextElement = null;
+       TextElement* pLastDisplayTextElement = null;
+       FloatDimension textSize;
+       FloatDimension spaceCharDim;
+       FloatDimension abbrevTextDim;
+       FloatRectangle adjustedRect = displayRect;
+       FloatRectangle blockRect;
+       int currentLength = 0;
+       int elementTextOffset = 0;
+       int elementIndex = 0;
+       int textIndexFromElementOffset = 0;
+       int headTextLength = 0;
+       int tailTextLength = 0;
+       bool drawAbbrevText = false;
+
+       if (__ignoreRearBlank && __rearSpaceHideMode == TEXT_OBJECT_SPACE_HIDE_TYPE_ONE)
+       {
+               pTextElement = GetElementAtTextIndex(startTextIndex + textLength - 1, elementTextOffset, elementIndex, currentLength, textIndexFromElementOffset);
+               SysTryCatch(NID_GRP, pTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
+
+               const TextSimple* pSimpleText = dynamic_cast <const TextSimple*>(pTextElement);
+               if (pSimpleText != null)
+               {
+                       int length = startTextIndex + textLength - elementTextOffset - 1;
+                       const wchar_t* pText = pSimpleText->GetText();
+                       SysTryReturn(NID_GRP, pText, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text.");
+
+                       SysTryReturn(NID_GRP, length >= 0 && length < pSimpleText->GetTextLength()
+                               , E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] text index(%d) must greater than 0 and must be less than total string length(%d)",length, pSimpleText->GetTextLength());
+
+                       if (pText[length] == (wchar_t)L' ')
+                       {
+                               GetRegion(length + elementTextOffset, 1, spaceCharDim.width, spaceCharDim.height);
+                               textLength--;
+                       }
+               }
+       }
+
+       pTextElement = GetElementAtTextIndex(startTextIndex, elementTextOffset, elementIndex, currentLength, textIndexFromElementOffset);
+       SysTryCatch(NID_GRP, pTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
+
+       if (__ignoreFrontBlank && __frontSpaceHideMode == TEXT_OBJECT_SPACE_HIDE_TYPE_ONE)
+       {
+               const TextSimple* pSimpleText = dynamic_cast <const TextSimple*>(pTextElement);
+               if (pSimpleText != null)
+               {
+                       int index = startTextIndex - elementTextOffset;
+                       const wchar_t* pText = pSimpleText->GetText();
+                       SysTryReturn(NID_GRP, pText, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text.");
+
+                       SysTryReturn(NID_GRP, index >= 0 && index < pSimpleText->GetTextLength()
+                               , E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] text index(%d) must greater than 0 and must be less than total string length(%d)",index, pSimpleText->GetTextLength());
+
+                       if (pText[index] == (wchar_t)L' ')
+                       {
+                               GetRegion(textIndexFromElementOffset, 1, spaceCharDim.width, spaceCharDim.height);
+                               textLength--;
+                               currentLength--;
+                               startTextIndex++;
+                               textIndexFromElementOffset++;
+                       }
+               }
+       }
+
+       GetRegion(startTextIndex, textLength, textSize.width, textSize.height);
+       if (action == TEXT_OBJECT_ACTION_TYPE_ABBREV)
+       {
+               pLastDisplayTextElement = (textLength == 0) ? GetElementAtTextIndex(startTextIndex) : GetElementAtTextIndex(startTextIndex + textLength - 1);
+               SysTryCatch(NID_GRP, pLastDisplayTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
+
+               if (pLastDisplayTextElement->GetType() == TEXT_ELEMENT_TYPE_TEXT)
+               {
+                       TextSimple* pSimpleText = dynamic_cast < TextSimple* >(pLastDisplayTextElement);
+                       SysTryCatch(NID_GRP, pSimpleText, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to cast text element.");
+
+                       SetAbbrevObjectFontInfo(pSimpleText);
+                       __pAbbrevTextElement->GetRegion(0, 1, abbrevTextDim.width, abbrevTextDim.height);
+               }
+
+               ForwardAnalyze(startTextIndex, __length - startTextIndex, adjustedRect.width - abbrevTextDim.width
+                       , TEXT_OBJECT_WRAP_TYPE_CHARACTER, textLength, textSize.width, textSize.height);
+
+               textSize.width += abbrevTextDim.width;
+               currentLength = Math::Min(currentLength, textLength);
+               drawAbbrevText = true;
+       }
+
+       switch (alignment & TEXT_ALIGNMASK_HORIZ)
+       {
+       case TEXT_OBJECT_ALIGNMENT_CENTER:
+               if (textSize.width < adjustedRect.width)
+               {
+                       adjustedRect.x += (adjustedRect.width - textSize.width) / 2;
+               }
+               break;
+
+       case TEXT_OBJECT_ALIGNMENT_RIGHT:
+               if (textSize.width < adjustedRect.width)
+               {
+                       adjustedRect.x += adjustedRect.width - textSize.width;
+               }
+               break;
+
+       case TEXT_OBJECT_ALIGNMENT_LEFT:
+               // fall through
+       default:
+               break;
+       }
+
+       pEnum = __pTextElementList->GetEnumeratorN();
+       for (int i = 0; i <= elementIndex; i++)
+       {
+               r = pEnum->MoveNext();
+               SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Fail to move next element.", GetErrorMessage(r));
+       }
+
+       blockRect = FloatRectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height);
+       currentLength = Math::Min(textLength, currentLength);
+
+       if (drawAbbrevText)
+       {
+               if (IsRTLCharacter(startTextIndex + currentLength))
+               {
+                       headTextLength = SearchLTRTextIndex(startTextIndex, startTextIndex + currentLength) - startTextIndex;
+                       tailTextLength = textLength - headTextLength;
+
+                       if (headTextLength <= 0)
+                       {
+                               if (pLastDisplayTextElement->IsBackGroundDrawingModeEnable())
+                               {
+                                       r = canvasImpl.FillRectangle(pLastDisplayTextElement->GetBackgroundColor(), FloatRectangle(adjustedRect.x, displayRect.y, abbrevTextDim.width, displayRect.height));
+                                       SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+                               }
+
+                               __pAbbrevTextElement->Draw(canvasImpl, adjustedRect, 0, 1, (TextObjectAlignment)(TEXT_OBJECT_ALIGNMENT_TOP | TEXT_OBJECT_ALIGNMENT_LEFT), action);
+
+                               adjustedRect.x += abbrevTextDim.width;
+                               adjustedRect.width -= abbrevTextDim.width;
+
+                               drawAbbrevText = false;
+                       }
+               }
+               else
+               {
+                       headTextLength = textLength;
+                       tailTextLength = 0;
+               }
+       }
+
+       if (headTextLength > 0)
+       {
+               currentLength = headTextLength;
+
+               currentLength = Math::Min(textLength, currentLength);
+
+               while (textLength > 0)
+               {
+                       textLength -= currentLength;
+
+                       pTextElement->GetRegion(textIndexFromElementOffset, currentLength, textSize.width, textSize.height);
+
+                       switch (alignment & TEXT_ALIGNMASK_VERT)
+                       {
+                       case TEXT_OBJECT_ALIGNMENT_MIDDLE:
+                               adjustedRect.y = displayRect.y + (displayRect.height - textSize.height) / 2;
+                               break;
+
+                       case TEXT_OBJECT_ALIGNMENT_BOTTOM:
+                               adjustedRect.y = displayRect.y + (displayRect.height - textSize.height);
+                               break;
+
+                       case TEXT_OBJECT_ALIGNMENT_TOP:
+                               // fall through
+                       default:
+                               adjustedRect.y = displayRect.y;
+                               break;
+                       }
+
+                       if (pTextElement->IsBackGroundDrawingModeEnable())
+                       {
+                               DrawBackgroundBlock(canvasImpl, FloatRectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height), startTextIndex, currentLength, alignment, action);
+                       }
+
+                       bool isAlternateLookEnabled = (pTextElement->GetValue(SET_ALTERNATE_LOOK) > 0) ? true : false;
+                       if (__displayBlock && isAlternateLookEnabled == false)
+                       {
+                               DrawBlock(canvasImpl, blockRect, startTextIndex, currentLength, alignment, action);
+                       }
+
+                       pTextElement->Draw(canvasImpl, adjustedRect, textIndexFromElementOffset, currentLength, alignment, action);
+
+                       adjustedRect.x += textSize.width;
+                       adjustedRect.width -= textSize.width;
+
+                       if (!textLength || adjustedRect.width <= 0)
+                       {
+                               break;
+                       }
+
+                       startTextIndex += currentLength;
+
+                       if (pEnum->MoveNext() != E_SUCCESS)
+                       {
+                               break;
+                       }
+
+                       pTextElement = static_cast < TextElement* >(pEnum->GetCurrent());
+                       SysTryCatch(NID_GRP, pTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
+
+                       textIndexFromElementOffset = pTextElement->GetValue(SET_TEXT_OFFSET);
+                       currentLength = Math::Min(textLength, pTextElement->GetTextLength());
+
+                       if (currentLength == 0)
+                       {
+                               break;
+                       }
+               }
+
+               textIndexFromElementOffset += headTextLength;
+       }
+
+       if (drawAbbrevText && (headTextLength > 0 && tailTextLength > 0))
+       {
+               if (pTextElement->IsBackGroundDrawingModeEnable())
+               {
+                       r = canvasImpl.FillRectangle(pTextElement->GetBackgroundColor(), FloatRectangle(adjustedRect.x, displayRect.y, abbrevTextDim.width, displayRect.height));
+                       SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+               }
+
+               __pAbbrevTextElement->Draw(canvasImpl, adjustedRect, 0, 1, (TextObjectAlignment)(TEXT_OBJECT_ALIGNMENT_TOP | TEXT_OBJECT_ALIGNMENT_LEFT), action);
+
+               adjustedRect.x += abbrevTextDim.width;
+               adjustedRect.width -= abbrevTextDim.width;
+
+               drawAbbrevText = false;
+       }
+
+       if (tailTextLength > 0)
+       {
+               currentLength = tailTextLength;
+               currentLength = Math::Min(textLength, currentLength);
+
+               while (textLength > 0)
+               {
+                       textLength -= currentLength;
+
+                       pTextElement->GetRegion(textIndexFromElementOffset, currentLength, textSize.width, textSize.height);
+
+                       switch (alignment & TEXT_ALIGNMASK_VERT)
+                       {
+                       case TEXT_OBJECT_ALIGNMENT_MIDDLE:
+                               adjustedRect.y = displayRect.y + (displayRect.height - textSize.height) / 2;
+                               break;
+
+                       case TEXT_OBJECT_ALIGNMENT_BOTTOM:
+                               adjustedRect.y = displayRect.y + (displayRect.height - textSize.height);
+                               break;
+
+                       case TEXT_OBJECT_ALIGNMENT_TOP:
+                               // fall through
+                       default:
+                               adjustedRect.y = displayRect.y;
+                               break;
+                       }
+
+                       if (pTextElement->IsBackGroundDrawingModeEnable())
+                       {
+                               DrawBackgroundBlock(canvasImpl, FloatRectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height), startTextIndex, currentLength, alignment, action);
+                       }
+
+                       bool isAlternateLookEnabled = (pTextElement->GetValue(SET_ALTERNATE_LOOK) > 0) ? true : false;
+                       if (__displayBlock && isAlternateLookEnabled == false)
+                       {
+                               DrawBlock(canvasImpl, blockRect, startTextIndex, currentLength, alignment, action);
+                       }
+
+                       pTextElement->Draw(canvasImpl, adjustedRect, textIndexFromElementOffset, currentLength, alignment, action);
+
+                       adjustedRect.x += textSize.width;
+                       adjustedRect.width -= textSize.width;
+
+                       if (!textLength || adjustedRect.width <= 0)
+                       {
+                               break;
+                       }
+
+                       startTextIndex += currentLength;
+
+                       if (pEnum->MoveNext() != E_SUCCESS)
+                       {
+                               break;
+                       }
+
+                       pTextElement = static_cast < TextElement* >(pEnum->GetCurrent());
+                       SysTryCatch(NID_GRP, pTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
+
+                       textIndexFromElementOffset = pTextElement->GetValue(SET_TEXT_OFFSET);
+                       currentLength = Math::Min(textLength, pTextElement->GetTextLength());
+
+                       if (currentLength == 0)
+                       {
+                               break;
+                       }
+               }
+       }
+
+       if (drawAbbrevText)
+       {
+               if (pTextElement->IsBackGroundDrawingModeEnable())
+               {
+                       r = canvasImpl.FillRectangle(pTextElement->GetBackgroundColor(), FloatRectangle(adjustedRect.x, displayRect.y, abbrevTextDim.width, displayRect.height));
+                       SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+               }
+
+               __pAbbrevTextElement->Draw(canvasImpl, adjustedRect, 0, 1, (TextObjectAlignment)(TEXT_OBJECT_ALIGNMENT_TOP | TEXT_OBJECT_ALIGNMENT_LEFT), action);
+
+               adjustedRect.x += abbrevTextDim.width;
+               adjustedRect.width -= abbrevTextDim.width;
+       }
+
+       Release(pEnum);
+       return E_SUCCESS;
+
+CATCH:
+       Release(pEnum);
+       return r;
+}
+
+result
+TextComposite::DrawWithBaseline(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
+                                        const TextObjectActionType action, int baseline)
+{
+       if (textLength == 0)
+       {
+               return E_SUCCESS;
+       }
+
+       SysTryReturn(NID_GRP, 0 <= startTextIndex && startTextIndex < __length, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+       SysTryReturn(NID_GRP, textLength <= __length, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+       result r = E_SUCCESS;
+       IEnumerator* pEnum = null;
+       TextElement* pTextElement = null;
+
+       FloatDimension textSize;
+       FloatDimension spaceCharDim;
+       FloatDimension abbrevTextDim;
+       FloatRectangle adjustedRect = displayRect;
+       FloatRectangle blockRect;
+       int currentLength = 0;
+       int elementTextOffset = 0;
+       int elementIndex = 0;
+       int textIndexFromElementOffset = 0;
+       bool drawAbbrevText = false;
+
+       if (__ignoreRearBlank && __rearSpaceHideMode == TEXT_OBJECT_SPACE_HIDE_TYPE_ONE)
+       {
+               pTextElement = GetElementAtTextIndex(startTextIndex + textLength - 1, elementTextOffset, elementIndex, currentLength, textIndexFromElementOffset);
+               SysTryCatch(NID_GRP, pTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
+               const TextSimple* pSimpleText = dynamic_cast <const TextSimple*>(pTextElement);
+               if (pSimpleText != null)
+               {
+                       int length = startTextIndex + textLength - elementTextOffset - 1;
+                       const wchar_t* pText = pSimpleText->GetText();
+                       SysTryReturn(NID_GRP, pText, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text.");
+
+                       SysTryReturn(NID_GRP, length >= 0 && length < pSimpleText->GetTextLength()
+                               , E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] text index(%d) must greater than 0 and must be less than total string length(%d)",length, pSimpleText->GetTextLength());
+
+                       if (pText[length] == (wchar_t)L' ')
+                       {
+                               GetRegion(length + elementTextOffset, 1, spaceCharDim.width, spaceCharDim.height);
+                               textLength--;
+                       }
+               }
+       }
+
+       pTextElement = GetElementAtTextIndex(startTextIndex, elementTextOffset, elementIndex, currentLength, textIndexFromElementOffset);
+       SysTryCatch(NID_GRP, pTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
+
+       if (__ignoreFrontBlank && __frontSpaceHideMode == TEXT_OBJECT_SPACE_HIDE_TYPE_ONE)
+       {
+               const TextSimple* pSimpleText = dynamic_cast <const TextSimple*>(pTextElement);
+               if (pSimpleText != null)
+               {
+                       int index = startTextIndex - elementTextOffset;
+                       const wchar_t* pText = pSimpleText->GetText();
+                       SysTryReturn(NID_GRP, pText, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text.");
+
+                       SysTryReturn(NID_GRP, index >= 0 && index < pSimpleText->GetTextLength()
+                               , E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] text index(%d) must greater than 0 and must be less than total string length(%d)",index, pSimpleText->GetTextLength());
+
+                       if (pText[index] == (wchar_t)L' ')
+                       {
+                               GetRegion(textIndexFromElementOffset, 1, spaceCharDim.width, spaceCharDim.height);
+                               textLength--;
+                               startTextIndex++;
+                               textIndexFromElementOffset++;
+                       }
+               }
+       }
+
+       GetRegion(startTextIndex, textLength, textSize.width, textSize.height);
+       if (action == TEXT_OBJECT_ACTION_TYPE_ABBREV)
+       {
+               TextElement* pLastTextElement = GetElementAtTextIndex(startTextIndex + textLength - 1);
+               SysTryCatch(NID_GRP, pLastTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
+
+               if (pLastTextElement->GetType() == TEXT_ELEMENT_TYPE_TEXT)
+               {
+                       TextSimple* pSimpleText = dynamic_cast < TextSimple* >(pLastTextElement);
+                       SysTryCatch(NID_GRP, pSimpleText, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to cast text element.");
+
+                       SetAbbrevObjectFontInfo(pSimpleText);
+                       __pAbbrevTextElement->GetRegion(0, 1, abbrevTextDim.width, abbrevTextDim.height);
+               }
+
+               ForwardAnalyze(startTextIndex, __length - startTextIndex, adjustedRect.width - abbrevTextDim.width
+                       , TEXT_OBJECT_WRAP_TYPE_CHARACTER, textLength, textSize.width, textSize.height);
+
+               textSize.width += abbrevTextDim.width;
+               currentLength = textLength;
+               drawAbbrevText = true;
+       }
+
+       switch (alignment & TEXT_ALIGNMASK_HORIZ)
+       {
+       case TEXT_OBJECT_ALIGNMENT_CENTER:
+               if (textSize.width < adjustedRect.width)
+               {
+                       adjustedRect.x += (adjustedRect.width - textSize.width) / 2;
+               }
+               break;
+
+       case TEXT_OBJECT_ALIGNMENT_RIGHT:
+               if (textSize.width < adjustedRect.width)
+               {
+                       adjustedRect.x += adjustedRect.width - textSize.width;
+               }
+               break;
+
+       case TEXT_OBJECT_ALIGNMENT_LEFT:
+               // fall through
+       default:
+               break;
+       }
+
+       pEnum = __pTextElementList->GetEnumeratorN();
+       for (int i = 0; i <= elementIndex; i++)
+       {
+               r = pEnum->MoveNext();
+               SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Fail to move next element.", GetErrorMessage(r));
+       }
+
+       blockRect = FloatRectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height);
+       adjustedRect.y = displayRect.y + displayRect.height - baseline;
+       canvasImpl.SetTextOrigin(TEXT_ORIGIN_BASELINE);
+
+       currentLength = Math::Min(textLength, currentLength);
+
+       while (textLength > 0)
+       {
+               textLength -= currentLength;
+
+               pTextElement->GetRegion(textIndexFromElementOffset, currentLength, textSize.width, textSize.height);
+
+               if (pTextElement->IsBackGroundDrawingModeEnable())
+               {
+                       DrawBackgroundBlock(canvasImpl, FloatRectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height), startTextIndex, currentLength, alignment, action);
+               }
+
+               bool isAlternateLookEnabled = (pTextElement->GetValue(SET_ALTERNATE_LOOK) > 0) ? true : false;
+               if (__displayBlock && isAlternateLookEnabled == false)
+               {
+                       DrawBlock(canvasImpl, blockRect, startTextIndex, currentLength, alignment, action);
+               }
+
+               FloatRectangle imageRect = adjustedRect;
+               imageRect.y -= textSize.height;
+               TextElementType objectType = pTextElement->GetType();
+
+               if (objectType == TEXT_ELEMENT_TYPE_CUTLINK || objectType == TEXT_ELEMENT_TYPE_TEXT)
+               {
+                       pTextElement->Draw(canvasImpl, adjustedRect, textIndexFromElementOffset, currentLength, alignment, action);
+               }
+               else
+               {
+                       pTextElement->Draw(canvasImpl, imageRect, textIndexFromElementOffset, currentLength, alignment, action);
+               }
+
                adjustedRect.x += textSize.width;
                adjustedRect.width -= textSize.width;
 
@@ -765,16 +1335,20 @@ TextComposite::Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int st
                adjustedRect.width -= abbrevTextDim.width;
        }
 
+       canvasImpl.SetTextOrigin(TEXT_ORIGIN_LEFT_TOP);
+
        Release(pEnum);
        return E_SUCCESS;
 
 CATCH:
+       canvasImpl.SetTextOrigin(TEXT_ORIGIN_LEFT_TOP);
+
        Release(pEnum);
        return r;
 }
 
 result
-TextComposite::DrawWithBaseline(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
+TextComposite::DrawWithBaselineWithEllipsis(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
                                         const TextObjectActionType action, int baseline)
 {
        if (textLength == 0)
@@ -788,7 +1362,7 @@ TextComposite::DrawWithBaseline(_CanvasImpl& canvasImpl, FloatRectangle& display
        result r = E_SUCCESS;
        IEnumerator* pEnum = null;
        TextElement* pTextElement = null;
-
+       TextElement* pLastDisplayTextElement = null;
        FloatDimension textSize;
        FloatDimension spaceCharDim;
        FloatDimension abbrevTextDim;
@@ -798,13 +1372,15 @@ TextComposite::DrawWithBaseline(_CanvasImpl& canvasImpl, FloatRectangle& display
        int elementTextOffset = 0;
        int elementIndex = 0;
        int textIndexFromElementOffset = 0;
+       int headTextLength = 0;
+       int tailTextLength = 0;
        bool drawAbbrevText = false;
 
        if (__ignoreRearBlank && __rearSpaceHideMode == TEXT_OBJECT_SPACE_HIDE_TYPE_ONE)
        {
-               pTextElement = GetElementAtTextIndex(startTextIndex + textLength - 1, elementTextOffset, elementIndex, currentLength, textIndexFromElementOffset);
-               SysTryCatch(NID_GRP, pTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
-               const TextSimple* pSimpleText = dynamic_cast <const TextSimple*>(pTextElement);
+               pLastDisplayTextElement = GetElementAtTextIndex(startTextIndex + textLength - 1, elementTextOffset, elementIndex, currentLength, textIndexFromElementOffset);
+               SysTryCatch(NID_GRP, pLastDisplayTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
+               const TextSimple* pSimpleText = dynamic_cast <const TextSimple*>(pLastDisplayTextElement);
                if (pSimpleText != null)
                {
                        int length = startTextIndex + textLength - elementTextOffset - 1;
@@ -903,62 +1479,177 @@ TextComposite::DrawWithBaseline(_CanvasImpl& canvasImpl, FloatRectangle& display
        adjustedRect.y = displayRect.y + displayRect.height - baseline;
        canvasImpl.SetTextOrigin(TEXT_ORIGIN_BASELINE);
 
-       currentLength = Math::Min(textLength, currentLength);
-
-       while (textLength > 0)
+       if (drawAbbrevText)
        {
-               textLength -= currentLength;
-
-               pTextElement->GetRegion(textIndexFromElementOffset, currentLength, textSize.width, textSize.height);
-
-               if (pTextElement->IsBackGroundDrawingModeEnable())
+               if (IsRTLCharacter(startTextIndex + currentLength))
                {
-                       DrawBackgroundBlock(canvasImpl, FloatRectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height), startTextIndex, currentLength, alignment, action);
-               }
+                       headTextLength = SearchLTRTextIndex(startTextIndex, startTextIndex + currentLength) - startTextIndex;
+                       tailTextLength = textLength - headTextLength;
 
-               bool isAlternateLookEnabled = (pTextElement->GetValue(SET_ALTERNATE_LOOK) > 0) ? true : false;
-               if (__displayBlock && isAlternateLookEnabled == false)
-               {
-                       DrawBlock(canvasImpl, blockRect, startTextIndex, currentLength, alignment, action);
-               }
+                       if (headTextLength <= 0)
+                       {
+                               if (pLastDisplayTextElement->IsBackGroundDrawingModeEnable())
+                               {
+                                       r = canvasImpl.FillRectangle(pLastDisplayTextElement->GetBackgroundColor(), FloatRectangle(adjustedRect.x, displayRect.y, abbrevTextDim.width, displayRect.height));
+                                       SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+                               }
 
-               FloatRectangle imageRect = adjustedRect;
-               imageRect.y -= textSize.height;
-               TextElementType objectType = pTextElement->GetType();
+                               __pAbbrevTextElement->Draw(canvasImpl, adjustedRect, 0, 1, (TextObjectAlignment)(TEXT_OBJECT_ALIGNMENT_TOP | TEXT_OBJECT_ALIGNMENT_LEFT), action);
 
-               if (objectType == TEXT_ELEMENT_TYPE_CUTLINK || objectType == TEXT_ELEMENT_TYPE_TEXT)
-               {
-                       pTextElement->Draw(canvasImpl, adjustedRect, textIndexFromElementOffset, currentLength, alignment, action);
+                               adjustedRect.x += abbrevTextDim.width;
+                               adjustedRect.width -= abbrevTextDim.width;
+
+                               drawAbbrevText = false;
+                       }
                }
                else
                {
-                       pTextElement->Draw(canvasImpl, imageRect, textIndexFromElementOffset, currentLength, alignment, action);
+                       headTextLength = textLength;
+                       tailTextLength = 0;
                }
+       }
 
-               adjustedRect.x += textSize.width;
-               adjustedRect.width -= textSize.width;
+       if (headTextLength > 0)
+       {
+               currentLength = headTextLength;
+               currentLength = Math::Min(textLength, currentLength);
 
-               if (!textLength || adjustedRect.width <= 0)
+               while (textLength > 0)
                {
-                       break;
+                       textLength -= currentLength;
+
+                       pTextElement->GetRegion(textIndexFromElementOffset, currentLength, textSize.width, textSize.height);
+
+                       if (pTextElement->IsBackGroundDrawingModeEnable())
+                       {
+                               DrawBackgroundBlock(canvasImpl, FloatRectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height), startTextIndex, currentLength, alignment, action);
+                       }
+
+                       bool isAlternateLookEnabled = (pTextElement->GetValue(SET_ALTERNATE_LOOK) > 0) ? true : false;
+                       if (__displayBlock && isAlternateLookEnabled == false)
+                       {
+                               DrawBlock(canvasImpl, blockRect, startTextIndex, currentLength, alignment, action);
+                       }
+
+                       FloatRectangle imageRect = adjustedRect;
+                       imageRect.y -= textSize.height;
+                       TextElementType objectType = pTextElement->GetType();
+
+                       if (objectType == TEXT_ELEMENT_TYPE_CUTLINK || objectType == TEXT_ELEMENT_TYPE_TEXT)
+                       {
+                               pTextElement->Draw(canvasImpl, adjustedRect, textIndexFromElementOffset, currentLength, alignment, action);
+                       }
+                       else
+                       {
+                               pTextElement->Draw(canvasImpl, imageRect, textIndexFromElementOffset, currentLength, alignment, action);
+                       }
+
+                       adjustedRect.x += textSize.width;
+                       adjustedRect.width -= textSize.width;
+
+                       if (!textLength || adjustedRect.width <= 0)
+                       {
+                               break;
+                       }
+
+                       startTextIndex += currentLength;
+
+                       if (pEnum->MoveNext() != E_SUCCESS)
+                       {
+                               break;
+                       }
+
+                       pTextElement = static_cast < TextElement* >(pEnum->GetCurrent());
+                       SysTryCatch(NID_GRP, pTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
+
+                       textIndexFromElementOffset = pTextElement->GetValue(SET_TEXT_OFFSET);
+                       currentLength = Math::Min(textLength, pTextElement->GetTextLength());
+
+                       if (currentLength == 0)
+                       {
+                               break;
+                       }
                }
 
-               startTextIndex += currentLength;
+               textIndexFromElementOffset += headTextLength;
+       }
 
-               if (pEnum->MoveNext() != E_SUCCESS)
+       if (drawAbbrevText && (headTextLength > 0 && tailTextLength > 0))
+       {
+               if (pTextElement->IsBackGroundDrawingModeEnable())
                {
-                       break;
+                       r = canvasImpl.FillRectangle(pTextElement->GetBackgroundColor(), FloatRectangle(adjustedRect.x, displayRect.y, abbrevTextDim.width, displayRect.height));
+                       SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
                }
 
-               pTextElement = static_cast < TextElement* >(pEnum->GetCurrent());
-               SysTryCatch(NID_GRP, pTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
+               __pAbbrevTextElement->Draw(canvasImpl, adjustedRect, 0, 1, (TextObjectAlignment)(TEXT_OBJECT_ALIGNMENT_TOP | TEXT_OBJECT_ALIGNMENT_LEFT), action);
 
-               textIndexFromElementOffset = pTextElement->GetValue(SET_TEXT_OFFSET);
-               currentLength = Math::Min(textLength, pTextElement->GetTextLength());
+               adjustedRect.x += abbrevTextDim.width;
+               adjustedRect.width -= abbrevTextDim.width;
 
-               if (currentLength == 0)
+               drawAbbrevText = false;
+       }
+
+       if (tailTextLength > 0)
+       {
+               currentLength = tailTextLength;
+               currentLength = Math::Min(textLength, currentLength);
+
+               while (textLength > 0)
                {
-                       break;
+                       textLength -= currentLength;
+
+                       pTextElement->GetRegion(textIndexFromElementOffset, currentLength, textSize.width, textSize.height);
+
+                       if (pTextElement->IsBackGroundDrawingModeEnable())
+                       {
+                               DrawBackgroundBlock(canvasImpl, FloatRectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height), startTextIndex, currentLength, alignment, action);
+                       }
+
+                       bool isAlternateLookEnabled = (pTextElement->GetValue(SET_ALTERNATE_LOOK) > 0) ? true : false;
+                       if (__displayBlock && isAlternateLookEnabled == false)
+                       {
+                               DrawBlock(canvasImpl, blockRect, startTextIndex, currentLength, alignment, action);
+                       }
+
+                       FloatRectangle imageRect = adjustedRect;
+                       imageRect.y -= textSize.height;
+                       TextElementType objectType = pTextElement->GetType();
+
+                       if (objectType == TEXT_ELEMENT_TYPE_CUTLINK || objectType == TEXT_ELEMENT_TYPE_TEXT)
+                       {
+                               pTextElement->Draw(canvasImpl, adjustedRect, textIndexFromElementOffset, currentLength, alignment, action);
+                       }
+                       else
+                       {
+                               pTextElement->Draw(canvasImpl, imageRect, textIndexFromElementOffset, currentLength, alignment, action);
+                       }
+
+                       adjustedRect.x += textSize.width;
+                       adjustedRect.width -= textSize.width;
+
+                       if (!textLength || adjustedRect.width <= 0)
+                       {
+                               break;
+                       }
+
+                       startTextIndex += currentLength;
+
+                       if (pEnum->MoveNext() != E_SUCCESS)
+                       {
+                               break;
+                       }
+
+                       pTextElement = static_cast < TextElement* >(pEnum->GetCurrent());
+                       SysTryCatch(NID_GRP, pTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
+
+                       textIndexFromElementOffset = pTextElement->GetValue(SET_TEXT_OFFSET);
+                       currentLength = Math::Min(textLength, pTextElement->GetTextLength());
+
+                       if (currentLength == 0)
+                       {
+                               break;
+                       }
                }
        }
 
@@ -1181,15 +1872,31 @@ TextComposite::DrawLine(_CanvasImpl& canvasImpl, TextLine* pTextLine, const Floa
        adjustedRect.width = lineBounds.width;
        adjustedRect.height = lineBounds.height;
 
-       if (__elementVertialAlignment & TEXT_OBJECT_ALIGNMENT_BASELINE)
+       if (action == TEXT_OBJECT_ACTION_TYPE_ABBREV)
        {
-               return DrawWithBaseline(canvasImpl, adjustedRect, lineOffset, lineLength,
-                               (TextObjectAlignment)((TEXT_ALIGNMASK_HORIZ & align) | TEXT_OBJECT_ALIGNMENT_BASELINE), action, pTextLine->GetBaseline());
+               if (__elementVertialAlignment & TEXT_OBJECT_ALIGNMENT_BASELINE)
+               {
+                       return DrawWithBaselineWithEllipsis(canvasImpl, adjustedRect, lineOffset, lineLength,
+                                       (TextObjectAlignment)((TEXT_ALIGNMASK_HORIZ & align) | TEXT_OBJECT_ALIGNMENT_BASELINE), action, pTextLine->GetBaseline());
+               }
+               else
+               {
+                       return DrawWithEliipsis(canvasImpl, adjustedRect, lineOffset, lineLength,
+                                       (TextObjectAlignment)((TEXT_ALIGNMASK_HORIZ & align) | __elementVertialAlignment), action);
+               }
        }
        else
        {
-               return Draw(canvasImpl, adjustedRect, lineOffset, lineLength,
-                               (TextObjectAlignment)((TEXT_ALIGNMASK_HORIZ & align) | __elementVertialAlignment), action);
+               if (__elementVertialAlignment & TEXT_OBJECT_ALIGNMENT_BASELINE)
+               {
+                       return DrawWithBaseline(canvasImpl, adjustedRect, lineOffset, lineLength,
+                                       (TextObjectAlignment)((TEXT_ALIGNMASK_HORIZ & align) | TEXT_OBJECT_ALIGNMENT_BASELINE), action, pTextLine->GetBaseline());
+               }
+               else
+               {
+                       return Draw(canvasImpl, adjustedRect, lineOffset, lineLength,
+                                       (TextObjectAlignment)((TEXT_ALIGNMASK_HORIZ & align) | __elementVertialAlignment), action);
+               }
        }
 }
 
@@ -5156,4 +5863,168 @@ TextComposite::UpdateTextSweepInfo(TextObjectSweepInfo* pTextSweepInfo)
        __pSweepInfo->widthChanged = pTextSweepInfo->widthChanged;
 }
 
+bool
+TextComposite::IsRTL(int startTextIndex, int textLength) const
+{
+       SysTryReturn(NID_GRP, 0 <= startTextIndex && textLength <= __length, false, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+       result r = E_SUCCESS;
+       IEnumerator* pEnum = null;
+
+       int currentLength = 0;
+       int elementTextOffset = 0;
+       int elementIndex = 0;
+       int textIndexFromElementOffset = 0;
+
+       if(textLength == 0)
+       {
+               return false;
+       }
+
+       TextElement* pTextElement = GetElementAtTextIndex(startTextIndex, elementTextOffset, elementIndex, currentLength, textIndexFromElementOffset);
+       SysTryCatch(NID_GRP, pTextElement, , E_SYSTEM, "[E_SYSTEM] Fail to get element.");
+
+       textIndexFromElementOffset = startTextIndex - elementTextOffset;
+
+       pEnum = __pTextElementList->GetEnumeratorN();
+       for (int i = 0; i < elementIndex; i++)
+       {
+               r = pEnum->MoveNext();
+       }
+
+       while (pEnum->MoveNext() == E_SUCCESS)
+       {
+               pTextElement = static_cast < TextElement* >(pEnum->GetCurrent());
+               if (pTextElement)
+               {
+                       currentLength = Math::Min(pTextElement->GetTextLength() - textIndexFromElementOffset, textLength);
+
+                       TextElementType objectType = pTextElement->GetType();
+
+                       if (objectType == TEXT_ELEMENT_TYPE_TEXT || objectType == TEXT_ELEMENT_TYPE_CUTLINK)
+                       {
+                               TextSimple* pSimpleText = dynamic_cast < TextSimple* >(pTextElement);
+                               if (pSimpleText)
+                               {
+                                       const wchar_t* pSrcText = pSimpleText->GetText();
+                                       SysTryCatch(NID_GRP, pSrcText, , E_SYSTEM, "[E_SYSTEM] Fail to get text.");
+
+                                       const wchar_t* pPointer = &pSrcText[textIndexFromElementOffset];
+                                       SysTryCatch(NID_GRP, pPointer, , E_SYSTEM, "[E_SYSTEM] Fail to get text.");
+
+                                       for (int i = 0; i< currentLength; i++)
+                                       {
+                                               if(*pPointer == null)
+                                               {
+                                                       break;
+                                               }
+                                               FriBidiChar bidiText[1] = { *pPointer };
+                                               FriBidiCharType type[1] = { 0 };
+                                               fribidi_get_bidi_types(bidiText, 1, type);
+
+                                               if ((type[0] & FRIBIDI_MASK_RTL) != 0)
+                                               {
+                                                       Release(pEnum);
+                                                       return true;
+                                               }
+                                               else if (((type[0] & FRIBIDI_MASK_STRONG) != 0) && ((type[0] & FRIBIDI_MASK_LETTER) != 0))
+                                               {
+                                                       Release(pEnum);
+                                                       return false;
+                                               }
+
+                                               pPointer++;
+                                       }
+
+                               }
+
+                               textLength -= currentLength;
+                       }
+               }
+
+               if (textLength <= 0)
+               {
+                       break;
+               }
+
+               textIndexFromElementOffset = 0;
+       }
+
+       Release(pEnum);
+       return false;
+
+CATCH:
+       Release(pEnum);
+
+       return false;
+}
+
+bool
+TextComposite::IsRTLCharacter(int textIndex) const
+{
+       SysTryReturn(NID_GRP, 0 <= textIndex, false, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+       bool isRTL = false;
+
+       for (int i = textIndex; i >= 0; i--)
+       {
+               wchar_t ch = GetCharacter(i);
+               if (TextUtility::IsStrongCharacter(ch))
+               {
+                       if (TextUtility::IsRTLCharacter(GetCharacter(i)))
+                       {
+                               isRTL = true;
+                       }
+                       else
+                       {
+                               isRTL = false;
+                       }
+                       break;
+               }
+       }
+
+       return isRTL;
+}
+
+int
+TextComposite::SearchLTRTextIndex(int startTextIndex,int fromTextIndex) const
+{
+       SysTryReturn(NID_GRP, 0 <= fromTextIndex, -1, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+
+       bool isLTR = false;
+       int LTRTextIndex = -1;
+       wchar_t ch = 0;
+
+       for (int i = fromTextIndex; i >= startTextIndex; i--)
+       {
+               ch = GetCharacter(i);
+
+               if (TextUtility::IsLTRCharacter(ch))
+               {
+                       isLTR = true;
+               }
+
+               if (isLTR == true)
+               {
+                       LTRTextIndex = i + 1;
+
+                       while(1)
+                       {
+                               ch = GetCharacter(LTRTextIndex);
+                               if (TextUtility::IsStrongCharacter(ch))
+                               {
+                                       break;
+                               }
+
+                               LTRTextIndex++;
+                       }
+
+                       break;
+               }
+       }
+
+       LTRTextIndex = (startTextIndex <= LTRTextIndex && LTRTextIndex <= fromTextIndex) ? LTRTextIndex : startTextIndex;
+
+       return LTRTextIndex;
+}
+
 }}} // Tizen::Graphics::_Text
index fee5c2f..4390f7f 100644 (file)
@@ -70,6 +70,9 @@ public:
        virtual result Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
                        const TextObjectActionType action);
 
+       result DrawWithEliipsis(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
+                                        const TextObjectActionType action);
+
        virtual result GetRegion(int textIndex, int textLength, float& width, float& height) const;
 
        virtual float GetHeightF(int textIndex) const;
@@ -84,6 +87,9 @@ public:
        result DrawWithBaseline(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
                        const TextObjectActionType action, int baseline);
 
+       result DrawWithBaselineWithEllipsis(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
+                                        const TextObjectActionType action, int baseline);
+
        result InsertElementAt(TextElement& textElement, int textIndex);
 
        result AppendElement(TextElement& textElement);
@@ -278,6 +284,12 @@ public:
 
        Tizen::Base::String GetDisplayableText(FloatRectangle displayRect, TextObjectActionType action);
 
+       bool IsRTL(int startTextIndex, int textLength) const;
+
+       bool IsRTLCharacter(int textIndex) const;
+
+       int SearchLTRTextIndex(int startTextIndex,int fromTextIndex) const;
+
 private:
        int ComposeInNoneWrap(FloatRectangle& rect, NoneWrapComposeInfo* pNoneWrapComposeInfo = null);
 
index b25815b..2eb5af2 100644 (file)
@@ -85,7 +85,7 @@ TextObject::TextObject(void)
        __rect.y = 0;
        __rect.width = 0;
        __rect.height = 0;
-       __slidingGap = 30.0f;
+       __slidingGap = CoordinateSystem::ConvertToLogicalX(30.0f);
        __slidingStep = CoordinateSystem::ConvertToLogicalX(2.0f);
        __linkViewModeEnabled = false;
        __isUrlLinkColorDefined = false;
index d31c94f..59ab273 100644 (file)
@@ -1403,7 +1403,7 @@ TextSimple::GetBaselineF(void) const
        _FontImpl* pFontImpl = _FontImpl::GetInstance(*pCurrentFont);
        SysTryReturn(NID_GRP, pFontImpl, -1, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
 
-       return (-1) * pFontImpl->GetDescenderF();
+       return pFontImpl->GetDescenderF();
 }
 
 }}} // Tizen::Graphics::_Text
index edcffa1..07a70f5 100644 (file)
@@ -382,7 +382,11 @@ TextSimpleList::DeleteNthObject(SimpleList* pSimpleList, int index)
 
        delete pNode;
        pNode = null;
-       pSimpleList->nodeCount--;
+
+       if (pSimpleList)
+       {
+               pSimpleList->nodeCount--;
+       }
 
        return pObject;
 }
index 4bb0523..e435036 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <new>
+#include <fribidi.h>
 #include <FBaseSysLog.h>
 #include <FBaseColLinkedList.h>
 #include "FGrp_CanvasImpl.h"
@@ -403,5 +404,56 @@ CATCH:
        return r;
 }
 
+bool
+TextUtility::IsLTRCharacter(wchar_t ch)
+{
+       FriBidiChar text[1] = { ch };
+       FriBidiCharType type[1] = { 0 };
+       fribidi_get_bidi_types(text, 1, type);
+
+       if (type[0] & (FRIBIDI_MASK_STRONG | FRIBIDI_MASK_LETTER))
+       {
+               if (!(type[0] & FRIBIDI_MASK_RTL))
+               {
+                       return true;
+               }
+       }
+
+       return false;
+}
+
+bool
+TextUtility::IsRTLCharacter(wchar_t ch)
+{
+       FriBidiChar text[1] = { ch };
+       FriBidiCharType type[1] = { 0 };
+       fribidi_get_bidi_types(text, 1, type);
+
+       if (type[0] & (FRIBIDI_MASK_STRONG | FRIBIDI_MASK_LETTER))
+       {
+               if (type[0] & FRIBIDI_MASK_RTL)
+               {
+                       return true;
+               }
+       }
+
+       return false;
+}
+
+bool
+TextUtility::IsStrongCharacter(wchar_t ch)
+{
+       FriBidiChar text[1] = { ch };
+       FriBidiCharType type[1] = { 0 };
+       fribidi_get_bidi_types(text, 1, type);
+
+       if (type[0] & (FRIBIDI_MASK_STRONG | FRIBIDI_MASK_LETTER))
+       {
+               return true;
+       }
+
+       return false;
+}
+
 }}} // Tizen::Graphics::_Texts
 
index 2ce4234..6c5f586 100644 (file)
@@ -73,6 +73,12 @@ public:
 
        static result DrawOutlineText(_CanvasImpl& canvasImpl, float x, float y, const wchar_t* pText, int textLength, Color outlineColor);
 
+       static bool IsLTRCharacter(wchar_t ch);
+
+       static bool IsRTLCharacter(wchar_t ch);
+
+       static bool IsStrongCharacter(wchar_t ch);
+
 }; // TextUtility
 
 }}} // Tizen::Graphics::_Text