virtual result GetRegion(int textIndex, int textLength, float& width, float& height) const;
- virtual result GetBlockRegion(int textIndex, int textLength, int& width, int& height) const;
-
- virtual result GetBlockRegion(int textIndex, int textLength, float& width, float& height) const;
-
virtual int GetHeight(void) const;
virtual float GetHeightF(void) const;
virtual int GetBaseline(void) const;
+ virtual float GetBaselineF(void) const;
+
virtual void SetForegroundColor(const Color& color);
virtual Color GetForegroundColor(void) const;
: public TextElement
{
public:
- TextImage(Bitmap& bitmap, TextElementSourceType sourceType = TEXT_ELEMENT_SOURCE_TYPE_INTERNAL, Rectangle* pRect = null,
+ TextImage(Bitmap& bitmap, TextElementSourceType sourceType = TEXT_ELEMENT_SOURCE_TYPE_INTERNAL,
TextObjectAlignment align = TextObjectAlignment(TEXT_OBJECT_ALIGNMENT_LEFT | TEXT_OBJECT_ALIGNMENT_TOP));
-
+
virtual ~TextImage(void);
public:
- virtual int ForwardAnalyze(int startTextIndex, int textLength, int maxWidth, TextObjectWrapType wrap,
- int& actualLength, int& width, int& height);
-
virtual int ForwardAnalyze(int startTextIndex, int textLength, float maxWidth, TextObjectWrapType wrap,
int& actualLength, float& width, float& height);
- virtual result Draw(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength,
- const TextObjectAlignment align, const TextObjectActionType action);
-
virtual result Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength,
const TextObjectAlignment align, const TextObjectActionType action);
virtual TextElement* CopyN(int textStart, int textLength);
- virtual result GetRegion(int textIndex, int startTextIndex, int& width, int& height) const;
-
virtual result GetRegion(int textIndex, int textLength, float& width, float& height) const;
- virtual result GetBlockRegion(int textIndex, int textLength, int& width, int& height) const;
-
- virtual result GetBlockRegion(int textIndex, int textLength, float& width, float& height) const;
-
virtual int GetHeight(void) const;
virtual float GetHeightF(void) const;
virtual int GetBaseline(void) const;
+ virtual float GetBaselineF(void) const;
+
result SetBounds(const Rectangle& rect);
result SetBounds(const FloatRectangle& rect);
private:
Bitmap* __pBitmap;
- Rectangle __rect;
+ FloatRectangle __rect;
TextObjectAlignment __align;
private:
TextElement* GetElementAtTextIndex(int textIndex) const;
- int GetTextIndexFromPosition(int lcX, int lcY, bool cursorMode = true) const;
+ int GetTextIndexFromPosition(int x, int y, bool cursorMode = true) const;
- int GetTextIndexFromPosition(float lcX, float lcY, bool cursorMode = true) const;
+ int GetTextIndexFromPosition(float x, float y, bool cursorMode = true) const;
- int GetTextIndexFromPositionAtLine(int lineIndex, int lcX, bool cursorMode = true) const;
+ int GetTextIndexFromPositionAtLine(int lineIndex, int x, bool cursorMode = true) const;
- int GetTextIndexFromPositionAtLine(int lineIndex, float lcX, bool cursorMode = true) const;
+ int GetTextIndexFromPositionAtLine(int lineIndex, float x, bool cursorMode = true) const;
result ChangeTextOffset(wchar_t* pText, int textIndex, int gap);
int GetDisplayLineCount(void) const;
- int GetLineIndexAtPositionY(int lcY) const;
+ int GetLineIndexAtPositionY(int y) const;
- int GetLineIndexAtPositionY(float lcY) const;
+ int GetLineIndexAtPositionY(float y) const;
int GetFirstTextIndexAt(int lineIndex) const;
TextObjectAlignment GetElementVerticalAlignment(void) const;
- result SetBounds(const Rectangle& lcRect);
+ result SetBounds(const Rectangle& rect);
- result SetBounds(const FloatRectangle& lcRect);
+ result SetBounds(const FloatRectangle& rect);
Rectangle GetBounds(void) const;
FloatRectangle GetBoundsF(void) const;
- result SetLineSpace(int lcLineSpacing);
+ result SetLineSpace(int lineSpacing);
- result SetLineSpace(float lcLineSpacing);
+ result SetLineSpace(float lineSpacing);
int GetLineSpace(void) const;
void GetBlockRange(int& startTextIndex, int& textLength);
- result SetSlidingStep(int lcSlidingStep);
+ result SetSlidingStep(int slidingStep);
int GetSlidingStep(void) const;
int GetFirstDisplayLineIndex(void) const;
- result SetFirstDisplayPositionY(int lcY);
+ result SetFirstDisplayPositionY(int y);
- result SetFirstDisplayPositionY(float lcY);
+ result SetFirstDisplayPositionY(float y);
int GetFirstDisplayPositionY(void) const;
int GetTotalCutLinkElementCount(void) const;
- int GetCutLinkIndexFromPositionData(int lcX, int lcY) const;
+ int GetCutLinkIndexFromPositionData(int x, int y) const;
- int GetCutLinkIndexFromPositionData(float lcX, float lcY) const;
+ int GetCutLinkIndexFromPositionData(float x, float y) const;
TextElement* GetCutLinkElementAtCutLinkElementIndex(int linkIndex) const;
result GetTextPositionInfoInNoneWrapAt(int textIndex, float& width, float& height, float& absX, float& absY,
float& logicalX, float& logicalY) const;
- int GetTextIndexFromPositionInWrap(int pcX, int pcY, bool cursorMode = true) const;
+ int GetTextIndexFromPositionInWrap(int x, int y, bool cursorMode = true) const;
- int GetTextIndexFromPositionInWrap(float pcX, float pcY, bool cursorMode = true) const;
+ int GetTextIndexFromPositionInWrap(float x, float y, bool cursorMode = true) const;
- int GetTextIndexFromPositionInNoneWrap(int pcX, int pcY, bool cursorMode = true) const;
+ int GetTextIndexFromPositionInNoneWrap(int x, int y, bool cursorMode = true) const;
- int GetTextIndexFromPositionInNoneWrap(float pcX, float pcY, bool cursorMode = true) const;
+ int GetTextIndexFromPositionInNoneWrap(float x, float y, bool cursorMode = true) const;
result UpdateChangedInfo(int startTextIndex, int textLength = -1, bool initTextWidthManager = true);
// Attribute
private:
- Rectangle __rect;
- Rectangle __pcRect;
+ FloatRectangle __rect;
TextObjectActionType __action;
TextObjectAlignment __align;
TextObjectWrapType __wrap;
virtual result GetRegion(int textIndex, int textLength, float& width, float& height) const;
- virtual result GetBlockRegion(int textIndex, int textLength, int& width, int& height) const;
-
- virtual result GetBlockRegion(int textIndex, int textLength, float& width, float& height) const;
-
virtual int GetHeight(void) const;
virtual float GetHeightF(void) const;
virtual int GetBaseline(void) const;
+ virtual float GetBaselineF(void) const;
+
int GetTextOffset(void) const;
result SetFont(const Font* pFont);
}
result
-TextColumn::GetRegion(int textIndex, int textLength, int& width, int& height) const
+TextColumn::GetRegion(int textIndex, int textLength, float& width, float& height) const
{
result r = E_SUCCESS;
return __pCompositeText->GetRegion(textIndex, textLength, width, height);
}
- Rectangle lineBounds;
+ FloatRectangle lineBounds;
SimpleNode* pTextLineNode = null;
TextLine* pTextLine = null;
while (pTextLineNode)
{
pTextLine = static_cast < TextLine* >(pTextLineNode->pObject);
- SysTryReturn(NID_GRP
- , pTextLine
- , r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
+ SysTryReturn(NID_GRP, pTextLine, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
- width = Math::Max(width, lineBounds.width);
+ width = (width > lineBounds.width) ? width : lineBounds.width;
height += lineBounds.height;
pTextLineNode = pTextLineNode->pNext;
return r;
}
-result
-TextColumn::GetRegion(int textIndex, int textLength, float& width, float& height) const
-{
- int newWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int newHeight = _CoordinateSystemUtils::ConvertToInteger(height);
-
- result r = GetRegion(textIndex, textLength, newWidth, newHeight);
-
- width = _CoordinateSystemUtils::ConvertToFloat(newWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(newWidth);
-
- return r;
-}
-
-int
-TextColumn::GetHeight(int textIndex) const
+float
+TextColumn::GetHeightF(int textIndex) const
{
if (textIndex < 0)
{
- return GetTotalHeight();
+ return GetTotalHeightF();
}
- return __pCompositeText->GetHeight(textIndex);
-}
-
-float
-TextColumn::GetHeightF(int textIndex) const
-{
- return _CoordinateSystemUtils::ConvertToFloat(GetHeight(textIndex));
+ return __pCompositeText->GetHeightF(textIndex);
}
result
-TextColumn::Draw(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength,
+TextColumn::Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength,
const TextObjectAlignment alignment, const TextObjectActionType action)
{
result r = E_SUCCESS;
TextLine* pTextLine = null;
SimpleNode* pTextLineNode = null;
TextObjectActionType lineAction = TEXT_OBJECT_ACTION_TYPE_NONE;
- Rectangle lineBounds;
+ FloatRectangle lineBounds;
__displayLineCount = 0;
__displayHeight = 0;
return E_SUCCESS;
}
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
if (__firstDisplayPositionY != lineBounds.y)
{
}
else
{
- Rectangle nextLineBounds;
+ FloatRectangle nextLineBounds;
if (__pLines->nodeCount < pNextTextLine->GetIndex())
{
return E_SUCCESS;
}
- nextLineBounds = pNextTextLine->GetBounds();
+ nextLineBounds = pNextTextLine->GetBoundsF();
if (displayRect.height < (lineBounds.height + nextLineBounds.height))
{
lineAction = TEXT_OBJECT_ACTION_TYPE_ABBREV;
return E_SUCCESS;
}
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
}
return E_SUCCESS;
}
result
-TextColumn::Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength,
- const TextObjectAlignment alignment, const TextObjectActionType action)
-{
- Rectangle newDisplayRect = _CoordinateSystemUtils::ConvertToInteger(displayRect);
-
- return Draw(canvasImpl, newDisplayRect, startTextIndex, textLength, alignment, action);
-}
-
-result
-TextColumn::CalculateDisplayableLineCount(Rectangle& displayRect, const TextObjectActionType action)
+TextColumn::CalculateDisplayableLineCount(FloatRectangle& displayRect, const TextObjectActionType action)
{
int displayLineCount = 0;
return -1;
}
- Rectangle lineBounds = pTextLine->GetBounds();
+ FloatRectangle lineBounds = pTextLine->GetBoundsF();
if (__firstDisplayPositionY != lineBounds.y)
{
}
else
{
- Rectangle nextLineBounds;
+ FloatRectangle nextLineBounds;
if (__pLines->nodeCount < pNextTextLine->GetIndex())
{
return -1;
}
- nextLineBounds = pNextTextLine->GetBounds();
+ nextLineBounds = pNextTextLine->GetBoundsF();
if (displayRect.height < (lineBounds.height + nextLineBounds.height))
{
displayLineCount++;
return -1;
}
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
}
return displayLineCount;
}
-result
-TextColumn::CalculateDisplayableLineCount(FloatRectangle& displayRect, const TextObjectActionType action)
-{
- Rectangle newDisplayRect = _CoordinateSystemUtils::ConvertToInteger(displayRect);
-
- return CalculateDisplayableLineCount(newDisplayRect, action);
-}
-
int
TextColumn::GetTextLength(void) const
{
TextLine* pTextLine = null;
int lineIndex = 0;
- Rectangle lineBounds;
+ FloatRectangle lineBounds;
if (GetTotalLineCount() == 0)
{
pTextLine = static_cast < TextLine* >(pTextLineNode->pObject);
SysTryReturn(NID_GRP, pTextLine, -1, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
if (y >= lineBounds.y && y < lineBounds.y + lineBounds.height)
{
pTextLine = static_cast < TextLine* >(pTextLineNode->pObject);
SysTryReturn(NID_GRP, pTextLine, -1, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
if (y >= lineBounds.y && y < lineBounds.y + lineBounds.height)
{
int
TextColumn::GetTotalHeight(void) const
{
+ return _CoordinateSystemUtils::ConvertToInteger(GetTotalHeightF());
+}
+
+float
+TextColumn::GetTotalHeightF(void) const
+{
SimpleNode* pTextLineNode = null;
TextLine* pTextLine = null;
- Rectangle lineBounds;
- int height = 0;
+ FloatRectangle lineBounds;
+ float height = 0;
pTextLineNode = TextSimpleList::GetFirstNode(__pLines);
while (pTextLineNode)
{
pTextLine = static_cast < TextLine* >(pTextLineNode->pObject);
- SysTryReturn(NID_GRP
- , pTextLine
- , 0, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
+ SysTryReturn(NID_GRP, pTextLine, 0, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
height += lineBounds.height;
pTextLineNode = pTextLineNode->pNext;
return height;
}
-float
-TextColumn::GetTotalHeightF(void) const
+int
+TextColumn::GetLineHeightAt(int index) const
{
- return _CoordinateSystemUtils::ConvertToFloat(GetTotalHeight());
+ return _CoordinateSystemUtils::ConvertToInteger(GetLineHeightAtF(index));
}
-int
-TextColumn::GetLineHeightAt(int index) const
+float
+TextColumn::GetLineHeightAtF(int index) const
{
TextLine* pTextLine = null;
pTextLine = static_cast < TextLine* >(TextSimpleList::GetNthObject(__pLines, index));
- SysTryReturn(NID_GRP
- , pTextLine
- , 0, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
+ SysTryReturn(NID_GRP, pTextLine, 0, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- Rectangle lineRect;
- lineRect = pTextLine->GetBounds();
+ FloatRectangle lineRect;
+ lineRect = pTextLine->GetBoundsF();
return lineRect.height;
}
-float
-TextColumn::GetLineHeightAtF(int index) const
-{
- return _CoordinateSystemUtils::ConvertToFloat(GetLineHeightAt(index));
-}
-
int
TextColumn::GetTextLengthAt(int lineIndex) const
{
TextLine* pTextLine = null;
pTextLine = static_cast < TextLine* >(TextSimpleList::GetNthObject(__pLines, lineIndex));
- SysTryReturn(NID_GRP
- , pTextLine
- , 0, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
+ SysTryReturn(NID_GRP, pTextLine, 0, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
return pTextLine->GetTextLength();
}
TextLine* pTextLine = null;
pTextLine = static_cast < TextLine* >(TextSimpleList::GetNthObject(__pLines, lineIndex));
- SysTryReturn(NID_GRP
- , pTextLine
- , 0, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
+ SysTryReturn(NID_GRP, pTextLine, 0, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
return pTextLine->GetTextOffset();
}
result
TextColumn::Append(TextLine* pTextLine)
{
- SysTryReturn(NID_GRP
- , pTextLine
- , E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ SysTryReturn(NID_GRP, pTextLine, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
TextSimpleList::AppendObject(__pLines, pTextLine);
__totalLineCount++;
SimpleNode* pTextLineNode = null;
TextLine* pTextLine = null;
- Rectangle lineBounds;
+ FloatRectangle lineBounds;
if (__currentLineIndexToAddDuringCompose == 0)
{
}
pTextLineNode = TextSimpleList::GetNthNode(__pLines, __currentLineIndexToAddDuringCompose - 1);
- SysTryReturn(NID_GRP
- , pTextLineNode
- , E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line node.");
+ SysTryReturn(NID_GRP, pTextLineNode, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line node.");
pTextLine = static_cast < TextLine* >(pTextLineNode->pObject);
- SysTryReturn(NID_GRP
- , pTextLine
- , E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
+ SysTryReturn(NID_GRP, pTextLine, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- lineBounds = pTextLine->GetBounds();
- int nextLineY = lineBounds.y + lineBounds.height;
+ lineBounds = pTextLine->GetBoundsF();
+ float nextLineY = lineBounds.y + lineBounds.height;
pTextLineNode = TextSimpleList::GetNthNode(__pLines, __currentLineIndexToAddDuringCompose);
while (pTextLineNode != null)
{
pTextLine = static_cast < TextLine* >(pTextLineNode->pObject);
- SysTryReturn(NID_GRP
- , pTextLine
- , E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
+ SysTryReturn(NID_GRP, pTextLine, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
int lineOffset = pTextLine->GetTextOffset();
lineOffset += changedTextLength;
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
lineBounds.y = nextLineY;
nextLineY += lineBounds.height;
TextLine*
TextColumn::GetPrevLineChangedStartLine(void) const
{
- SysTryReturn(NID_GRP
- , __setChangeAction
- , null, E_INVALID_STATE, "[E_INVALID_STATE] This instance is set change action list yet.");
+ SysTryReturn(NID_GRP, __setChangeAction, null, E_INVALID_STATE
+ , "[E_INVALID_STATE] This instance is set change action list yet.");
if (__prevLineIndexBeforeChangedStartLine < 0)
{
}
TextLine* pTextLine = GetTextLine(__prevLineIndexBeforeChangedStartLine);
- SysTryReturn(NID_GRP
- , pTextLine
- , null, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
+ SysTryReturn(NID_GRP, pTextLine, null, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
SetLastResult(E_SUCCESS);
result
TextColumn::RemoveLinesFrom(int lineIndex)
{
- SysTryReturn(NID_GRP
- , 0 <= lineIndex
- , E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ SysTryReturn(NID_GRP, 0 <= lineIndex, E_INVALID_ARG, E_INVALID_ARG
+ , "[E_INVALID_ARG] The argument is invalid.");
TextLine* pTextLine = null;
int count = 0;
void
TextColumn::SetFirstDisplayPositionY(int y)
{
- __firstDisplayPositionY = y;
+ __firstDisplayPositionY = _CoordinateSystemUtils::ConvertToFloat(y);
}
void
TextColumn::SetFirstDisplayPositionY(float y)
{
- __firstDisplayPositionY = _CoordinateSystemUtils::ConvertToInteger(y);
+ __firstDisplayPositionY = y;
}
int
TextColumn::GetFirstDisplayPositionY(void) const
{
- return __firstDisplayPositionY;
+ return _CoordinateSystemUtils::ConvertToInteger(__firstDisplayPositionY);
}
float
TextColumn::GetFirstDisplayPositionYF(void) const
{
- return _CoordinateSystemUtils::ConvertToFloat(__firstDisplayPositionY);
+ return __firstDisplayPositionY;
}
void
TextColumn::SetDisplayHeight(int height)
{
- __displayHeight = height;
+ __displayHeight = _CoordinateSystemUtils::ConvertToFloat(height);
}
void
TextColumn::SetDisplayHeight(float height)
{
- __displayHeight = _CoordinateSystemUtils::ConvertToInteger(height);
+ __displayHeight = height;
}
int
TextColumn::GetDisplayHeight(void) const
{
- return __displayHeight;
+ return _CoordinateSystemUtils::ConvertToInteger(__displayHeight);
}
float
TextColumn::GetDisplayHeightF(void) const
{
- return _CoordinateSystemUtils::ConvertToFloat(__displayHeight);
+ return __displayHeight;
}
SimpleNode*
result
TextColumn::SetSlidingDimension(Dimension& slidingDimension)
{
- SysTryReturn(NID_GRP
- , slidingDimension.width >= 0 && slidingDimension.height >=0
+ SysTryReturn(NID_GRP, slidingDimension.width >= 0 && slidingDimension.height >=0
, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
__slidingDimension = slidingDimension;
}
int
-TextColumn::ForwardAnalyze(int startTextIndex, int textLength, int maxWidth, TextObjectWrapType wrap,
- int& actualLength, int& width, int& height)
-{
- return -1;
-}
-
-int
TextColumn::ForwardAnalyze(int startTextIndex, int textLength, float maxWidth, TextObjectWrapType wrap,
int& actualLength, float& width, float& height)
{
TextLine* pOldTextLine = null;
TextLine* pNewTextLine = null;
- Dimension newLineSize;
- Dimension oldLineSize;
+ FloatDimension newLineSize;
+ FloatDimension oldLineSize;
int sweepResult = 0;
- int sweepIn = 0;
- int sweepOut = 0;
- int prevLineSweepIn = 0;
- int prevLineSweepOut = 0;
+ float sweepIn = 0;
+ float sweepOut = 0;
+ float prevLineSweepIn = 0;
+ float prevLineSweepOut = 0;
int changedStartLineIndex = 0;
- int keyInputWidth = 0;
+ float keyInputWidth = 0;
if (TextSimpleList::GetCount(__pKeepLines) == 0)
{
keyInputWidth = __pCompositeText->GetWorkWidth();
pOldTextLineNode = TextSimpleList::GetFirstNode(__pKeepLines);
- SysTryReturn(NID_GRP
- , pOldTextLineNode
- , E_SYSTEM, E_SYSTEM
- , "[E_SYSTEM] Fail to get text line node.");
+ SysTryReturn(NID_GRP, pOldTextLineNode, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line node.");
pOldTextLine = static_cast < TextLine* >(pOldTextLineNode->pObject);
changedStartLineIndex = pOldTextLine->GetIndex();
pNewTextLineNode = TextSimpleList::GetNthNode(__pLines, changedStartLineIndex);
- SysTryReturn(NID_GRP
- , pNewTextLineNode
- , E_INVALID_STATE, E_INVALID_STATE
- , "[E_INVALID_STATE] This instance is not constructed yet. changedStartLineIndex = %d", changedStartLineIndex);
+ SysTryReturn(NID_GRP, pNewTextLineNode, E_INVALID_STATE, E_INVALID_STATE
+ , "[E_INVALID_STATE] This instance is not constructed yet. changedStartLineIndex = %d", changedStartLineIndex);
r = SetKeyInputLine(changedStartLineIndex, TextSimpleList::GetCount(__pLines) - changedStartLineIndex);
- SysTryReturn(NID_GRP
- , r == E_SUCCESS
- , r, r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
pOldTextLine = static_cast < TextLine* >(pOldTextLineNode->pObject);
pNewTextLine = static_cast < TextLine* >(pNewTextLineNode->pObject);
virtual ~TextColumn(void);
public:
- virtual result Draw(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex,
- int textLength, const TextObjectAlignment alignment, const TextObjectActionType action);
-
virtual result Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex,
int textLength, const TextObjectAlignment alignment, const TextObjectActionType action);
- virtual result GetRegion(int textIndex, int textLength, int& width, int& height) const;
-
virtual result GetRegion(int textIndex, int textLength, float& width, float& height) const;
- virtual int GetHeight(int textIndex) const;
-
virtual float GetHeightF(int textIndex) const;
virtual int GetTextLength(void) const;
- virtual int ForwardAnalyze(int startTextIndex, int textLength, int maxWidth, TextObjectWrapType wrap,
- int& actualLength, int& width, int& height);
-
virtual int ForwardAnalyze(int startTextIndex, int textLength, float maxWidth, TextObjectWrapType wrap,
int& actualLength, float& width, float& height);
result CompareDeletedLine(void);
- result CalculateDisplayableLineCount(Rectangle& displayRect, const TextObjectActionType action);
-
result CalculateDisplayableLineCount(FloatRectangle& displayRect, const TextObjectActionType action);
private:
SimpleList* __pTextChangeActionList;
int __totalLineCount;
int __firstDisplayLineIndex;
- int __firstDisplayPositionY;
+ float __firstDisplayPositionY;
int __displayLineCount;
- int __displayHeight;
+ float __displayHeight;
Tizen::Graphics::Dimension __slidingDimension;
int __slidingPosition;
bool __setChangeAction;
bool __isComposeDone;
SimpleNode* __pCachedLineNode;
int __cachedLineIndex;
- int __cachedLinePositionY;
+ float __cachedLinePositionY;
SimpleList* __pKeepLines;
int __keepLineCount;
#include "FGrp_TextTextUtility.h"
#include "FGrp_CanvasImpl.h"
#include "FGrp_TextTextWidthManager.h"
-#include "../FGrp_Canvas.h"
#include "FGrp_CoordinateSystemUtils.h"
using namespace Tizen::Base;
namespace // unnamed
{
- const int LINE_FEED_WIDTH = 8;
+ const float LINE_FEED_WIDTH = 8.0f;
}
namespace Tizen { namespace Graphics
{
int prevTextOffset;
int prevTextLength;
- int prevWidth;
- int prevHeight;
+ float prevWidth;
+ float prevHeight;
int prevEndType;
};
TextComposite::TextComposite(TextElement* pTextElement)
{
__pTextElementList = new (std::nothrow) LinkedList;
- SysTryReturn(NID_GRP
- , __pTextElementList
- , , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
+ SysTryReturn(NID_GRP, __pTextElementList, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
__wrap = TEXT_OBJECT_WRAP_TYPE_WORD;
__workStart = 0;
TextComposite::ForwardAnalyze(int startTextIndex, int textLength, int maxWidth, TextObjectWrapType wrap, int& actualLength,
int& width, int& height)
{
+ float maxWidthF = _CoordinateSystemUtils::ConvertToFloat(maxWidth);
+ float widthF = _CoordinateSystemUtils::ConvertToFloat(width);
+ float heightF = _CoordinateSystemUtils::ConvertToFloat(height);
+
+ int r = ForwardAnalyze(startTextIndex, textLength, maxWidthF, wrap, actualLength, widthF, heightF);
+
+ width = _CoordinateSystemUtils::ConvertToInteger(widthF);
+ height = _CoordinateSystemUtils::ConvertToInteger(heightF);
+
+ return r;
+}
+
+int
+TextComposite::ForwardAnalyze(int startTextIndex, int textLength, float maxWidth, TextObjectWrapType wrap, int& actualLength,
+ float& width, float& height)
+{
SysTryReturn(NID_GRP, 0 <= startTextIndex && startTextIndex < __length, -1, E_INVALID_ARG
, "[E_INVALID_ARG] The argument is invalid. startTextIndex(%d)", startTextIndex);
SysTryReturn(NID_GRP, textLength <= __length, -1, E_INVALID_ARG
, "[E_INVALID_ARG] The argument is invalid. textLength(%d)", textLength);
result r = E_SUCCESS;
- Dimension textSize;
+ FloatDimension textSize;
int elementTextOffset = 0;
int elementIndex = 0;
int textIndexFromElementOffset = 0;
- int remainingWidth = 0;
+ float remainingWidth = 0;
int remainingLength = 0;
int textCount = 0;
int currentLength = 0;
TextElement* pTextElement = null;
bool isFirstWord = true;
- Dimension tempTextSize;
+ FloatDimension tempTextSize;
int tempTextCount = 0;
actualLength = 0;
width = 0;
actualLength += textCount;
width += textSize.width;
- height = Math::Max(textSize.height, height);
+ height = (textSize.height > height) ? textSize.height : height;
if (__wrap == TEXT_OBJECT_WRAP_TYPE_WORD && ret != TEXT_RETBY_LIMITWIDTH)
{
}
int
-TextComposite::ForwardAnalyze(int startTextIndex, int textLength, float maxWidth, TextObjectWrapType wrap, int& actualLength,
- float& width, float& height)
+TextComposite::ForwardAnalyzeWithBaseline(int startTextIndex, int textLength, int maxWidth, TextObjectWrapType wrap, int& actualLength,
+ int& width, int& height, int& baseline)
{
- int newMaxWidth = _CoordinateSystemUtils::ConvertToInteger(maxWidth);
- int newWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int newHeight = _CoordinateSystemUtils::ConvertToInteger(height);
+ float maxWidthF = _CoordinateSystemUtils::ConvertToFloat(maxWidth);
+ float widthF = _CoordinateSystemUtils::ConvertToFloat(width);
+ float heightF = _CoordinateSystemUtils::ConvertToFloat(height);
+ float baselineF = _CoordinateSystemUtils::ConvertToFloat(baseline);
- int r = ForwardAnalyze(startTextIndex, textLength, newMaxWidth, wrap, actualLength, newWidth, newHeight);
+ int r = ForwardAnalyzeWithBaseline(startTextIndex, textLength, maxWidthF, wrap, actualLength, widthF, heightF, baselineF);
- width = _CoordinateSystemUtils::ConvertToFloat(newWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(newWidth);
+ width = _CoordinateSystemUtils::ConvertToInteger(widthF);
+ height = _CoordinateSystemUtils::ConvertToInteger(heightF);
+ baseline = _CoordinateSystemUtils::ConvertToInteger(baselineF);
return r;
}
int
-TextComposite::ForwardAnalyzeWithBaseline(int startTextIndex, int textLength, int maxWidth, TextObjectWrapType wrap, int& actualLength,
- int& width, int& height, int& baseline)
+TextComposite::ForwardAnalyzeWithBaseline(int startTextIndex, int textLength, float maxWidth, TextObjectWrapType wrap, int& actualLength,
+ float& width, float& height, float& baseline)
{
SysTryReturn(NID_GRP, 0 <= startTextIndex && startTextIndex < __length
, -1, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid. startTextIndex(%d)", startTextIndex);
result r = E_SUCCESS;
- Dimension textSize;
+ FloatDimension textSize;
int elementTextOffset = 0;
int elementIndex = 0;
int textIndexFromElementOffset = 0;
- int remainingWidth = 0;
+ float remainingWidth = 0;
int remainingLength = 0;
int textCount = 0;
int currentLength = 0;
TextElement* pTextElement = null;
bool isFirstWord = true;
- Dimension tempTextSize;
+ FloatDimension tempTextSize;
int tempTextCount = 0;
actualLength = 0;
width = 0;
remainingWidth = maxWidth;
remainingLength = textLength;
currentLength = Math::Min(remainingLength, currentLength);
- baseline = pTextElement->GetBaseline();
+ baseline = pTextElement->GetBaselineF();
pEnum = __pTextElementList->GetEnumeratorN();
for (int i = 0; i <= elementIndex; i++)
actualLength += textCount;
width += textSize.width;
- baseline = Math::Max(pTextElement->GetBaseline(), baseline);
+ baseline = (pTextElement->GetBaselineF() > baseline) ? pTextElement->GetBaselineF() : baseline;
+
if (height < textSize.height)
{
height = textSize.height;
return -1;
}
-int
-TextComposite::ForwardAnalyzeWithBaseline(int startTextIndex, int textLength, float maxWidth, TextObjectWrapType wrap, int& actualLength,
- float& width, float& height, int& baseline)
-{
- int newMaxWidth = _CoordinateSystemUtils::ConvertToInteger(maxWidth);
- int newWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int newHeight = _CoordinateSystemUtils::ConvertToInteger(height);
-
- int r = ForwardAnalyzeWithBaseline(startTextIndex, textLength, newMaxWidth, wrap, actualLength, newWidth, newHeight, baseline);
-
- width = _CoordinateSystemUtils::ConvertToFloat(newWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(newWidth);
-
- return r;
-}
-
result
-TextComposite::GetRegion(int textIndex, int textLength, int& width, int& height) const
+TextComposite::GetRegion(int textIndex, int textLength, float& width, float& height) const
{
if (textLength == 0)
{
result r = E_SUCCESS;
IEnumerator* pEnum = null;
TextElement* pTextElement = null;
- Dimension textSize;
+ FloatDimension textSize;
int currentLength = 0;
int elementTextOffset = 0;
int elementIndex = 0;
pTextElement->GetRegion(textIndexFromElementOffset, currentLength, textSize.width, textSize.height);
width += textSize.width;
- height = Math::Max(height, textSize.height);
+ height = (height > textSize.height) ? height : textSize.height;
textLength -= currentLength;
if (pEnum->MoveNext() != E_SUCCESS)
return r;
}
-result
-TextComposite::GetRegion(int textIndex, int textLength, float& width, float& height) const
-{
- int newWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int newHeight = _CoordinateSystemUtils::ConvertToInteger(height);
-
- result r = GetRegion(textIndex, textLength, newWidth, newHeight);
-
- width = _CoordinateSystemUtils::ConvertToFloat(newWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(newWidth);
-
- return r;
-}
-
-int
-TextComposite::GetHeight(int textIndex) const
+float
+TextComposite::GetHeightF(int textIndex) const
{
if (__length == 0)
{
pTextElement = GetElementAtTextIndex(textIndex, elementTextOffset, elementIndex, currentLength, textIndexFromElementOffset);
SysTryCatch(NID_GRP, pTextElement, , E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
- return pTextElement->GetHeight();
+ return pTextElement->GetHeightF();
CATCH:
return -1;
}
-float
-TextComposite::GetHeightF(int textIndex) const
-{
- return _CoordinateSystemUtils::ConvertToFloat(GetHeight(textIndex));
-}
-
result
-TextComposite::Draw(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
+TextComposite::Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
const TextObjectActionType action)
{
if (textLength == 0)
result r = E_SUCCESS;
IEnumerator* pEnum = null;
TextElement* pTextElement = null;
- Dimension textSize;
- Dimension spaceCharDim;
- Dimension abbrevTextDim;
- Rectangle adjustedRect = displayRect;
- Rectangle blockRect;
+ 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;
- _Canvas* pCanvas = _Canvas::GetInstance(canvasImpl);
- SysTryReturn(NID_GRP, pCanvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native canvas instance.");
if (__ignoreRearBlank && __rearSpaceHideMode == TEXT_OBJECT_SPACE_HIDE_TYPE_ONE)
{
GetRegion(startTextIndex, textLength, textSize.width, textSize.height);
if (action == TEXT_OBJECT_ACTION_TYPE_ABBREV)
{
- TextElement* pLastTextElement = null;
- pLastTextElement = (textLength == 0) ? GetElementAtTextIndex(startTextIndex) : GetElementAtTextIndex(startTextIndex + textLength - 1);
+ TextElement* pLastTextElement = (textLength == 0) ? GetElementAtTextIndex(startTextIndex) : 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)
SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Fail to move next element.", GetErrorMessage(r));
}
- blockRect = Rectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height);
+ blockRect = FloatRectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height);
currentLength = Math::Min(textLength, currentLength);
while (textLength > 0)
if (pTextElement->IsBackGroundDrawingModeEnable())
{
- DrawBackgroundBlock(canvasImpl, Rectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height), startTextIndex, currentLength, alignment, action);
+ 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 (pTextElement->IsBackGroundDrawingModeEnable())
{
- r = pCanvas->FillRectangle(pTextElement->GetBackgroundColor(), Rectangle(adjustedRect.x, displayRect.y, abbrevTextDim.width, displayRect.height));
+ 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));
}
}
result
-TextComposite::Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
- const TextObjectActionType action)
-{
- Rectangle newDisplayRect = _CoordinateSystemUtils::ConvertToInteger(displayRect);
-
- return Draw(canvasImpl, newDisplayRect, startTextIndex, textLength, alignment, action);
-}
-
-result
-TextComposite::DrawWithBaseline(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
+TextComposite::DrawWithBaseline(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
const TextObjectActionType action, int baseline)
{
if (textLength == 0)
IEnumerator* pEnum = null;
TextElement* pTextElement = null;
- Dimension textSize;
- Dimension spaceCharDim;
- Dimension abbrevTextDim;
- Rectangle adjustedRect = displayRect;
- Rectangle blockRect;
+ 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;
- _Canvas* pCanvas = _Canvas::GetInstance(canvasImpl);
- SysTryReturn(NID_GRP, pCanvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native canvas instance.");
-
if (__ignoreRearBlank && __rearSpaceHideMode == TEXT_OBJECT_SPACE_HIDE_TYPE_ONE)
{
pTextElement = GetElementAtTextIndex(startTextIndex + textLength - 1, elementTextOffset, elementIndex, currentLength, textIndexFromElementOffset);
SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Fail to move next element.", GetErrorMessage(r));
}
- blockRect = Rectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height);
+ blockRect = FloatRectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height);
adjustedRect.y = displayRect.y + displayRect.height - baseline;
canvasImpl.SetTextOrigin(TEXT_ORIGIN_BASELINE);
if (pTextElement->IsBackGroundDrawingModeEnable())
{
- DrawBackgroundBlock(canvasImpl, Rectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height), startTextIndex, currentLength, alignment, action);
+ 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;
DrawBlock(canvasImpl, blockRect, startTextIndex, currentLength, alignment, action);
}
- Rectangle imageRect = adjustedRect;
+ FloatRectangle imageRect = adjustedRect;
imageRect.y -= textSize.height;
TextElementType objectType = pTextElement->GetType();
{
if (pTextElement->IsBackGroundDrawingModeEnable())
{
- r = pCanvas->FillRectangle(pTextElement->GetBackgroundColor(), Rectangle(adjustedRect.x, displayRect.y, abbrevTextDim.width, displayRect.height));
+ 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));
}
}
result
-TextComposite::DrawWithBaseline(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
- const TextObjectActionType action, int baseline)
-{
- Rectangle newDisplayRect = _CoordinateSystemUtils::ConvertToInteger(displayRect);
-
- return DrawWithBaseline(canvasImpl, newDisplayRect, startTextIndex, textLength, alignment, action, baseline);
-}
-
-result
-TextComposite::DrawBlock(_CanvasImpl& canvasImpl, const Rectangle& displayRect, int startTextIndex, int textLength,
+TextComposite::DrawBlock(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect, int startTextIndex, int textLength,
const TextObjectAlignment align, const TextObjectActionType action)
{
int lineIndex = __pCurrentTextColumn->GetLineIndexAtTextIndex(startTextIndex);
return E_SUCCESS;
}
- _Canvas* pCanvas = _Canvas::GetInstance(canvasImpl);
- SysTryReturn(NID_GRP, pCanvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native canvas instance.");
-
- Rectangle lineBounds = pTextLine->GetBounds();
+ FloatRectangle lineBounds = pTextLine->GetBoundsF();
blockStartTextIndex -= lineOffset;
blockEndTextIndex -= lineOffset;
- Rectangle blockRect = displayRect;
+ FloatRectangle blockRect = displayRect;
blockRect.y = lineBounds.y;
- LinkedListT<_Util::Pair<int, int>* >* pGapList = pTextLine->GetTextExtentList();
-
- int left = 0;
- int right = 0;
- int blockStart = 0;
- int blockEnd = 0;
+ Collection::ArrayListT<_FloatPair>* pGapList = pTextLine->GetTextExtentList();
+
+ float left = 0;
+ float right = 0;
+ float blockStart = 0;
+ float blockEnd = 0;
- _Util::Pair<int, int>* pPair = null;
- IEnumeratorT<_Util::Pair<int, int>* >* pEnum = pGapList->GetEnumeratorN();
+ _FloatPair currentGap;
+ IEnumeratorT<_FloatPair >* pGapEnum = pGapList->GetEnumeratorN();
+ while (pGapEnum->MoveNext() == E_SUCCESS)
+ {
+ pGapEnum->GetCurrent(currentGap);
+ }
for (int i = 0; i <= blockStartTextIndex; i++)
{
- pEnum->MoveNext();
+ pGapEnum->MoveNext();
}
for (int count = 0; count < blockTextLength; count++)
{
- pEnum->GetCurrent(pPair);
- if (pPair)
+ pGapEnum->GetCurrent(currentGap);
+
+ if (right == currentGap.first || left == currentGap.second)
{
- if (right == pPair->first || left == pPair->second)
- {
- blockStart = (pPair->first < blockStart) ? pPair->first : blockStart;
- blockEnd = (pPair->second > blockEnd) ? pPair->second : blockEnd;
- }
- else
+ blockStart = (currentGap.first < blockStart) ? currentGap.first : blockStart;
+ blockEnd = (currentGap.second > blockEnd) ? currentGap.second : blockEnd;
+ }
+ else
+ {
+ if (blockStart != blockEnd)
{
- if (blockStart != blockEnd)
- {
- pCanvas->FillRectangle(__defaultBlockColor, Rectangle(blockRect.x + blockStart, displayRect.y, blockEnd - blockStart, displayRect.height));
- }
-
- blockStart = pPair->first;
- blockEnd = pPair->second;
+ canvasImpl.FillRectangle(__defaultBlockColor, FloatRectangle(blockRect.x + blockStart, displayRect.y, blockEnd - blockStart, displayRect.height));
}
- left = pPair->first;
- right = pPair->second;
+ blockStart = currentGap.first;
+ blockEnd = currentGap.second;
}
- pEnum->MoveNext();
+ left = currentGap.first;
+ right = currentGap.second;
+
+ pGapEnum->MoveNext();
}
if (blockStart != blockEnd)
{
- pCanvas->FillRectangle(__defaultBlockColor, Rectangle(blockRect.x + blockStart, displayRect.y, blockEnd - blockStart, displayRect.height));
+ canvasImpl.FillRectangle(__defaultBlockColor, FloatRectangle(blockRect.x + blockStart, displayRect.y, blockEnd - blockStart, displayRect.height));
}
if ((pTextLine->GetEndType() == TEXT_RETBY_LINEFEED) && (pTextLine->GetTextLength() == blockEndTextIndex))
{
- pCanvas->FillRectangle(__defaultBlockColor, Rectangle(blockRect.x + blockEnd, displayRect.y, LINE_FEED_WIDTH, displayRect.height));
+ canvasImpl.FillRectangle(__defaultBlockColor, FloatRectangle(blockRect.x + blockEnd, displayRect.y, LINE_FEED_WIDTH, displayRect.height));
}
- Release(pEnum);
+ Release(pGapEnum);
return E_SUCCESS;
}
result
-TextComposite::DrawBlock(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect, int startTextIndex, int textLength,
- const TextObjectAlignment align, const TextObjectActionType action)
-{
- Rectangle newDisplayRect = _CoordinateSystemUtils::ConvertToInteger(displayRect);
-
- return DrawBlock(canvasImpl, newDisplayRect, startTextIndex, textLength, align, action);
-}
-
-result
-TextComposite::DrawBackgroundBlock(_CanvasImpl& canvasImpl, const Rectangle& displayRect, int startTextIndex, int textLength,
+TextComposite::DrawBackgroundBlock(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect, int startTextIndex, int textLength,
const TextObjectAlignment align, const TextObjectActionType action)
{
if (textLength == 0)
TextLine* pTextLine = __pCurrentTextColumn->GetTextLine(__pCurrentTextColumn->GetLineIndexAtTextIndex(startTextIndex));
SysTryReturn(NID_GRP, pTextLine, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
- _Canvas* pCanvas = _Canvas::GetInstance(canvasImpl);
- SysTryReturn(NID_GRP, pCanvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native canvas instance.");
-
int blockEndTextIndex = startTextIndex + textLength;
- int prevLeft = 0;
- int prevRight = 0;
- int blockStart = 0;
- int blockEnd = 0;
+ float prevLeft = 0;
+ float prevRight = 0;
+ float blockStart = 0;
+ float blockEnd = 0;
int currentLength = 0;
int elementTextOffset = 0;
int elementIndex = 0;
int textIndexFromElementOffset = 0;
- Rectangle lineBounds = pTextLine->GetBounds();
+ FloatRectangle lineBounds = pTextLine->GetBoundsF();
blockEndTextIndex -= pTextLine->GetTextOffset();
- Rectangle blockRect = displayRect;
+ FloatRectangle blockRect = displayRect;
blockRect.y = lineBounds.y;
TextElement* pTextElement = GetElementAtTextIndex(startTextIndex, elementTextOffset, elementIndex, currentLength, textIndexFromElementOffset);
if (pSimpleText != null)
{
Color backgroundColor = pSimpleText->GetBackgroundColor();
+ const wchar_t* pText = pSimpleText->GetTextSource();
- _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*const_cast < Font* >(pSimpleText->GetFont())));
- SysTryReturn(NID_GRP, pFont, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
+ _FontImpl* pFontImpl = (_FontImpl::GetInstance(*const_cast < Font* >(pSimpleText->GetFont())));
+ SysTryReturn(NID_GRP, pFontImpl, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
- _Util::AccumList<_Util::Pair<int, int> > elemenGaptList;
- const wchar_t* pText = pSimpleText->GetTextSource();
- pFont->GetTextExtentList(_Util::String(pText, wcslen(pText), textIndexFromElementOffset, textLength), elemenGaptList);
+ Collection::ArrayListT<_FloatPair> elemenGapListF;
+ pFontImpl->GetTextExtentList(pText, textIndexFromElementOffset, textLength, elemenGapListF);
+
+ _FloatPair currentGap;
+ IEnumeratorT<_FloatPair >* pEnum = elemenGapListF.GetEnumeratorN();
- for (_Util::AccumList<_Util::Pair<int, int> >::Iterator iterator = elemenGaptList.Begin(); iterator != elemenGaptList.End(); iterator++)
+ while (pEnum->MoveNext() == E_SUCCESS)
{
- if (prevRight == iterator->first || prevLeft == iterator->second)
+ pEnum->GetCurrent(currentGap);
+
+ if (prevRight == currentGap.first || prevLeft == currentGap.second)
{
- blockStart = (iterator->first < blockStart) ? iterator->first : blockStart;
- blockEnd = (iterator->second > blockEnd) ? iterator->second : blockEnd;
+ blockStart = (currentGap.first < blockStart) ? currentGap.first : blockStart;
+ blockEnd = (currentGap.second > blockEnd) ? currentGap.second : blockEnd;
}
else
{
if (blockStart != blockEnd)
{
- pCanvas->FillRectangle(backgroundColor, Rectangle(blockRect.x + blockStart, displayRect.y, blockEnd - blockStart, displayRect.height));
+ canvasImpl.FillRectangle(backgroundColor, FloatRectangle(blockRect.x + blockStart, displayRect.y, blockEnd - blockStart, displayRect.height));
}
- blockStart = iterator->first;
- blockEnd = iterator->second;
+ blockStart = currentGap.first;
+ blockEnd = currentGap.second;
}
- prevLeft = iterator->first;
- prevRight = iterator->second;
+ prevLeft = currentGap.first;
+ prevRight = currentGap.second;
}
if (blockStart != blockEnd)
{
- pCanvas->FillRectangle(backgroundColor, Rectangle(blockRect.x + blockStart, displayRect.y, blockEnd - blockStart, displayRect.height));
+ canvasImpl.FillRectangle(backgroundColor, FloatRectangle(blockRect.x + blockStart, displayRect.y, blockEnd - blockStart, displayRect.height));
}
if ((pTextLine->GetEndType() == TEXT_RETBY_LINEFEED) && (pTextLine->GetTextLength() == blockEndTextIndex))
{
- pCanvas->FillRectangle(backgroundColor, Rectangle(blockRect.x + blockEnd, displayRect.y, LINE_FEED_WIDTH, displayRect.height));
+ canvasImpl.FillRectangle(backgroundColor, FloatRectangle(blockRect.x + blockEnd, displayRect.y, LINE_FEED_WIDTH, displayRect.height));
}
+
+ Release(pEnum);
}
}
}
result
-TextComposite::DrawBackgroundBlock(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect, int startTextIndex, int textLength,
- const TextObjectAlignment align, const TextObjectActionType action)
-{
- Rectangle newDisplayRect = _CoordinateSystemUtils::ConvertToInteger(displayRect);
-
- return DrawBackgroundBlock(canvasImpl, newDisplayRect, startTextIndex, textLength, align, action);
-}
-
-result
-TextComposite::DrawLine(_CanvasImpl& canvasImpl, TextLine* pTextLine, const Rectangle& displayRect,
+TextComposite::DrawLine(_CanvasImpl& canvasImpl, TextLine* pTextLine, const FloatRectangle& displayRect,
const TextObjectAlignment align, const TextObjectActionType action)
{
SysTryReturn(NID_GRP, pTextLine, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
int lineOffset = 0;
int lineLength = 0;
- Rectangle adjustedRect;
- Rectangle lineBounds;
- Dimension lineTextSize;
-
- _Canvas* pCanvas = _Canvas::GetInstance(canvasImpl);
- SysTryReturn(NID_GRP, pCanvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native canvas instance.");
+ FloatRectangle adjustedRect;
+ FloatRectangle lineBounds;
+ FloatDimension lineTextSize;
lineLength = pTextLine->GetTextLength();
lineOffset = pTextLine->GetTextOffset();
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
pTextLine->GetRegion(0, lineLength, lineTextSize.width, lineTextSize.height);
adjustedRect = displayRect;
}
result
-TextComposite::DrawLine(_CanvasImpl& canvasImpl, TextLine* pTextLine, const FloatRectangle& displayRect,
- const TextObjectAlignment align, const TextObjectActionType action)
-{
- Rectangle newDisplayRect = _CoordinateSystemUtils::ConvertToInteger(displayRect);
-
- return DrawLine(canvasImpl, pTextLine, newDisplayRect, align, action);
-}
-
-result
TextComposite::GetValue(TextElement* pTextElement, TextComponentInfoValueType type, unsigned int* value) const
{
SysTryReturn(NID_GRP, pTextElement, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
}
int
-TextComposite::Compose(Rectangle& rect, TextColumn* pTextColumn)
+TextComposite::Compose(FloatRectangle& rect, TextColumn* pTextColumn)
{
SysTryReturn(NID_GRP, pTextColumn, -1, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
return lineCount;
}
-int
-TextComposite::Compose(FloatRectangle& rect, TextColumn* pTextColumn)
-{
- Rectangle newRect = _CoordinateSystemUtils::ConvertToInteger(rect);
-
- return Compose(newRect, pTextColumn);
-}
-
result
TextComposite::SetRange(int textStartIndex, int textLength)
{
int
TextComposite::GetFontSize(int textIndex) const
{
- unsigned int value = 0;
-
- result r = GetValue(textIndex, SET_FONT_SIZE, &value);
- SysTryReturn(NID_GRP, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
-
- return (int)value;
+ return _CoordinateSystemUtils::ConvertToInteger(GetFontSizeF(textIndex));
}
float
TextComposite::GetFontSizeF(int textIndex) const
{
- return _CoordinateSystemUtils::ConvertToInteger(GetFontSize(textIndex));
+ unsigned int value = 0;
+
+ result r = GetValue(textIndex, SET_FONT_SIZE, &value);
+ SysTryReturn(NID_GRP, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return (float)value;
}
result
TextComposite::ForwardAnalyzeWithFocusedObjectType(int textIndex, int textLength, int maxWidth,
int& cursorIndex, TextElementType& type)
{
+ return ForwardAnalyzeWithFocusedObjectType(textIndex, textLength
+ , _CoordinateSystemUtils::ConvertToFloat(maxWidth), cursorIndex, type);
+}
+
+int
+TextComposite::ForwardAnalyzeWithFocusedObjectType(int textIndex, int textLength, float maxWidth,
+ int& cursorIndex, TextElementType& type)
+{
result r = E_SUCCESS;
- Dimension textSize;
+ FloatDimension textSize;
int currentLength = 0;
int elementTextOffset = 0;
int elementIndex = 0;
int textIndexFromElementOffset = 0;
int textCount = 0;
- int remainingWidth = 0;
+ float remainingWidth = 0;
int remainingLength = 0;
int ret = TEXT_RETBY_NORMAL;
bool isFirstWord = true;
if ((objectType == TEXT_ELEMENT_TYPE_TEXT || objectType == TEXT_ELEMENT_TYPE_CUTLINK) && (ret == TEXT_RETBY_LIMITWIDTH))
{
- Dimension tempTextSize;
+ FloatDimension tempTextSize;
r = pTextElement->GetRegion(textIndexFromElementOffset, textCount + 1, tempTextSize.width, tempTextSize.height);
SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
return -1;
}
-int
-TextComposite::ForwardAnalyzeWithFocusedObjectType(int textIndex, int textLength, float maxWidth,
- int& cursorIndex, TextElementType& type)
-{
- int newMaxWidth = _CoordinateSystemUtils::ConvertToInteger(maxWidth);
-
- return ForwardAnalyzeWithFocusedObjectType(textIndex, textLength, newMaxWidth, cursorIndex, type);
-}
-
void
TextComposite::HideFrontSpace(TextObjectSpaceHideType mode)
{
int
TextComposite::ForwardAnalyzeInNoneCursorMode(int startTextIndex, int textLength, int maxWidth, int& textIndex)
{
+ return ForwardAnalyzeInNoneCursorMode(startTextIndex, textLength
+ , _CoordinateSystemUtils::ConvertToFloat(maxWidth), textIndex);
+}
+
+int
+TextComposite::ForwardAnalyzeInNoneCursorMode(int startTextIndex, int textLength, float maxWidth, int& textIndex)
+{
result r = E_SUCCESS;
- Dimension textSize;
+ FloatDimension textSize;
int currentLength = 0;
int elementTextOffset = 0;
int elementIndex = 0;
int textIndexFromElementOffset = 0;
int textCount = 0;
- int remainingWidth = 0;
+ float remainingWidth = 0;
int remainingLength = 0;
int ret = TEXT_RETBY_NORMAL;
bool isFirstWord = true;
if ((objectType == TEXT_ELEMENT_TYPE_TEXT || objectType == TEXT_ELEMENT_TYPE_CUTLINK) && (ret == TEXT_RETBY_LIMITWIDTH))
{
- Dimension tempTextSize;
+ FloatDimension tempTextSize;
r = pTextElement->GetRegion(textIndexFromElementOffset, textCount + 1, tempTextSize.width, tempTextSize.height);
SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}
int
-TextComposite::ForwardAnalyzeInNoneCursorMode(int startTextIndex, int textLength, float maxWidth, int& textIndex)
-{
- int newMaxWidth = _CoordinateSystemUtils::ConvertToInteger(maxWidth);
-
- return ForwardAnalyzeInNoneCursorMode(startTextIndex, textLength, newMaxWidth, textIndex);
-}
-
-int
TextComposite::GetCutLinkElementCount(void) const
{
return __pCutLinkListInfo->GetCutLinkElementCount();
}
int
-TextComposite::ComposeInNoneWrap(Rectangle& rect, NoneWrapComposeInfo* pNoneWrapComposeInfo)
+TextComposite::ComposeInNoneWrap(FloatRectangle& rect, NoneWrapComposeInfo* pNoneWrapComposeInfo)
{
SysTryReturn(NID_GRP, __pCurrentTextColumn, -1, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not constructed yet.");
TextLine* pTextLine = null;
- Rectangle lineBounds;
- Dimension textSize;
+ FloatRectangle lineBounds;
+ FloatDimension textSize;
int lineOffset = 0;
int lineLength = 0;
int endType = TEXT_RETBY_NORMAL;
bool isChanged = false;
- int baseline = 0;
+ float baseline = 0;
int textIndex = 0;
textIndex = (__workStart < 0) ? 0 : __workStart;
pTextLine = __pCurrentTextColumn->GetTextLine(0);
SysTryReturn(NID_GRP, pTextLine, -1, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
endType = pTextLine->GetEndType();
if (lineBounds.width != rect.width)
}
else if (forwardSearch && textIndex >= lineOffset + lineLength)
{
- Dimension needDim;
+ FloatDimension needDim;
GetRegion(lineOffset + lineLength, textIndex - (lineOffset + lineLength) + 1, needDim.width, needDim.height);
int index = 0;
- int remainingWidth = needDim.width - (lineBounds.width - textSize.width);
+ float remainingWidth = needDim.width - (lineBounds.width - textSize.width);
- Dimension charDim;
+ FloatDimension charDim;
textSize.width += needDim.width;
lineLength += textIndex - (lineOffset + lineLength) + 1;
{
if (lineOffset > 0)
{
- Dimension lineTextSize;
+ FloatDimension lineTextSize;
int textCount = 0;
- int remainingWidth = 0;
+ float remainingWidth = 0;
pTextLine->GetRegion(0, lineLength, lineTextSize.width, lineTextSize.height);
remainingWidth = lineBounds.width - lineTextSize.width;
return 1;
}
-int
-TextComposite::ComposeInNoneWrap(FloatRectangle& rect, NoneWrapComposeInfo* pNoneWrapComposeInfo)
-{
- Rectangle newRect = _CoordinateSystemUtils::ConvertToInteger(rect);
-
- return ComposeInNoneWrap(newRect, pNoneWrapComposeInfo);
-}
-
result
TextComposite::GetTextExtentList(TextLine* pTextLine) const
{
int currentLength = 0;
int textIndexFromElementOffset = 0;
int remainingLength = 0;
- int right = 0;
- int maxWidth = 0;
+ float right = 0;
+ float maxWidth = 0;
TextElement* pTextElement = GetElementAtTextIndex(lineOffset, elementTextOffset, elementIndex, currentLength, textIndexFromElementOffset);
SysTryReturn(NID_GRP, pTextElement, -1, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
remainingLength = lineLength;
currentLength = Math::Min(remainingLength, currentLength);
- LinkedListT <_Util::Pair<int, int>* >* pGapList = new (std::nothrow) LinkedListT <_Util::Pair<int, int>* >;
- _Util::Pair<int, int>* pGap = null;
-
IEnumerator* pEnum = __pTextElementList->GetEnumeratorN();
for (int i = 0; i <= elementIndex; i++)
{
r = pEnum->MoveNext();
}
+ Collection::ArrayListT<_FloatPair>* pGapListF = new (std::nothrow) Collection::ArrayListT<_FloatPair>;
+ _FloatPair currentGap;
+
while (remainingLength != 0)
{
TextElementType objectType = pTextElement->GetType();
const Bitmap* pBitmap = pSimpleText->GetBitmap();
if (pBitmap)
{
- pGap = new (std::nothrow) _Util::Pair<int, int>;
- pGap->first = maxWidth;
- pGap->second = pGap->first + pBitmap->GetWidth() ;
+ currentGap.first = maxWidth;
+ currentGap.second = currentGap.first + pBitmap->GetWidth();
- pGapList->Add(pGap);
- right = (right < pGap->second) ? pGap->second : right;
+ pGapListF->Add(currentGap);
+ right = (right < currentGap.second) ? currentGap.second : right;
}
else
{
- _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*const_cast < Font* >(pSimpleText->GetFont())));
- SysTryReturn(NID_GRP, pFont, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
+ _FontImpl* pFontImpl = _FontImpl::GetInstance(*const_cast < Font* >(pSimpleText->GetFont()));
+ SysTryReturn(NID_GRP, pFontImpl, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
+
+ Collection::ArrayListT<_FloatPair> pCurrentElementGapListF;
- _Util::AccumList<_Util::Pair<int, int> > elemenGaptList;
const wchar_t* pText = pSimpleText->GetTextSource();
- pFont->GetTextExtentList(_Util::String(pText, wcslen(pText), textIndexFromElementOffset, currentLength), elemenGaptList);
+ pFontImpl->GetTextExtentList(pText, textIndexFromElementOffset, currentLength, pCurrentElementGapListF);
- for (_Util::AccumList<_Util::Pair<int, int> >::Iterator iterator = elemenGaptList.Begin(); iterator != elemenGaptList.End(); iterator++)
+ IEnumeratorT<_FloatPair >* pCurrentElementGapEnum = pCurrentElementGapListF.GetEnumeratorN();
+ while (pCurrentElementGapEnum->MoveNext() == E_SUCCESS)
{
- pGap = new (std::nothrow) _Util::Pair<int, int>;
- pGap->first = maxWidth + iterator->first;
- pGap->second = maxWidth + iterator->second;
+ pCurrentElementGapEnum->GetCurrent(currentGap);
+
+ currentGap.first = maxWidth + currentGap.first;
+ currentGap.second = maxWidth + currentGap.second;
- pGapList->Add(pGap);
- right = (right < pGap->second) ? pGap->second : right;
+ pGapListF->Add(currentGap);
+ right = (right < currentGap.second) ? currentGap.second : right;
}
+
+ Release(pCurrentElementGapEnum);
}
}
}
TextImage* pImageText = dynamic_cast < TextImage* >(pTextElement);
if (pImageText != null)
{
- Rectangle rect = pImageText->GetBounds();
+ FloatRectangle rect = pImageText->GetBoundsF();
- pGap = new (std::nothrow) _Util::Pair<int, int>;
- pGap->first = maxWidth;
- pGap->second = pGap->first + rect.width;
+ currentGap.first = maxWidth;
+ currentGap.second = currentGap.first + rect.width;
- pGapList->Add(pGap);
- right = (right < pGap->second) ? pGap->second : right;
+ pGapListF->Add(currentGap);
+ right = (right < currentGap.second) ? currentGap.second : right;
}
}
right = 0;
}
- pTextLine->SetTextExtentList(pGapList);
+ pTextLine->SetTextExtentList(pGapListF);
Release(pEnum);
}
int
-TextComposite::ComposeInWrap(Rectangle& rect)
+TextComposite::ComposeInWrap(FloatRectangle& rect)
{
SysTryReturn(NID_GRP, __pCurrentTextColumn, -1, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not constructed yet.");
int lineCount = 0;
int textIndex = 0;
int remainingLength = 0;
- int remainingWidth = 0;
- int remainingHeight = 0;
- int offsetY = 0;
+ float remainingWidth = 0;
+ float remainingHeight = 0;
+ float offsetY = 0;
bool hasPrevLine = false;
- Dimension textSize;
+ FloatDimension textSize;
TextLine* pTextLine = null;
int ret = 0;
int endType = TEXT_RETBY_NORMAL;
- Rectangle lineBounds;
- Dimension lineTextSize;
+ FloatRectangle lineBounds;
+ FloatDimension lineTextSize;
int lineOffset = 0;
int lineLength = 0;
int displayLineCount = 0;
- int displayHeight = 0;
- int baseline = 0;
- int lineBaseline = 0;
+ float displayHeight = 0;
+ float baseline = 0;
+ float lineBaseline = 0;
pTextLine = __pCurrentTextColumn->GetPrevLineChangedStartLine();
if (pTextLine != null)
endType = pTextLine->GetEndType();
lineOffset = pTextLine->GetTextOffset();
lineLength = pTextLine->GetTextLength();
- lineBounds = pTextLine->GetBounds();
- lineBaseline = pTextLine->GetBaseline();
+ lineBounds = pTextLine->GetBoundsF();
+ lineBaseline = pTextLine->GetBaselineF();
pTextLine->GetRegion(0, pTextLine->GetTextLength(), lineTextSize.width, lineTextSize.height);
if (endType != TEXT_RETBY_LINEFEED)
if (remainingLength == 0)
{
- int nextY = offsetY;
+ float nextY = offsetY;
lineTextSize.height = lineBounds.height;
pTextLine = new (std::nothrow)TextLine(this);
lineBounds.y = nextY;
pTextLine->SetBounds(lineBounds);
- pTextLine->SetRegion(0, lineTextSize.height);
+ pTextLine->SetRegion(0.0f, lineTextSize.height);
pTextLine->SetTextLength(0);
pTextLine->SetTextOffset(textIndex);
pTextLine->SetEndType(TEXT_RETBY_LINEFEED);
if (remainingLength == 0)
{
- lineTextSize.height = GetHeight(0);
+ lineTextSize.height = GetHeightF(0);
lineBounds.height = lineTextSize.height;
pTextLine->SetBounds(lineBounds);
- pTextLine->SetRegion(0, lineTextSize.height);
+ pTextLine->SetRegion(0.0f, lineTextSize.height);
pTextLine->SetTextLength(0);
pTextLine->SetTextOffset(textIndex);
pTextLine->SetEndType(TEXT_RETBY_NORMAL);
{
lineLength += textCount;
lineTextSize.width += textSize.width;
- lineBounds.height = Math::Max(lineBounds.height, textSize.height);
+ lineBounds.height = (lineBounds.height > textSize.height) ? lineBounds.height: textSize.height;
lineTextSize.height = lineBounds.height;
endType = ret;
- baseline = Math::Min(lineBaseline, baseline);
+ baseline = (lineBaseline > baseline) ? baseline : lineBaseline;
pTextLine->SetBounds(lineBounds);
pTextLine->SetRegion(lineTextSize.width, lineTextSize.height);
{
lineLength += textCount;
lineTextSize.width += textSize.width;
- lineBounds.height = Math::Max(lineBounds.height, textSize.height);
+ lineBounds.height = (lineBounds.height > textSize.height) ? lineBounds.height : textSize.height;
lineTextSize.height = lineBounds.height;
endType = ret;
- baseline = Math::Min(lineBaseline, baseline);
+ baseline = (lineBaseline > baseline) ? baseline : lineBaseline;
pTextLine->SetBounds(lineBounds);
pTextLine->SetRegion(lineTextSize.width, lineTextSize.height);
if (remainingLength > 0)
{
- int nextY = lineBounds.y + lineBounds.height;
+ float nextY = lineBounds.y + lineBounds.height;
pTextLine = new (std::nothrow)TextLine(this);
SysTryReturn(NID_GRP, pTextLine, -1, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
{
if (endType == TEXT_RETBY_LINEFEED)
{
- int nextY = lineBounds.y + lineBounds.height;
+ float nextY = lineBounds.y + lineBounds.height;
lineTextSize.height = lineBounds.height;
pTextLine = new (std::nothrow)TextLine(this);
lineBounds.height = lineTextSize.height;
pTextLine->SetBounds(lineBounds);
- pTextLine->SetRegion(0, lineTextSize.height);
+ pTextLine->SetRegion(0.0f, lineTextSize.height);
pTextLine->SetTextLength(0);
pTextLine->SetTextOffset(textIndex);
pTextLine->SetEndType(TEXT_RETBY_LINEFEED);
}
}
- Dimension columnTextSize;
+ FloatDimension columnTextSize;
__pCurrentTextColumn->GetRegion(0, __length, columnTextSize.width, columnTextSize.height);
rect.height = columnTextSize.height;
}
int
-TextComposite::ComposeInWrap(FloatRectangle& rect)
-{
- Rectangle newRect = _CoordinateSystemUtils::ConvertToInteger(rect);
-
- return ComposeInWrap(newRect);
-}
-
-int
-TextComposite::ComposeInPartialMode(Rectangle& rect)
+TextComposite::ComposeInPartialMode(FloatRectangle& rect)
{
- SysTryReturn(NID_GRP
- , __pCurrentTextColumn
- , -1, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not constructed yet.");
+ SysTryReturn(NID_GRP, __pCurrentTextColumn, -1, E_INVALID_STATE
+ , "[E_INVALID_STATE] This instance is not constructed yet.");
int textCount = 0;
int lineCount = 0;
int textIndex = 0;
int remainingLength = 0;
- int remainingWidth = 0;
- int remainingHeight = 0;
+ float remainingWidth = 0;
+ float remainingHeight = 0;
int lineOffset = 0;
int lineLength = 0;
- int offsetY = 0;
+ float offsetY = 0;
int ret = 0;
- Dimension textSize;
- Dimension lineTextSize;
- Rectangle lineBounds;
+ FloatDimension textSize;
+ FloatDimension lineTextSize;
+ FloatRectangle lineBounds;
bool hasPrevLine = false;
int displayLineCount = 0;
- int displayHeight = 0;
- int baseline = 0;
- int lineBaseline = 0;
+ float displayHeight = 0;
+ float baseline = 0;
+ float lineBaseline = 0;
TextLine* pTextLine = null;
int endType = TEXT_RETBY_NORMAL;
endType = pTextLine->GetEndType();
lineOffset = pTextLine->GetTextOffset();
lineLength = pTextLine->GetTextLength();
- lineBounds = pTextLine->GetBounds();
- lineBaseline = pTextLine->GetBaseline();
+ lineBounds = pTextLine->GetBoundsF();
+ lineBaseline = pTextLine->GetBaselineF();
pTextLine->GetRegion(0, pTextLine->GetTextLength(), lineTextSize.width, lineTextSize.height);
if (endType != TEXT_RETBY_LINEFEED)
if (remainingLength == 0)
{
- int nextY = offsetY;
+ float nextY = offsetY;
lineTextSize.height = lineBounds.height;
pTextLine = new (std::nothrow)TextLine(this);
lineBounds.y = nextY;
pTextLine->SetBounds(lineBounds);
- pTextLine->SetRegion(0, lineTextSize.height);
+ pTextLine->SetRegion(0.0f, lineTextSize.height);
pTextLine->SetTextLength(0);
pTextLine->SetTextOffset(textIndex);
pTextLine->SetEndType(TEXT_RETBY_LINEFEED);
if (remainingLength == 0)
{
- lineTextSize.height = GetHeight(0);
+ lineTextSize.height = GetHeightF(0);
lineBounds.height = lineTextSize.height;
pTextLine->SetBounds(lineBounds);
- pTextLine->SetRegion(0, lineTextSize.height);
+ pTextLine->SetRegion(0.0f, lineTextSize.height);
pTextLine->SetTextLength(0);
pTextLine->SetTextOffset(textIndex);
pTextLine->SetEndType(TEXT_RETBY_NORMAL);
}
}
- remainingHeight = GetComposePartialLimitHeight();
+ remainingHeight = GetComposePartialLimitHeightF();
if (remainingHeight == 0)
{
remainingHeight = rect.height;
{
lineLength += textCount;
lineTextSize.width += textSize.width;
- lineBounds.height = Math::Max(lineBounds.height, textSize.height);
+ lineBounds.height = (lineBounds.height > textSize.height) ? lineBounds.height: textSize.height;
lineTextSize.height = lineBounds.height;
endType = ret;
- baseline = Math::Min(lineBaseline, baseline);
+ baseline = (lineBaseline > baseline) ? baseline : lineBaseline;
pTextLine->SetBounds(lineBounds);
pTextLine->SetRegion(lineTextSize.width, lineTextSize.height);
{
lineLength += textCount;
lineTextSize.width += textSize.width;
- lineBounds.height = Math::Max(lineBounds.height, textSize.height);
+ lineBounds.height = (lineBounds.height > textSize.height) ? lineBounds.height : textSize.height;
lineTextSize.height = lineBounds.height;
endType = ret;
- baseline = Math::Min(lineBaseline, baseline);
+ baseline = (lineBaseline > baseline) ? baseline : lineBaseline;
pTextLine->SetBounds(lineBounds);
pTextLine->SetRegion(lineTextSize.width, lineTextSize.height);
if (remainingLength > 0)
{
- int nextY = lineBounds.y + lineBounds.height;
+ float nextY = lineBounds.y + lineBounds.height;
pTextLine = new (std::nothrow)TextLine(this);
SysTryReturn(NID_GRP, pTextLine, -1, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
{
if (endType == TEXT_RETBY_LINEFEED)
{
- int nextY = lineBounds.y + lineBounds.height;
+ float nextY = lineBounds.y + lineBounds.height;
lineTextSize.height = lineBounds.height;
pTextLine = new (std::nothrow)TextLine(this);
lineBounds.height = lineTextSize.height;
pTextLine->SetBounds(lineBounds);
- pTextLine->SetRegion(0, lineTextSize.height);
+ pTextLine->SetRegion(0.0f, lineTextSize.height);
pTextLine->SetTextLength(0);
pTextLine->SetTextOffset(textIndex);
pTextLine->SetEndType(TEXT_RETBY_LINEFEED);
}
int
-TextComposite::ComposeInPartialMode(FloatRectangle& rect)
-{
- Rectangle newRect = _CoordinateSystemUtils::ConvertToInteger(rect);
-
- return ComposeInPartialMode(newRect);
-}
-
-int
-TextComposite::ComposeInNormalWrap(Rectangle& rect)
-{
- return ComposeInWrap(rect);
-}
-
-int
TextComposite::ComposeInNormalWrap(FloatRectangle& rect)
{
- Rectangle newRect = _CoordinateSystemUtils::ConvertToInteger(rect);
-
- return ComposeInNormalWrap(newRect);
+ return ComposeInWrap(rect);
}
int
-TextComposite::ComposeInWordWrap(Rectangle& rect)
+TextComposite::ComposeInWordWrap(FloatRectangle& rect)
{
if (IsWidthManagerEnabled())
{
}
int
-TextComposite::ComposeInWordWrap(FloatRectangle& rect)
-{
- Rectangle newRect = _CoordinateSystemUtils::ConvertToInteger(rect);
-
- return ComposeInWordWrap(newRect);
-}
-
-int
-TextComposite::ComposeInNoneWrapMiddleEllipsis(Rectangle& rect)
+TextComposite::ComposeInNoneWrapMiddleEllipsis(FloatRectangle& rect)
{
int endType = TEXT_RETBY_NORMAL;
- Rectangle lineBounds;
- Dimension abbrevTextDim;
- Dimension textSize;
+ FloatRectangle lineBounds;
+ FloatDimension abbrevTextDim;
+ FloatDimension textSize;
int length = 0;
- int maxHeight = 0;
- int baseline = 0;
+ float maxHeight = 0;
+ float baseline = 0;
lineBounds.width = rect.width;
lineBounds.x = 0;
__pAbbrevTextElement->GetRegion(0, 1, abbrevTextDim.width, abbrevTextDim.height);
__middleEllipsisWidth = abbrevTextDim.width;
- ForwardAnalyze(0, __length, ((lineBounds.width - __middleEllipsisWidth + 10) >> 1), __wrap, length, textSize.width, textSize.height);
+ ForwardAnalyze(0, __length, ((lineBounds.width - __middleEllipsisWidth + 10.0f) / 2.0f), __wrap, length, textSize.width, textSize.height);
__middleEllipsisTextLengthInHead = length;
__middleEllipsisHeadWidth = textSize.width;
}
int
-TextComposite::ComposeInNoneWrapMiddleEllipsis(FloatRectangle& rect)
-{
- Rectangle newRect = _CoordinateSystemUtils::ConvertToInteger(rect);
-
- return ComposeInNoneWrapMiddleEllipsis(newRect);
-}
-
-int
-TextComposite::ComposeInNoneWrapHeadEllipsis(Rectangle& rect)
+TextComposite::ComposeInNoneWrapHeadEllipsis(FloatRectangle& rect)
{
SysTryReturn(NID_GRP, __pCurrentTextColumn, -1, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not constructed yet.");
int endType = TEXT_RETBY_NORMAL;
- Rectangle lineBounds;
- Dimension abbrevTextDim;
- Dimension textSize;
+ FloatRectangle lineBounds;
+ FloatDimension abbrevTextDim;
+ FloatDimension textSize;
int length = 0;
- int maxHeight = 0;
- int baseline = 0;
+ float maxHeight = 0;
+ float baseline = 0;
lineBounds.width = rect.width;
lineBounds.x = 0;
return 1;
}
-int
-TextComposite::ComposeInNoneWrapHeadEllipsis(FloatRectangle& rect)
-{
- Rectangle newRect = _CoordinateSystemUtils::ConvertToInteger(rect);
-
- return ComposeInNoneWrapHeadEllipsis(newRect);
-}
-
result
-TextComposite::DrawAbbrev(_CanvasImpl& canvasImpl, const Rectangle& displayRect, const TextObjectAlignment align)
+TextComposite::DrawAbbrev(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect, const TextObjectAlignment align)
{
if (__TextObjectEllipsisType == TEXT_OBJECT_ELLIPSIS_TYPE_MIDDLE)
{
}
result
-TextComposite::DrawAbbrev(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect, const TextObjectAlignment align)
-{
- Rectangle newDisplayRect = _CoordinateSystemUtils::ConvertToInteger(displayRect);
-
- return DrawAbbrev(canvasImpl, newDisplayRect, align);
-}
-
-result
TextComposite::GetValue(int textIndex, TextComponentInfoValueType type, unsigned int* value) const
{
IEnumerator* pEnum = null;
}
bool
-TextComposite::BackwardAnalyze(int startTextIndex, int maxWidth, int* actualLength, int* width, int* height)
+TextComposite::BackwardAnalyze(int startTextIndex, float maxWidth, int* actualLength, float* width, float* height)
{
- int remainingWidth = 0;
+ float remainingWidth = 0;
int length = 0;
- Dimension textSize;
+ FloatDimension textSize;
*actualLength = 0;
*width = 0;
return true;
}
-bool
-TextComposite::BackwardAnalyze(int startTextIndex, float maxWidth, int* actualLength, float* width, float* height)
-{
- int newMaxWidth = _CoordinateSystemUtils::ConvertToInteger(maxWidth);
- int newWidth = _CoordinateSystemUtils::ConvertToInteger(*width);
- int newHeight = _CoordinateSystemUtils::ConvertToInteger(*height);
-
- return BackwardAnalyze(startTextIndex, newMaxWidth, actualLength, &newWidth, &newHeight);
-}
-
int
TextComposite::GetFirstTextIndexAt(int elementIndex) const
{
}
result
-TextComposite::DrawAbbrevInMiddleEllipsis(_CanvasImpl& canvasImpl, const Rectangle& displayRect, const TextObjectAlignment alignment)
+TextComposite::DrawAbbrevInMiddleEllipsis(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect, const TextObjectAlignment alignment)
{
TextLine* pTextLine = __pCurrentTextColumn->GetTextLine(0);
SysTryReturn(NID_GRP, pTextLine, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- Dimension textSize;
- Rectangle adjustedRect;
+ FloatDimension textSize;
+ FloatRectangle adjustedRect;
pTextLine->GetRegion(0, __length, textSize.width, textSize.height);
adjustedRect.x = displayRect.x;
}
result
-TextComposite::DrawAbbrevInMiddleEllipsis(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect, const TextObjectAlignment alignment)
-{
- Rectangle newDisplayRect = _CoordinateSystemUtils::ConvertToInteger(displayRect);
-
- return DrawAbbrevInMiddleEllipsis(canvasImpl, newDisplayRect, alignment);
-}
-
-result
-TextComposite::DrawAbbrevInHeadEllipsis(_CanvasImpl& canvasImpl, const Rectangle& displayRect, const TextObjectAlignment alignment)
+TextComposite::DrawAbbrevInHeadEllipsis(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect, const TextObjectAlignment alignment)
{
TextLine* pTextLine = __pCurrentTextColumn->GetTextLine(0);
SysTryReturn(NID_GRP, pTextLine, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
result r = E_SUCCESS;
- Dimension textSize;
- Rectangle adjustedRect;
+ FloatDimension textSize;
+ FloatRectangle adjustedRect;
pTextLine->GetRegion(0, __length, textSize.width, textSize.height);
adjustedRect.x = displayRect.x;
}
result
-TextComposite::DrawAbbrevInHeadEllipsis(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect, const TextObjectAlignment alignment)
-{
- Rectangle newDisplayRect = _CoordinateSystemUtils::ConvertToInteger(displayRect);
-
- return DrawAbbrevInHeadEllipsis(canvasImpl, newDisplayRect, alignment);
-}
-
-result
-TextComposite::DrawPartial(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength)
+TextComposite::DrawPartial(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength)
{
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.");
IEnumerator* pEnum = null;
TextElement* pTextElement = null;
- Dimension textSize;
+ FloatDimension textSize;
int currentLength = 0;
int textIndexFromElementOffset = 0;
int nodeIndex = 0;
int elementTextOffset = 0;
- Rectangle adjustedRect = displayRect;
+ FloatRectangle adjustedRect = displayRect;
int blockStartTextIndex = 0;
int blockEndTextIndex = 0;
bool isAlternateLookEnabled = false;
int textIndex = startTextIndex;
- _Canvas* pCanvas = _Canvas::GetInstance(canvasImpl);
- SysTryReturn(NID_GRP, pCanvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native canvas instance.");
-
pTextElement = GetElementAtTextIndex(textIndex, elementTextOffset, nodeIndex, currentLength,
textIndexFromElementOffset);
SysTryReturn(NID_GRP, pTextElement, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
if (pTextElement->IsBackGroundDrawingModeEnable())
{
- r = pCanvas->FillRectangle(pTextElement->GetBackgroundColor(), Rectangle(adjustedRect.x, displayRect.y, textSize.width, displayRect.height));
+ r = canvasImpl.FillRectangle(pTextElement->GetBackgroundColor(), FloatRectangle(adjustedRect.x, displayRect.y, textSize.width, displayRect.height));
SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}
isAlternateLookEnabled = (pTextElement->GetValue(SET_ALTERNATE_LOOK) > 0) ? true : false;
if ((__displayBlock) && (isAlternateLookEnabled == false))
{
- Dimension tempTextSize;
- int adjustedX = 0;
+ FloatDimension tempTextSize;
+ float adjustedX = 0;
blockStartTextIndex = Math::Max(__workStart, textIndex);
blockEndTextIndex = Math::Min(__workStart + __workLength, textIndex + currentLength);
adjustedX += tempTextSize.width;
}
- Rectangle blockRect = adjustedRect;
+ FloatRectangle blockRect = adjustedRect;
blockRect.x = adjustedX;
}
}
return E_SUCCESS;
}
-result
-TextComposite::DrawPartial(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength)
-{
- Rectangle newDisplayRect = _CoordinateSystemUtils::ConvertToInteger(displayRect);
-
- return DrawPartial(canvasImpl, newDisplayRect, startTextIndex, textLength);
-}
-
void
TextComposite::SetPartialComposingModeEnabled(bool enable)
{
}
int
-TextComposite::ComposeInWrapByTextWidth(Rectangle& rect)
+TextComposite::ComposeInWrapByTextWidth(FloatRectangle& rect)
{
SysTryReturn(NID_GRP, __pCurrentTextColumn, false, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not constructed yet.");
- Rectangle lineBounds;
+ FloatRectangle lineBounds;
int lineCount = 0;
int textIndex = 0;
int remainingLength = 0;
- int remainingWidth = 0;
- int remainingHeight = 0;
- int offsetY = 0;
+ float remainingWidth = 0;
+ float remainingHeight = 0;
+ float offsetY = 0;
bool hasPrevLine = false;
int endType = TEXT_RETBY_NORMAL;
- Dimension lineTextSize;
+ FloatDimension lineTextSize;
int lineOffset = 0;
int lineLength = 0;
TextLine* pTextLine = null;
endType = pTextLine->GetEndType();
lineOffset = pTextLine->GetTextOffset();
lineLength = pTextLine->GetTextLength();
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
pTextLine->GetRegion(0, pTextLine->GetTextLength(), lineTextSize.width, lineTextSize.height);
if (endType != TEXT_RETBY_LINEFEED)
SysTryReturn(NID_GRP, pTextLine, -1, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
pTextLine->SetBounds(lineBounds);
- pTextLine->SetRegion(0, lineTextSize.height);
+ pTextLine->SetRegion(0.0f, lineTextSize.height);
pTextLine->SetTextLength(0);
pTextLine->SetTextOffset(textIndex);
pTextLine->SetEndType(TEXT_RETBY_LINEFEED);
if (remainingLength > 0)
{
- int nextY = lineBounds.y + lineBounds.height;
+ float nextY = lineBounds.y + lineBounds.height;
lineBounds.x = rect.x;
lineBounds.y = nextY;
{
if (composeInfo.endType == TEXT_RETBY_LINEFEED)
{
- int nextY = lineBounds.y + lineBounds.height;
+ float nextY = lineBounds.y + lineBounds.height;
lineTextSize.height = lineBounds.height;
pTextLine = new (std::nothrow)TextLine(this);
lineBounds.height = lineTextSize.height;
pTextLine->SetBounds(lineBounds);
- pTextLine->SetRegion(0, lineTextSize.height);
+ pTextLine->SetRegion(0.0f, lineTextSize.height);
pTextLine->SetTextLength(0);
pTextLine->SetTextOffset(textIndex);
pTextLine->SetEndType(TEXT_RETBY_LINEFEED);
__pTextWidthManager->EndCompose();
- Dimension columnSize;
+ FloatDimension columnSize;
__pCurrentTextColumn->GetRegion(0, __length, columnSize.width, columnSize.height);
rect.height = columnSize.height;
return lineCount;
}
-int
-TextComposite::ComposeInWrapByTextWidth(FloatRectangle& rect)
-{
- Rectangle newRect = _CoordinateSystemUtils::ConvertToInteger(rect);
-
- return ComposeInWrapByTextWidth(newRect);
-}
-
result
TextComposite::GetCutLinkObjectInfo(int cutLinkIndex, int& textStartIndex, int& textLength) const
{
int
TextComposite::GetTotalComposedHeight(void) const
{
- return __totalComposedHeight;
+ return _CoordinateSystemUtils::ConvertToInteger(__totalComposedHeight);
}
float
TextComposite::GetTotalComposedHeightF(void) const
{
- return _CoordinateSystemUtils::ConvertToFloat(__totalComposedHeight);
+ return __totalComposedHeight;
}
int
TextComposite::GetAnalysedTotalHeight(void) const
{
+ return _CoordinateSystemUtils::ConvertToInteger(GetAnalysedTotalHeightF());
+}
+
+float
+TextComposite::GetAnalysedTotalHeightF(void) const
+{
TextLine* pTextLine = null;
pTextLine = __pCurrentTextColumn->GetTextLine(__lineIndexCompositeDone - 1);
return 0;
}
- return (int)(GetTotalComposedHeight() * __length / composedLength);
-}
-
-float
-TextComposite::GetAnalysedTotalHeightF(void) const
-{
- return _CoordinateSystemUtils::ConvertToFloat(GetAnalysedTotalHeight());
+ return (float)(GetTotalComposedHeightF() * __length / composedLength);
}
void
TextComposite::SetComposePartialLimitHeight(int limitHeight)
{
- __composePartialLimitHeight = limitHeight;
+ __composePartialLimitHeight = _CoordinateSystemUtils::ConvertToFloat(limitHeight);
}
void
TextComposite::SetComposePartialLimitHeight(float limitHeight)
{
- __composePartialLimitHeight = _CoordinateSystemUtils::ConvertToInteger(limitHeight);
+ __composePartialLimitHeight = limitHeight;
}
int
TextComposite::GetComposePartialLimitHeight(void) const
{
- return __composePartialLimitHeight;
-
+ return _CoordinateSystemUtils::ConvertToInteger(__composePartialLimitHeight);
}
float
TextComposite::GetComposePartialLimitHeightF(void) const
{
- return _CoordinateSystemUtils::ConvertToFloat(__composePartialLimitHeight);
+ return __composePartialLimitHeight;
}
TextElementType
int textIndexFromElementOffset = 0;
int elementTextOffset = 0;
- pTextElement = GetElementAtTextIndex(textIndex, elementTextOffset
- , elementIndex, currentLength, textIndexFromElementOffset);
+ pTextElement = GetElementAtTextIndex(textIndex, elementTextOffset, elementIndex, currentLength, textIndexFromElementOffset);
if (pTextElement == null)
{
return TEXT_ELEMENT_TYPE_NONE;
void
TextComposite::SetLineSpace(int gap)
{
- __lineSpacing = gap;
+ SetLineSpace(_CoordinateSystemUtils::ConvertToFloat(gap));
}
void
TextComposite::SetLineSpace(float gap)
-{
- SetLineSpace(_CoordinateSystemUtils::ConvertToInteger(gap));
+{
+ __lineSpacing = gap;
}
int
TextComposite::GetLineSpace(void) const
{
- return __lineSpacing;
+ return _CoordinateSystemUtils::ConvertToInteger(__lineSpacing);
}
float
TextComposite::GetLineSpaceF(void) const
{
- return _CoordinateSystemUtils::ConvertToFloat(__lineSpacing);
+ return __lineSpacing;
}
void
}
Tizen::Base::String
-TextComposite::GetDisplayableText(Rectangle displayRect, TextObjectActionType action)
+TextComposite::GetDisplayableText(FloatRectangle displayRect, TextObjectActionType action)
{
int firstDisplayLineIndex = __pCurrentTextColumn->GetFirstDisplayLineIndex();
TextLine* pTextLine = __pCurrentTextColumn->GetTextLine(firstDisplayLineIndex);
if (action == TEXT_OBJECT_ACTION_TYPE_ABBREV)
{
- Dimension textSize;
- Dimension abbrevTextSize;
- Rectangle lineBounds = pTextLine->GetBounds();
+ FloatDimension textSize;
+ FloatDimension abbrevTextSize;
+ FloatRectangle lineBounds = pTextLine->GetBoundsF();
GetRegion(lineOffset, remainingLength, textSize.width, textSize.height);
return text;
}
-Tizen::Base::String
-TextComposite::GetDisplayableText(FloatRectangle displayRect, TextObjectActionType action)
-{
- Rectangle newDisplayRect = _CoordinateSystemUtils::ConvertToInteger(displayRect);
-
- return GetDisplayableText(newDisplayRect, action);
-}
-
void
TextComposite::SetTextWidthManager(TextWidthManager* pTextWidthManager)
{
TextComposite::SetWorkWidth(Font* pFont, wchar_t* pText, int workStart, int textLength)
{
result r = E_SUCCESS;
- int width = 0;
- int height = 0;
+ float width = 0;
+ float height = 0;
int workLength = 0;
const wchar_t* pSrc = &pText[workStart];
return E_SUCCESS;
}
-int
+float
TextComposite::GetWorkWidth(void)
{
return __workWidth;
int& actualLength, int& width, int& height, int& baseline);
virtual int ForwardAnalyzeWithBaseline(int startTextIndex, int textLength, float maxWidth, TextObjectWrapType wrap,
- int& actualLength, float& width, float& height, int& baseline);
+ int& actualLength, float& width, float& height, float& baseline);
virtual int ForwardAnalyzeWithFocusedObjectType(int textIndex, int textLength, int maxWidth,
int& cursorIndex, TextElementType& type);
virtual int ForwardAnalyzeWithFocusedObjectType(int textIndex, int textLength, float maxWidth,
int& cursorIndex, TextElementType& type);
- virtual result Draw(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
- const TextObjectActionType action);
-
virtual result Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
const TextObjectActionType action);
- virtual result GetRegion(int textIndex, int textLength, int& width, int& height) const;
-
virtual result GetRegion(int textIndex, int textLength, float& width, float& height) const;
- virtual int GetHeight(int textIndex) const;
-
virtual float GetHeightF(int textIndex) const;
virtual int GetTextLength(void) const;
- virtual int Compose(Rectangle& rect, TextColumn* pTextColumn);
-
virtual int Compose(FloatRectangle& rect, TextColumn* pTextColumn);
result DrawWithBaseline(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
result RemoveAllElements(bool deallocate = true);
- result DrawLine(_CanvasImpl& canvasImpl, TextLine* pTextLine, const Rectangle& displayRect, const TextObjectAlignment align, const TextObjectActionType action);
-
result DrawLine(_CanvasImpl& canvasImpl, TextLine* pTextLine, const FloatRectangle& displayRect, const TextObjectAlignment align, const TextObjectActionType action);
- result DrawPartial(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength);
-
result DrawPartial(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength);
- result DrawAbbrev(_CanvasImpl& canvasImpl, const Rectangle& displayRect, const TextObjectAlignment align);
-
result DrawAbbrev(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect, const TextObjectAlignment align);
result GetText(TextComposite* pTargetCompsiteText, int textIndex, int textLength);
result SetWorkWidth(Font* pFont, wchar_t* pText, int workStart, int textLength);
- int GetWorkWidth(void);
+ float GetWorkWidth(void);
void SetTextSweepInfo(TextObjectSweepInfo* pTextSweepInfo);
result GetTextExtentList(TextLine* pTextLine) const;
- Tizen::Base::String GetDisplayableText(Rectangle displayRect, TextObjectActionType action);
-
Tizen::Base::String GetDisplayableText(FloatRectangle displayRect, TextObjectActionType action);
private:
- int ComposeInNoneWrap(Rectangle& rect, NoneWrapComposeInfo* pNoneWrapComposeInfo = null);
-
int ComposeInNoneWrap(FloatRectangle& rect, NoneWrapComposeInfo* pNoneWrapComposeInfo = null);
- int ComposeInNormalWrap(Rectangle& rect);
-
int ComposeInNormalWrap(FloatRectangle& rect);
- int ComposeInWordWrap(Rectangle& rect);
-
int ComposeInWordWrap(FloatRectangle& rect);
- int ComposeInWrap(Rectangle& rect);
-
int ComposeInWrap(FloatRectangle& rect);
- int ComposeInWrapByTextWidth(Rectangle& rect);
-
int ComposeInWrapByTextWidth(FloatRectangle& rect);
- int ComposeInNoneWrapMiddleEllipsis(Rectangle& rect);
-
int ComposeInNoneWrapMiddleEllipsis(FloatRectangle& rect);
- int ComposeInNoneWrapHeadEllipsis(Rectangle& rect);
-
int ComposeInNoneWrapHeadEllipsis(FloatRectangle& rect);
- int ComposeInPartialMode(Rectangle& rect);
-
int ComposeInPartialMode(FloatRectangle& rect);
- bool BackwardAnalyze(int startTextIndex, int maxWidth, int* actualLength, int* width, int* height);
-
bool BackwardAnalyze(int startTextIndex, float maxWidth, int* actualLength, float* width, float* height);
- result DrawAbbrevInMiddleEllipsis(_CanvasImpl& canvasImpl, const Rectangle& displayRect, const TextObjectAlignment alignment);
-
result DrawAbbrevInMiddleEllipsis(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect, const TextObjectAlignment alignment);
- result DrawAbbrevInHeadEllipsis(_CanvasImpl& canvasImpl, const Rectangle& displayRect, const TextObjectAlignment alignmen);
-
result DrawAbbrevInHeadEllipsis(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect, const TextObjectAlignment alignmen);
result SetValueToAllTextElements(TextComponentInfoValueType type, unsigned int value);
int GetFirstTextIndexAt(int elementIndex) const;
- result DrawBlock(_CanvasImpl& canvasImpl, const Rectangle& displayRect, int startTextIndex, int textLength,
- const TextObjectAlignment align, const TextObjectActionType action);
-
result DrawBlock(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect, int startTextIndex, int textLength,
const TextObjectAlignment align, const TextObjectActionType action);
- result DrawBackgroundBlock(_CanvasImpl& canvasImpl, const Rectangle& displayRect, int startTextIndex, int textLength,
- const TextObjectAlignment align, const TextObjectActionType action);
-
result DrawBackgroundBlock(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect, int startTextIndex, int textLength,
const TextObjectAlignment align, const TextObjectActionType action);
bool __displayBlock;
int __workStart;
int __workLength;
- int __workWidth;
+ float __workWidth;
int __cursorIndex;
bool __ignoreRearBlank;
bool __ignoreFrontBlank;
TextObjectSpaceHideType __rearSpaceHideMode;
TextObjectSpaceHideType __frontSpaceHideMode;
- int __lineSpacing;
+ float __lineSpacing;
TextObjectAlignment __elementVertialAlignment;
TextColumn* __pCurrentTextColumn;
TextSimple* __pAbbrevTextElement;
bool __partialComposingModeEnabled;
int __lineIndexCompositeDone;
- int __totalComposedHeight;
- int __composePartialLimitHeight;
+ float __totalComposedHeight;
+ float __composePartialLimitHeight;
TextCutLinkListInfo* __pCutLinkListInfo;
TextObjectEllipsisType __TextObjectEllipsisType;
bool __drawAbbrevText;
bool __drawTextEllipsis;
int __middleEllipsisTextLengthInHead;
- int __middleEllipsisHeadWidth;
- int __middleEllipsisWidth;
+ float __middleEllipsisHeadWidth;
+ float __middleEllipsisWidth;
int __middleEllipsisTextLengthInTail;
- int __headEllipsisWidth;
+ float __headEllipsisWidth;
int __headEllipsisTextLength;
TextWidthManager* __pTextWidthManager;
bool __widthManagerEnabled;
return E_SYSTEM;
}
-result
-TextElement::GetBlockRegion(int textIndex, int textLength, int& width, int& height) const
-{
- return E_SYSTEM;
-}
-
-result
-TextElement::GetBlockRegion(int textIndex, int textLength, float& width, float& height) const
-{
- return E_SYSTEM;
-}
-
int
TextElement::GetHeight(void) const
{
{
return -1;
}
+
+float
+TextElement::GetBaselineF(void) const
+{
+ return -1;
+}
+
void
TextElement::SetForegroundColor(const Color& color)
{
#include "FGrp_TextCommon.h"
#include "FGrp_TextTextElement.h"
#include "FGrp_TextTextImage.h"
-#include "../FGrp_BitmapUtil.h"
-#include "../FGrp_Canvas.h"
#include "FGrp_CoordinateSystemUtils.h"
namespace Tizen { namespace Graphics
namespace _Text
{
-TextImage::TextImage(Bitmap& bitmap, TextElementSourceType sourceType, Rectangle* pRect, TextObjectAlignment align)
+TextImage::TextImage(Bitmap& bitmap, TextElementSourceType sourceType, TextObjectAlignment align)
: TextElement()
{
result r = E_SUCCESS;
__pBitmap = &bitmap;
}
- if (pRect == null)
- {
- __rect.x = 0;
- __rect.y = 0;
- __rect.width = __pBitmap->GetWidth();
- __rect.height = __pBitmap->GetHeight();
- }
- else
- {
- __rect = *pRect;
- }
+ __rect.x = 0;
+ __rect.y = 0;
+ __rect.width = __pBitmap->GetWidthF();
+ __rect.height = __pBitmap->GetHeightF();
+
return;
CATCH:
}
int
-TextImage::ForwardAnalyze(int startTextIndex, int textLength, int maxWidth, TextObjectWrapType wrap, int& actualLength,
- int& width, int& height)
+TextImage::ForwardAnalyze(int startTextIndex, int textLength, float maxWidth, TextObjectWrapType wrap,
+ int& actualLength, float& width, float& height)
{
- SysTryReturn(NID_GRP
- , 0 <= startTextIndex && startTextIndex < _length
+ SysTryReturn(NID_GRP, 0 <= startTextIndex && startTextIndex < _length
, -1, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
- SysTryReturn(NID_GRP
- , textLength <= _length
+ SysTryReturn(NID_GRP, textLength <= _length
, -1, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
actualLength = 0;
return TEXT_RETBY_NORMAL;
}
-int
-TextImage::ForwardAnalyze(int startTextIndex, int textLength, float maxWidth, TextObjectWrapType wrap,
- int& actualLength, float& width, float& height)
-{
- int iMaxWidth = _CoordinateSystemUtils::ConvertToInteger(maxWidth);
- int iWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int iHeight = _CoordinateSystemUtils::ConvertToInteger(height);
- int r = ForwardAnalyze(startTextIndex, textLength, iMaxWidth, wrap, actualLength, iWidth, iHeight);
- width = _CoordinateSystemUtils::ConvertToFloat(iWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(iHeight);
- return r;
-}
-
result
-TextImage::GetRegion(int textIndex, int textLength, int& width, int& height) const
+TextImage::GetRegion(int textIndex, int textLength, float& width, float& height) const
{
- SysTryReturn(NID_GRP
- , 0 <= textIndex && textIndex < _length
+ SysTryReturn(NID_GRP, 0 <= textIndex && textIndex < _length
, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
- SysTryReturn(NID_GRP
- , textLength <= _length
+ SysTryReturn(NID_GRP, textLength <= _length
, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
if (textLength == 0)
return E_SUCCESS;
}
-result
-TextImage::GetRegion(int textIndex, int textLength, float& width, float& height) const
-{
- int iWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int iHeight = _CoordinateSystemUtils::ConvertToInteger(height);
- result r = GetRegion(textIndex, textLength, iWidth, iHeight);
- width = _CoordinateSystemUtils::ConvertToFloat(iWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(iHeight);
- return r;
-}
-
-result
-TextImage::GetBlockRegion(int textIndex, int textLength, int& width, int& height) const
-{
- return GetRegion(textIndex, textLength, width, height);
-}
-
-result
-TextImage::GetBlockRegion(int textIndex, int textLength, float& width, float& height) const
-{
- int iWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int iHeight = _CoordinateSystemUtils::ConvertToInteger(height);
- result r = GetBlockRegion(textIndex, textLength, iWidth, iHeight);
- width = _CoordinateSystemUtils::ConvertToFloat(iWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(iHeight);
- return r;
-}
-
int
TextImage::GetHeight(void) const
{
- return __rect.height;
+ return _CoordinateSystemUtils::ConvertToInteger(GetHeightF());
}
float
TextImage::GetHeightF(void) const
{
- return _CoordinateSystemUtils::ConvertToFloat(GetHeight());
+ return __rect.height;
}
result
-TextImage::Draw(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment align, const TextObjectActionType action)
+TextImage::Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength,
+ const TextObjectAlignment align, const TextObjectActionType action)
{
- SysTryReturn(NID_GRP
- , __pBitmap
- , E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not constructed yet.");
+ SysTryReturn(NID_GRP, __pBitmap, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not constructed yet.");
result r = E_SUCCESS;
if (textLength == 0)
return E_SUCCESS;
}
- _Canvas* pCanvas = _Canvas::GetInstance(canvasImpl);
- SysTryReturn(NID_GRP
- , pCanvas
- , E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native canvas instance.");
-
-
- Rectangle bitmapRect = displayRect;
+ FloatRectangle bitmapRect = displayRect;
if (bitmapRect.width <= 0)
{
break;
}
- r = pCanvas->DrawBitmap(bitmapRect, *_GetBitmapEx(*_BitmapImpl::GetInstance(*__pBitmap)));
- SysTryReturn(NID_GRP
- , r == E_SUCCESS
- , r, r, "[%s] Propagating.", GetErrorMessage(r));
+ r = canvasImpl.DrawBitmap(bitmapRect, *_BitmapImpl::GetInstance(*__pBitmap));
+ SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
if (_hasFocus)
{
- r = pCanvas->DrawRectangle(_Util::Convert<Rectangle, _Util::Rectangle<double> >(bitmapRect));
- SysTryReturn(NID_GRP
- , r == E_SUCCESS
- , r, r, "[%s] Propagating.", GetErrorMessage(r));
+ r = canvasImpl.DrawRectangle(bitmapRect);
+ SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}
return E_SUCCESS;
}
-result
-TextImage::Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength,
- const TextObjectAlignment align, const TextObjectActionType action)
-{
- Rectangle iDisplayRect;
- iDisplayRect.x = _CoordinateSystemUtils::ConvertToInteger(displayRect.x);
- iDisplayRect.y = _CoordinateSystemUtils::ConvertToInteger(displayRect.y);
- iDisplayRect.width = _CoordinateSystemUtils::ConvertToInteger(displayRect.width);
- iDisplayRect.height = _CoordinateSystemUtils::ConvertToInteger(displayRect.height);
-
- return Draw(canvasImpl, iDisplayRect, startTextIndex, textLength, align, action);
-}
-
TextElement*
TextImage::CloneN(TextComponentInfoValueType type, unsigned int value)
{
TextImage* pImageText = null;
- pImageText = new (std::nothrow) TextImage(*__pBitmap, TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL, &__rect, __align);
+ pImageText = new (std::nothrow) TextImage(*__pBitmap, TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL, __align);
SysTryReturn(NID_GRP
, pImageText
, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
textLength = 1;
}
- TextImage* pImageText = null;
-
- pImageText = new (std::nothrow) TextImage(*__pBitmap, _sourceType, &__rect, __align);
- SysTryReturn(NID_GRP
- , pImageText
- , null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
+ TextImage* pImageText = new (std::nothrow) TextImage(*__pBitmap, _sourceType, __align);
+ SysTryReturn(NID_GRP, pImageText, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
return pImageText;
}
result
TextImage::SetBounds(const Rectangle& rect)
{
- __rect = rect;
- __rect.x = 0;
- __rect.y = 0;
-
- return E_SUCCESS;
+ return SetBounds(_CoordinateSystemUtils::ConvertToFloat(rect));
}
result
TextImage::SetBounds(const FloatRectangle& rect)
{
- const Rectangle iRect = _CoordinateSystemUtils::ConvertToInteger(rect);
- return SetBounds(iRect);
+ __rect = rect;
+ __rect.x = 0;
+ __rect.y = 0;
+
+ return E_SUCCESS;
}
result
Rectangle
TextImage::GetBounds(void) const
{
- return __rect;
+ return _CoordinateSystemUtils::ConvertToInteger(GetBoundsF());
}
FloatRectangle
TextImage::GetBoundsF(void) const
{
- return _CoordinateSystemUtils::ConvertToFloat(GetBounds());
+ return __rect;
}
TextObjectAlignment
return 0;
}
+float
+TextImage::GetBaselineF(void) const
+{
+ return 0;
+}
+
}}} // Tizen::Graphics::_Text
result
TextLine::GetRegion(int textIndex, int textLength, int& width, int& height) const
{
+ float widthF = _CoordinateSystemUtils::ConvertToFloat(width);
+ float heightF = _CoordinateSystemUtils::ConvertToFloat(height);
+
+ result r = GetRegion(textIndex, textLength, widthF, heightF);
+
+ width = _CoordinateSystemUtils::ConvertToInteger(widthF);
+ height = _CoordinateSystemUtils::ConvertToInteger(heightF);
+
+ return r;
+}
+
+result
+TextLine::GetRegion(int textIndex, int textLength, float& width, float& height) const
+{
if (textIndex != 0 || textLength != __textLength)
{
return __pCompositeText->GetRegion(textIndex + __textOffset, textIndex + textLength + __textOffset, width, height);
-
}
width = __width;
return E_SUCCESS;
}
-result
-TextLine::GetRegion(int textIndex, int textLength, float& width, float& height) const
-{
- int iWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int iHeight = _CoordinateSystemUtils::ConvertToInteger(height);
- result r = GetRegion(textIndex, textLength, iWidth, iHeight);
- width = _CoordinateSystemUtils::ConvertToFloat(iWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(iHeight);
- return r;
-}
-
-int
-TextLine::GetHeight(int textIndex) const
+float
+TextLine::GetHeightF(int textIndex) const
{
if (textIndex == -1)
{
}
else if (textIndex >= 0 && textIndex < __textLength)
{
- return __pCompositeText->GetHeight(textIndex + __textOffset);
+ return __pCompositeText->GetHeightF(textIndex + __textOffset);
}
else
{
}
}
-float
-TextLine::GetHeightF(int textIndex) const
-{
- return _CoordinateSystemUtils::ConvertToFloat(GetHeight(textIndex));
-}
-
-result
-TextLine::Draw(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment align,
- const TextObjectActionType action)
-{
- SysTryReturn(NID_GRP
- , startTextIndex == 0 && textLength == __textLength && __pCompositeText != null
- , E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
-
- return __pCompositeText->DrawLine(canvasImpl, this, displayRect, align, action);
-}
-
result
TextLine::Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength,
const TextObjectAlignment align, const TextObjectActionType action)
{
- SysTryReturn(NID_GRP
- , startTextIndex == 0 && textLength == __textLength && __pCompositeText != null
+ SysTryReturn(NID_GRP, startTextIndex == 0 && textLength == __textLength && __pCompositeText != null
, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
- Rectangle iDisplayRect;
- iDisplayRect.x = _CoordinateSystemUtils::ConvertToInteger(displayRect.x);
- iDisplayRect.y = _CoordinateSystemUtils::ConvertToInteger(displayRect.y);
- iDisplayRect.width = _CoordinateSystemUtils::ConvertToInteger(displayRect.width);
- iDisplayRect.height = _CoordinateSystemUtils::ConvertToInteger(displayRect.height);
-
- return Draw(canvasImpl, iDisplayRect, startTextIndex, textLength, align, action);
+ return __pCompositeText->DrawLine(canvasImpl, this, displayRect, align, action);
}
result
-TextLine::DrawPartial(_CanvasImpl& canvasImpl, int startTextIndex, int textLength, Rectangle& displayRect)
+TextLine::DrawPartial(_CanvasImpl& canvasImpl, int startTextIndex, int textLength, FloatRectangle& displayRect)
{
- SysTryReturn(NID_GRP
- , __pCompositeText != null
- , E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ SysTryReturn(NID_GRP, __pCompositeText != null, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
int textIndexAtLine = GetTextOffset() + startTextIndex;
return __pCompositeText->DrawPartial(canvasImpl, displayRect, textIndexAtLine, textLength);
}
-result
-TextLine::DrawPartial(_CanvasImpl& canvasImpl, int startTextIndex, int textLength, FloatRectangle& displayRect)
-{
- SysTryReturn(NID_GRP
- , __pCompositeText != null
- , E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
-
- Rectangle iDisplayRect;
- iDisplayRect.x = _CoordinateSystemUtils::ConvertToInteger(displayRect.x);
- iDisplayRect.y = _CoordinateSystemUtils::ConvertToInteger(displayRect.y);
- iDisplayRect.width = _CoordinateSystemUtils::ConvertToInteger(displayRect.width);
- iDisplayRect.height = _CoordinateSystemUtils::ConvertToInteger(displayRect.height);
-
- return DrawPartial(canvasImpl, startTextIndex, textLength, iDisplayRect);
-}
-
TextLine*
TextLine::CopyN(void)
{
void
TextLine::SetRegion(int width, int height)
{
- __width = width;
- __height = height;
+ SetRegion(_CoordinateSystemUtils::ConvertToFloat(width), _CoordinateSystemUtils::ConvertToFloat(height));
return;
}
void
TextLine::SetRegion(float width, float height)
{
- SetRegion(_CoordinateSystemUtils::ConvertToInteger(width), _CoordinateSystemUtils::ConvertToInteger(height));
+ __width = width;
+ __height = height;
return;
}
void
TextLine::SetBaseline(int baseline)
{
+ __baseline = _CoordinateSystemUtils::ConvertToFloat(baseline);
+}
+
+void
+TextLine::SetBaseline(float baseline)
+{
__baseline = baseline;
}
int
TextLine::GetBaseline(void) const
{
- return __baseline;
+ return _CoordinateSystemUtils::ConvertToInteger(__baseline);
}
-int
-TextLine::ForwardAnalyze(int startTextIndex, int textLength, int maxWidth, TextObjectWrapType wrap,
- int& actualLength, int& width, int& height)
+float
+TextLine::GetBaselineF(void) const
{
- return -1;
+ return __baseline;
}
int
}
void
-TextLine::SetSweepIn(int sweepIn)
+TextLine::SetSweepIn(float sweepIn)
{
__sweepIn = sweepIn;
}
-int
+float
TextLine::GetSweepIn(void) const
{
return __sweepIn;
}
void
-TextLine::SetSweepOut(int sweepOut)
+TextLine::SetSweepOut(float sweepOut)
{
__sweepOut = sweepOut;
}
-int
+float
TextLine::GetSweepOut(void) const
{
return __sweepOut;
}
result
-TextLine::SetTextExtentList(LinkedListT<_Util::Pair<int, int>* >* pList)
+TextLine::SetTextExtentList(Collection::ArrayListT<_FloatPair>* pList)
{
if (__pExtentList)
{
return E_SUCCESS;
}
-LinkedListT<_Util::Pair<int, int>* >*
+Tizen::Base::Collection::ArrayListT<_FloatPair>*
TextLine::GetTextExtentList(void) const
{
return __pExtentList;
int
TextLine::GetTextIndexFromPosition(int pcX, bool cursorMode)
{
- SysTryReturn(NID_GRP, pcX >= 0
- , -1, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
-
- SysTryReturn(NID_GRP, __pExtentList
- , -1, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
-
- _Util::Pair<int, int>* pPair = null;
- IEnumeratorT<_Util::Pair<int, int>* >* pEnum = __pExtentList->GetEnumeratorN();
- pEnum->MoveNext();
+ SysTryReturn(NID_GRP, pcX >= 0, -1, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ SysTryReturn(NID_GRP, __pExtentList, -1, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ int index = 0;
int textIndex = -1;
+ _FloatPair currentGap;
+ IEnumeratorT<_FloatPair >* pEnum = __pExtentList->GetEnumeratorN();
- for (int i = 0; i < __textLength; i++, pEnum->MoveNext())
+ while (pEnum->MoveNext() == E_SUCCESS)
{
- pEnum->GetCurrent(pPair);
- if (pPair)
+ pEnum->GetCurrent(currentGap);
+
+ if (currentGap.first <= pcX && pcX < currentGap.second)
{
- if (pPair->first <= pcX && pcX < pPair->second)
+ textIndex = index + __textOffset;
+
+ FriBidiChar text[1] = { __pCompositeText->GetCharacter(textIndex) };
+ FriBidiCharType type[1] = { 0 };
+ fribidi_get_bidi_types(text, 1, type);
+ bool isRtl = (type[0] & FRIBIDI_MASK_RTL) > 0;
+
+ if (isRtl == true)
+ {
+ textIndex = (pcX - currentGap.first < currentGap.second - pcX) ? index + __textOffset + 1 : index + __textOffset;
+ }
+ else
{
- textIndex = i + __textOffset;
-
- FriBidiChar text[1] = { __pCompositeText->GetCharacter(textIndex) };
- FriBidiCharType type[1] = { 0 };
- fribidi_get_bidi_types(text, 1, type);
- bool isRtl = (type[0] & FRIBIDI_MASK_RTL) > 0;
-
- if (isRtl == true)
- {
- textIndex = (pcX - pPair->first < pPair->second - pcX) ? i + __textOffset + 1 : i + __textOffset;
- }
- else
- {
- textIndex = (pcX - pPair->first < pPair->second - pcX) ? i + __textOffset : i + __textOffset + 1;
- }
-
- break;
+ textIndex = (pcX - currentGap.first < currentGap.second - pcX) ? index + __textOffset : index + __textOffset + 1;
}
+
+ break;
}
+
+ index++;
}
if (textIndex < 0)
Rectangle
TextLine::GetTextExtent(int textIndexFromLineOffset, int textLength) const
{
+ return _CoordinateSystemUtils::ConvertToInteger(GetTextExtentF(textIndexFromLineOffset, textLength));
+}
+
+FloatRectangle
+TextLine::GetTextExtentF(int textIndexFromLineOffset, int textLength) const
+{
SysTryReturn(NID_GRP, 0 <= textIndexFromLineOffset && textLength <= __textLength
- , Rectangle(-1, -1, -1, -1), E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ , FloatRectangle(-1, -1, -1, -1), E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
SysTryReturn(NID_GRP, __pExtentList
- , Rectangle(-1, -1, -1, -1), E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ , FloatRectangle(-1, -1, -1, -1), E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
- _Util::Pair<int, int>* pPair = null;
- Rectangle extent;
- IEnumeratorT<_Util::Pair<int, int>* >* pEnum = __pExtentList->GetEnumeratorN();
+ FloatRectangle extent;
+ _FloatPair currentGap;
+ IEnumeratorT<_FloatPair >* pEnum = __pExtentList->GetEnumeratorN();
if (textIndexFromLineOffset == __textLength)
{
pEnum->MoveNext();
}
- pEnum->GetCurrent(pPair);
- if (pPair)
- {
- 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;
+ pEnum->GetCurrent(currentGap);
- extent.x = (isRtl == true) ? pPair->first : pPair->second;
- extent.width = 0;
- }
+ 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;
+
+ extent.x = (isRtl == true) ? currentGap.first : currentGap.second;
+ extent.width = 0;
}
else if (textIndexFromLineOffset == 0)
{
pEnum->MoveNext();
- pEnum->GetCurrent(pPair);
- if (pPair)
- {
- FriBidiChar text[1] = { __pCompositeText->GetCharacter(__textOffset) };
- FriBidiCharType type[1] = { 0 };
- fribidi_get_bidi_types(text, 1, type);
- bool isRtl = (type[0] & FRIBIDI_MASK_RTL) > 0;
+ pEnum->GetCurrent(currentGap);
- extent.x = (isRtl == true) ? pPair->second : pPair->first;
- extent.width = 0;
- }
+ FriBidiChar text[1] = { __pCompositeText->GetCharacter(__textOffset) };
+ FriBidiCharType type[1] = { 0 };
+ fribidi_get_bidi_types(text, 1, type);
+ bool isRtl = (type[0] & FRIBIDI_MASK_RTL) > 0;
+
+ extent.x = (isRtl == true) ? currentGap.second : currentGap.first;
+ extent.width = 0;
for (int i = 0; i < textLength; i++)
{
- pEnum->GetCurrent(pPair);
- if (pPair)
- {
- extent.width += pPair->second - pPair->first;
- }
+ pEnum->GetCurrent(currentGap);
+ extent.width += currentGap.second - currentGap.first;
+
pEnum->MoveNext();
}
}
else
{
- int prevLeft = 0;
- int prevRight = 0;
+ float prevLeft = 0;
+ float prevRight = 0;
FriBidiChar text[2] = { __pCompositeText->GetCharacter(__textOffset + textIndexFromLineOffset - 1), __pCompositeText->GetCharacter(__textOffset + textIndexFromLineOffset)};
FriBidiCharType type[2] = { 0, 0 };
fribidi_get_bidi_types(text, 2, type);
pEnum->MoveNext();
}
- pEnum->GetCurrent(pPair);
- if (pPair)
- {
- prevLeft = pPair->first;
- prevRight = pPair->second;
- }
+ pEnum->GetCurrent(currentGap);
+ prevLeft = currentGap.first;
+ prevRight = currentGap.second;
pEnum->MoveNext();
- pEnum->GetCurrent(pPair);
+ pEnum->GetCurrent(currentGap);
- if (pPair)
+ if (isRtl[0] && isRtl[1]) // R + R
{
- if (isRtl[0] && isRtl[1]) // R + R
- {
- extent.x = prevLeft;
- }
- else if (isRtl[0] && !isRtl[1]) // R + L
- {
- extent.x = prevLeft;
- }
- else if (!isRtl[0] && !isRtl[1]) // L + L
- {
- extent.x = pPair->first;
- }
- else if (!isRtl[0] && isRtl[1]) // L + R
- {
- extent.x = prevRight;
- }
+ extent.x = prevLeft;
+ }
+ else if (isRtl[0] && !isRtl[1]) // R + L
+ {
+ extent.x = prevLeft;
+ }
+ else if (!isRtl[0] && !isRtl[1]) // L + L
+ {
+ extent.x = currentGap.first;
+ }
+ else if (!isRtl[0] && isRtl[1]) // L + R
+ {
+ extent.x = prevRight;
}
extent.width = 0;
for (int i = 0; i < textLength; i++)
{
- pEnum->GetCurrent(pPair);
- if (pPair)
- {
- extent.width += pPair->second - pPair->first;
- }
+ pEnum->GetCurrent(currentGap);
+ extent.width += currentGap.second - currentGap.first;
pEnum->MoveNext();
}
return extent;
}
-FloatRectangle
-TextLine::GetTextExtentF(int textIndexFromLineOffset, int textLength) const
+Rectangle
+TextLine::GetBlockTextExtent(int textIndexFromLineOffset, int textLength) const
{
- return _CoordinateSystemUtils::ConvertToFloat(GetTextExtent(textIndexFromLineOffset, textLength));
+ return _CoordinateSystemUtils::ConvertToInteger(GetBlockTextExtentF(textIndexFromLineOffset, textLength));
}
-Rectangle
-TextLine::GetBlockTextExtent(int textIndexFromLineOffset, int textLength) const
+FloatRectangle
+TextLine::GetBlockTextExtentF(int textIndexFromLineOffset, int textLength) const
{
SysTryReturn(NID_GRP, 0 <= textIndexFromLineOffset && textLength <= __textLength
- , Rectangle(-1, -1, -1, -1), E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ , FloatRectangle(-1, -1, -1, -1), E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
SysTryReturn(NID_GRP, __pExtentList
- , Rectangle(-1, -1, -1, -1), E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ , FloatRectangle(-1, -1, -1, -1), E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
- _Util::Pair<int, int>* pPair = null;
- Rectangle extent;
- IEnumeratorT<_Util::Pair<int, int>* >* pEnum = __pExtentList->GetEnumeratorN();
+ FloatRectangle extent;
+ _FloatPair currentGap;
+ IEnumeratorT<_FloatPair >* pEnum = __pExtentList->GetEnumeratorN();
if (textIndexFromLineOffset == __textLength)
{
pEnum->MoveNext();
}
- pEnum->GetCurrent(pPair);
- if (pPair)
+ pEnum->GetCurrent(currentGap);
+ if (__endType == TEXT_RETBY_LINEFEED)
{
- if (__endType == TEXT_RETBY_LINEFEED)
- {
- extent.x = pPair->first + 10;
- extent.width = 0;
- }
- else
- {
- 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;
-
- extent.x = (isRtl == true) ? pPair->first : pPair->second;
- extent.width = 0;
- }
+ extent.x = currentGap.first + 10;
+ extent.width = 0;
}
- }
- else if (textIndexFromLineOffset == 0)
- {
- pEnum->MoveNext();
- pEnum->GetCurrent(pPair);
- if (pPair)
+ else
{
- FriBidiChar text[1] = { __pCompositeText->GetCharacter(__textOffset) };
+ 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;
- extent.x = (isRtl == true) ? pPair->second : pPair->first;
+ extent.x = (isRtl == true) ? currentGap.first : currentGap.second;
extent.width = 0;
}
+ }
+ else if (textIndexFromLineOffset == 0)
+ {
+ pEnum->MoveNext();
+ pEnum->GetCurrent(currentGap);
+
+ FriBidiChar text[1] = { __pCompositeText->GetCharacter(__textOffset) };
+ FriBidiCharType type[1] = { 0 };
+ fribidi_get_bidi_types(text, 1, type);
+ bool isRtl = (type[0] & FRIBIDI_MASK_RTL) > 0;
+
+ extent.x = (isRtl == true) ? currentGap.second : currentGap.first;
+ extent.width = 0;
for (int i = 0; i < textLength; i++)
{
- pEnum->GetCurrent(pPair);
- if (pPair)
- {
- extent.width += pPair->second - pPair->first;
- }
+ pEnum->GetCurrent(currentGap);
+ extent.width += currentGap.second - currentGap.first;
+
pEnum->MoveNext();
}
}
else
{
+ float prevLeft = 0;
+ float prevRight = 0;
+ FriBidiChar text[2] = { __pCompositeText->GetCharacter(__textOffset + textIndexFromLineOffset - 1), __pCompositeText->GetCharacter(__textOffset + textIndexFromLineOffset)};
+ FriBidiCharType type[2] = { 0, 0 };
+ fribidi_get_bidi_types(text, 2, type);
+ bool isRtl[2] = {(type[0] & FRIBIDI_MASK_RTL) > 0, (type[1] & FRIBIDI_MASK_RTL) > 0};
+
+ for (int i = 0; i < textIndexFromLineOffset; i++)
{
- int prevLeft = 0;
- int prevRight = 0;
- FriBidiChar text[2] = { __pCompositeText->GetCharacter(__textOffset + textIndexFromLineOffset - 1), __pCompositeText->GetCharacter(__textOffset + textIndexFromLineOffset)};
- FriBidiCharType type[2] = { 0, 0 };
- fribidi_get_bidi_types(text, 2, type);
- bool isRtl[2] = {(type[0] & FRIBIDI_MASK_RTL) > 0, (type[1] & FRIBIDI_MASK_RTL) > 0};
-
- for (int i = 0; i < textIndexFromLineOffset; i++)
- {
- pEnum->MoveNext();
- }
+ pEnum->MoveNext();
+ }
- pEnum->GetCurrent(pPair);
- if (pPair)
- {
- prevLeft = pPair->first;
- prevRight = pPair->second;
- }
+ pEnum->GetCurrent(currentGap);
- pEnum->MoveNext();
- pEnum->GetCurrent(pPair);
+ prevLeft = currentGap.first;
+ prevRight = currentGap.second;
- if (pPair)
- {
- if (isRtl[0] && isRtl[1]) // R + R
- {
- extent.x = prevLeft;
- }
- else if (isRtl[0] && !isRtl[1]) // R + L
- {
- extent.x = pPair->first;
- }
- else if (!isRtl[0] && !isRtl[1]) // L + L
- {
- extent.x = pPair->first;
- }
- else if (!isRtl[0] && isRtl[1]) // L + R
- {
- extent.x = prevRight;
- }
- }
+ pEnum->MoveNext();
+ pEnum->GetCurrent(currentGap);
- extent.width = 0;
+ if (isRtl[0] && isRtl[1]) // R + R
+ {
+ extent.x = prevLeft;
+ }
+ else if (isRtl[0] && !isRtl[1]) // R + L
+ {
+ extent.x = currentGap.first;
+ }
+ else if (!isRtl[0] && !isRtl[1]) // L + L
+ {
+ extent.x = currentGap.first;
+ }
+ else if (!isRtl[0] && isRtl[1]) // L + R
+ {
+ extent.x = prevRight;
+ }
- for (int i = 0; i < textLength; i++)
- {
- pEnum->GetCurrent(pPair);
- if (pPair)
- {
- extent.width += pPair->second - pPair->first;
- }
+ extent.width = 0;
- pEnum->MoveNext();
- }
+ for (int i = 0; i < textLength; i++)
+ {
+ pEnum->GetCurrent(currentGap);
+ extent.width += currentGap.second - currentGap.first;
+
+ pEnum->MoveNext();
}
}
return extent;
}
-FloatRectangle
-TextLine::GetBlockTextExtentF(int textIndexFromLineOffset, int textLength) const
-{
- return _CoordinateSystemUtils::ConvertToFloat(GetBlockTextExtent(textIndexFromLineOffset, textLength));
-}
-
}}} // Tizen::Graphics::_Text
#include <FBaseColLinkedListT.h>
#include "FGrp_TextCommon.h"
-#include "../FGrp_Font.h"
+#include "FGrp_FontImpl.h"
namespace Tizen { namespace Graphics
{
virtual ~TextLine(void);
public:
- virtual result Draw(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength,
- const TextObjectAlignment align, const TextObjectActionType action);
-
virtual result Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength,
const TextObjectAlignment align, const TextObjectActionType action);
- virtual result DrawPartial(_CanvasImpl& canvasImpl, int startTextIndex, int textLength, Rectangle& displayRect);
-
virtual result DrawPartial(_CanvasImpl& canvasImpl, int startTextIndex, int textLength, FloatRectangle& displayRect);
- virtual int ForwardAnalyze(int startTextIndex, int textLength, int maxWidth, TextObjectWrapType wrap,
- int& actualLength, int& width, int& height);
-
virtual int ForwardAnalyze(int startTextIndex, int textLength, float maxWidth, TextObjectWrapType wrap,
int& actualLength, float& width, float& height);
virtual result GetRegion(int textIndex, int textLength, float& width, float& height) const;
- virtual int GetHeight(int textIndex) const;
-
virtual float GetHeightF(int textIndex) const;
virtual int GetTextLength(void) const;
void SetBaseline(int baseline);
+ void SetBaseline(float baseline);
+
int GetBaseline(void) const;
+ float GetBaselineF(void) const;
+
result ResetSweepInfo(void);
void SetSweepComposeInfo(TextObjectSweepComposeLineInfo& textSweepComposeLineInfo);
TextObjectSweepComposeLineInfo GetSweepComposeInfo(void) const;
- void SetSweepIn(int sweepIn);
+ void SetSweepIn(float sweepIn);
- int GetSweepIn(void) const;
+ float GetSweepIn(void) const;
- void SetSweepOut(int sweepOut);
+ void SetSweepOut(float sweepOut);
- int GetSweepOut(void) const;
+ float GetSweepOut(void) const;
void SetKeyInputResult(int keyInputResult);
int GetKeyInputLength(void);
- result SetTextExtentList(Tizen::Base::Collection::LinkedListT<_Util::Pair<int, int>* >* pList);
+ result SetTextExtentList(Tizen::Base::Collection::ArrayListT<_FloatPair>* pList);
- Tizen::Base::Collection::LinkedListT<_Util::Pair<int, int>* >* GetTextExtentList(void) const;
+ Tizen::Base::Collection::ArrayListT<_FloatPair>* GetTextExtentList(void) const;
int GetTextIndexFromPosition(int pcX, bool cursorMode = true);
int __index;
int __textOffset;
int __textLength;
- int __width;
- int __height;
- int __baseline;
+ float __width;
+ float __height;
+ float __baseline;
TextObjectSweepComposeLineInfo __sweepComposeLineInfo;
- int __sweepIn;
- int __sweepOut;
+ float __sweepIn;
+ float __sweepOut;
int __sweepType;
bool __isKeyInputChanged;
int __keyInputTextIndex;
int __keyInputTextLength;
- Tizen::Base::Collection::LinkedListT<_Util::Pair<int, int>* >* __pExtentList;
+ Tizen::Base::Collection::ArrayListT<_FloatPair>* __pExtentList;
private:
TextLine(const TextLine& other); // NOT IMPLMENTED
*/
#include <new>
-#include <math.h>
#include <FGrpBitmap.h>
#include <FBaseSysLog.h>
#include "FGrp_FontImpl.h"
-#include "../FGrp_Font.h"
-#include "../FGrp_Canvas.h"
+#include "FGrp_CanvasImpl.h"
#include "../FGrp_ResUtil.h"
#include "FGrp_TextTextObject.h"
#include "FGrp_TextTextElement.h"
namespace _Text
{
-namespace // unnamed
-{
- const long long MAX_INT = 0x7FFFFFFF;
- const long long MIN_INT = -MAX_INT - 1;
-}
-
-inline int
-ToVirCoord(const int& sour)
-{
- int logicalResolution = Tizen::Graphics::_CoordinateSystem::GetInstance()->GetLogicalResolutionInt();
- Dimension physicalResolution = Tizen::Graphics::_CoordinateSystem::GetInstance()->GetPhysicalResolutionDim();
-
- long long tempSrc = sour;
-
- if (logicalResolution == 720 && physicalResolution.width == 480)
- {
- if (tempSrc >= 0)
- {
- tempSrc = tempSrc * 3 / 2;
-
- return (tempSrc > MAX_INT) ? MAX_INT : int(tempSrc);
- }
- else
- {
- tempSrc = (tempSrc * 3 - 1) / 2;
-
- return (tempSrc < MIN_INT) ? MIN_INT : int(tempSrc);
- }
- }
- else if (logicalResolution == 480 && physicalResolution.width == 720)
- {
-
- if (tempSrc > 0)
- {
- tempSrc = (tempSrc + 1) * 2 / 3;
-
- return (tempSrc > MAX_INT) ? MAX_INT : int(tempSrc);
- }
- else
- {
- tempSrc = tempSrc * 2 / 3;
-
- return (tempSrc < MIN_INT) ? MIN_INT : int(tempSrc);
- }
- }
- else
- {
- return _ResUtil::ConvertToVirCoord(sour);
- }
-}
-
-inline int
-ConvertToVirCoord(const int& sour)
-{
- return _ResUtil::NeedToConvertCoord() ? ToVirCoord(sour) : sour;
-}
-
-inline int
-ToPhyCoord(const int& sour)
-{
- int logicalResolution = Tizen::Graphics::_CoordinateSystem::GetInstance()->GetLogicalResolutionInt();
- Dimension physicalResolution = Tizen::Graphics::_CoordinateSystem::GetInstance()->GetPhysicalResolutionDim();
-
- long long tempSrc = sour;
-
- if (logicalResolution == 720 && physicalResolution.width == 480)
- {
- if (tempSrc > 0)
- {
- tempSrc = (tempSrc + 1) * 2 / 3;
-
- return (tempSrc > MAX_INT) ? MAX_INT : int(tempSrc);
- }
- else
- {
- tempSrc = tempSrc * 2 / 3;
-
- return (tempSrc < MIN_INT) ? MIN_INT : int(tempSrc);
- }
- }
- else if (logicalResolution == 480 && physicalResolution.width == 720)
- {
- if (tempSrc >= 0)
- {
- tempSrc = tempSrc * 3 / 2;
-
- return (tempSrc > MAX_INT) ? MAX_INT : int(tempSrc);
- }
- else
- {
- tempSrc = (tempSrc * 3 - 1) / 2;
-
- return (tempSrc < MIN_INT) ? MIN_INT : int(tempSrc);
- }
- }
- else
- {
- return _ResUtil::ConvertToPhyCoord(sour);
- }
-}
-
-inline int
-ConvertToPhyCoord(const int& sour)
-{
- return _ResUtil::NeedToConvertCoord() ? ToPhyCoord(sour) : sour;
-}
-
-inline int
-ConvertToPhyCoordWidth(const int& sour)
-{
- return _ResUtil::NeedToConvertCoord() ? ToPhyCoord(sour) : sour;
-}
-
-inline int
-ConvertToPhyCoordHeight(const int& sour)
-{
- return _ResUtil::NeedToConvertCoord() ? ToPhyCoord(sour) : sour;
-}
-
TextObject::TextObject(void)
{
__action = TEXT_OBJECT_ACTION_TYPE_NONE;
__rect.y = 0;
__rect.width = 0;
__rect.height = 0;
- __pcRect.x = 0;
- __pcRect.y = 0;
- __pcRect.width = 0;
- __pcRect.height = 0;
__slidingGap = 30;
__slidingStep = 2;
__pTextWidthManager = null;
__isAlternateLookEnabled = false;
__linkViewModeEnabled = false;
__pTextWidthManager = null;
- __rect = rect;
- __pcRect.x = _Text::ConvertToPhyCoord(rect.x);
- __pcRect.y = _Text::ConvertToPhyCoord(rect.y);
- __pcRect.width = _Text::ConvertToPhyCoordWidth(rect.width);
- __pcRect.height = _Text::ConvertToPhyCoordHeight(rect.height);
+ __rect = _CoordinateSystemUtils::ConvertToFloat(rect);
__pCompositeText = new (std::nothrow)TextComposite();
SysTryCatch(NID_GRP, __pCompositeText, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
__isAlternateLookEnabled = false;
__linkViewModeEnabled = false;
__pTextWidthManager = null;
- __rect = _CoordinateSystemUtils::ConvertToInteger(rect);
- __pcRect.x = _Text::ConvertToPhyCoord(rect.x);
- __pcRect.y = _Text::ConvertToPhyCoord(rect.y);
- __pcRect.width = _Text::ConvertToPhyCoordWidth(rect.width);
- __pcRect.height = _Text::ConvertToPhyCoordHeight(rect.height);
+ __rect = rect;
__pCompositeText = new (std::nothrow)TextComposite();
SysTryCatch(NID_GRP, __pCompositeText, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
{
IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
- if (__pcRect.width == 0 || __pcRect.height == 0)
+ if (__rect.width == 0 || __rect.height == 0)
{
return E_SUCCESS;
}
result r = E_SUCCESS;
TextLine* pTextLine = null;
- Rectangle clipRect;
- Rectangle lineBounds;
- Rectangle targetBounds;
- int totalHeight = 0;
- int slidingWidth = 0;
-
- SysTryReturn(NID_GRP, __pcRect.width > 0 && __pcRect.height > 0, E_INVALID_STATE, E_INVALID_STATE
- , "[E_INVALID_STATE] This instance is not constructed yet. (width = %d, height = %d)", __pcRect.width, __pcRect.height);
+ FloatRectangle clipRect;
+ FloatRectangle lineBounds;
+ FloatRectangle targetBounds;
+ float totalHeight = 0;
+ float slidingWidth = 0;
- _Canvas* pCanvas = _Canvas::GetInstance(canvasImpl);
- SysTryReturn(NID_GRP, pCanvas, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ SysTryReturn(NID_GRP, __rect.width > 0 && __rect.height > 0, E_INVALID_STATE, E_INVALID_STATE
+ , "[E_INVALID_STATE] This instance is not constructed yet. (width = %d, height = %d)", __rect.width, __rect.height);
r = Compose();
SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
__pTextColumn->SetFirstDisplayPositionY(0);
}
- targetBounds = __pcRect;
+ targetBounds = __rect;
if (__action == TEXT_OBJECT_ACTION_TYPE_SLIDE_LEFT)
{
return E_SUCCESS;
}
- totalHeight = TextUtility::GetFontMaxHeight(__pDefaultFont);
+ totalHeight = TextUtility::GetFontMaxHeightF(__pDefaultFont);
}
else
{
- totalHeight = __pTextColumn->GetTotalHeight();
+ totalHeight = __pTextColumn->GetTotalHeightF();
}
if (totalHeight == 0)
}
else
{
- int lineHeight = __pTextColumn->GetLineHeightAt(0);
+ float lineHeight = __pTextColumn->GetLineHeightAtF(0);
if (targetBounds.height < lineHeight)
{
for (i = 0; i < lineCount; i++)
{
- lineHeight += __pTextColumn->GetLineHeightAt(i);
+ lineHeight += __pTextColumn->GetLineHeightAtF(i);
if (targetBounds.height < lineHeight)
{
- lineHeight -= __pTextColumn->GetLineHeightAt(i);
+ lineHeight -= __pTextColumn->GetLineHeightAtF(i);
break;
}
}
+
totalHeight = lineHeight;
}
}
}
CONTINUE_PROC:
- Rectangle finalClipRect;
- clipRect = pCanvas->GetClipBounds();
+ FloatRectangle finalClipRect;
+ clipRect = canvasImpl.GetClipBoundsF();
- finalClipRect.x = Math::Max(clipRect.x, targetBounds.x);
- finalClipRect.y = Math::Max(clipRect.y, targetBounds.y);
- finalClipRect.width = Math::Min(clipRect.x + clipRect.width, targetBounds.x + targetBounds.width) - finalClipRect.x;
- finalClipRect.height = Math::Min(clipRect.y + clipRect.height, targetBounds.y + targetBounds.height) - finalClipRect.y;
+ finalClipRect.x = (clipRect.x > targetBounds.x) ? clipRect.x : targetBounds.x; //Math::Max(clipRect.x, targetBounds.x);
+ finalClipRect.y = (clipRect.y > targetBounds.y) ? clipRect.y: targetBounds.y; //Math::Max(clipRect.y, targetBounds.y);
+ //finalClipRect.width = Math::Min(clipRect.x + clipRect.width, targetBounds.x + targetBounds.width) - finalClipRect.x;
+ finalClipRect.width = (clipRect.x + clipRect.width > targetBounds.x + targetBounds.width) ? clipRect.x + clipRect.width - finalClipRect.x : targetBounds.x + targetBounds.width - finalClipRect.x;
+ //finalClipRect.height = Math::Min(clipRect.y + clipRect.height, targetBounds.y + targetBounds.height) - finalClipRect.y;
+ finalClipRect.height = (clipRect.y + clipRect.height > targetBounds.y + targetBounds.height) ? clipRect.y + clipRect.height - finalClipRect.y : targetBounds.y + targetBounds.height - finalClipRect.y;
SysTryReturn(NID_GRP, 0 <= finalClipRect.width && 0 <= finalClipRect.height, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get clip rectangle.");
- pCanvas->SetClipBounds(finalClipRect);
+ canvasImpl.SetClipBounds(finalClipRect);
switch (__action)
{
pTextLine = __pTextColumn->GetTextLine(0);
SysTryReturn(NID_GRP, pTextLine, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
__pTextColumn->SetDisplayLineCount(1);
__pTextColumn->SetDisplayHeight(lineBounds.height);
- slidingWidth = Math::Max(__pTextColumn->GetSlidingDimension().width, __pcRect.width);
+ slidingWidth = (__pTextColumn->GetSlidingDimension().width > __rect.width) ? __pTextColumn->GetSlidingDimension().width : __rect.width;
if (__isActionOn)
{
- Rectangle slidingRect;
+ FloatRectangle slidingRect;
targetBounds.width = lineBounds.width;
targetBounds.height = lineBounds.height;
slidingRect = targetBounds;
- slidingRect.x += __pTextColumn->GetSlidingPosition();
- Dimension slidingDim = __pTextColumn->GetSlidingDimension();
+ slidingRect.x += __pTextColumn->GetSlidingPositionF();
+ FloatDimension slidingDim = __pTextColumn->GetSlidingDimensionF();
slidingRect.width = slidingDim.width;
slidingRect.height = slidingDim.height;
case TEXT_OBJECT_ACTION_TYPE_SLIDE_UP:
{
- Rectangle slidingRect = targetBounds;
+ FloatRectangle slidingRect = targetBounds;
slidingRect.y += __pTextColumn->GetSlidingPosition();
int lineCount = __pTextColumn->GetTotalLineCount();
pTextLine = __pTextColumn->GetTextLine(i);
if (pTextLine != null)
{
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
slidingRect.height = lineBounds.height;
if ((slidingRect.y + slidingRect.height >= targetBounds.y) && (slidingRect.y < targetBounds.y + targetBounds.height))
{
break;
}
- pCanvas->SetClipBounds(clipRect);
+ canvasImpl.SetClipBounds(clipRect);
return E_SUCCESS;
}
result r = E_SUCCESS;
TextLine* pTextLine = null;
- Rectangle lineBounds;
+ FloatRectangle lineBounds;
int firstDisplayY = __pTextColumn->GetFirstDisplayPositionY();
r = Compose();
return E_INVALID_ARG;
}
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
lineBounds.y = lineBounds.y - firstDisplayY + __rect.y;
int length = pTextLine->GetTextLength();
SysTryReturn(NID_GRP, __isActionOn, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Action is off.");
- int slidingStartIndex = __pTextColumn->GetSlidingPosition();
- Dimension slidingDim = __pTextColumn->GetSlidingDimension();
+ float slidingStartIndex = __pTextColumn->GetSlidingPositionF();
+ FloatDimension slidingDim = __pTextColumn->GetSlidingDimensionF();
switch (__action)
{
case TEXT_OBJECT_ACTION_TYPE_SLIDE_LEFT:
- if (__pcRect.width < slidingDim.width)
+ if (__rect.width < slidingDim.width)
{
- slidingDim.width = Math::Max(slidingDim.width, __pcRect.width);
+ slidingDim.width = (slidingDim.width > __rect.width) ? slidingDim.width: __rect.width;//Math::Max(slidingDim.width, __rect.width);
if (__slidingStep < slidingStartIndex + slidingDim.width + __slidingGap)
{
}
else
{
- slidingStartIndex = __pcRect.width + __slidingGap + slidingStartIndex;
+ slidingStartIndex = __rect.width + __slidingGap + slidingStartIndex;
}
}
__pTextColumn->SetSlidingPosition(slidingStartIndex);
}
else
{
- slidingStartIndex = __pcRect.height;
+ slidingStartIndex = __rect.height;
}
__pTextColumn->SetSlidingPosition(slidingStartIndex);
break;
{
IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
- SysTryReturn(NID_GRP, __pcRect.width >= 0 && __pcRect.height >= 0, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not constructed yet.");
+ SysTryReturn(NID_GRP, __rect.width >= 0 && __rect.height >= 0, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not constructed yet.");
int lineCount = 0;
- Rectangle rect = __pcRect;
- Rectangle lineBounds;
+ FloatRectangle rect = __rect;
+ FloatRectangle lineBounds;
if (__pCompositeText->IsPartialComposingModeEnabled())
{
__isActionOn = true;
__pTextColumn->SetSlidingPosition(0);
- Dimension slidingDim;
- Dimension lineTextSize;
+ FloatDimension slidingDim;
+ FloatDimension lineTextSize;
__pCompositeText->GetRegion(0, totalLength, slidingDim.width, slidingDim.height);
pTextLine->GetRegion(0, lineLength, lineTextSize.width, lineTextSize.height);
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
__pTextColumn->SetSlidingDimension(slidingDim);
{
__pTextColumn->SetSlidingPosition(0);
- int totalHeight = __pTextColumn->GetTotalHeight();
- Dimension slidingDim;
- slidingDim.width = __pcRect.width;
+ float totalHeight = __pTextColumn->GetTotalHeightF();
+ FloatDimension slidingDim;
+ slidingDim.width = __rect.width;
slidingDim.height = totalHeight;
__pTextColumn->SetSlidingDimension(slidingDim);
- if (__pcRect.height < totalHeight)
+ if (__rect.height < totalHeight)
{
__isActionOn = true;
}
IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
result r = E_SUCCESS;
- Rectangle lineBounds;
+ FloatRectangle lineBounds;
TextLine* pTextLine = null;
- int firstDisplayPositionY = 0;
- int rollbackFirstDisplayPositionY = 0;
+ float firstDisplayPositionY = 0;
+ float rollbackFirstDisplayPositionY = 0;
int rollbackFirstDisplayLineIndex = 0;
- rollbackFirstDisplayPositionY = __pTextColumn->GetFirstDisplayPositionY();
+ rollbackFirstDisplayPositionY = __pTextColumn->GetFirstDisplayPositionYF();
rollbackFirstDisplayLineIndex = __pTextColumn->GetFirstDisplayLineIndex();
__pTextColumn->SetFirstDisplayLineIndex(lineIndex);
pTextLine = __pTextColumn->GetTextLine(lineIndex);
SysTryCatch(NID_GRP, pTextLine, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
firstDisplayPositionY = lineBounds.y;
__pTextColumn->SetFirstDisplayPositionY(firstDisplayPositionY);
}
result
-TextObject::SetFirstDisplayPositionY(int lcY)
+TextObject::SetFirstDisplayPositionY(int y)
+{
+ return SetFirstDisplayPositionY(_CoordinateSystemUtils::ConvertToFloat(y));
+}
+
+result
+TextObject::SetFirstDisplayPositionY(float y)
{
IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
result r = E_SUCCESS;
- int pcY = _Text::ConvertToPhyCoord(lcY);
if (IsPartialComposingModeEnabled())
{
__isFirstDisplayPositionYChanged = true;
- if (__pCompositeText->GetTotalComposedHeight() <= (pcY + __pcRect.height))
+ if (__pCompositeText->GetTotalComposedHeight() <= (y + __rect.height))
{
- __pCompositeText->SetComposePartialLimitHeight(pcY + __pcRect.height - GetTotalComposedHeight());
+ __pCompositeText->SetComposePartialLimitHeight(y + __rect.height - GetTotalComposedHeight());
r = Compose();
SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
__isFirstDisplayPositionYChanged = false;
- __pTextColumn->SetFirstDisplayPositionY(pcY);
+ __pTextColumn->SetFirstDisplayPositionY(y);
return E_SUCCESS;
return r;
}
-result
-TextObject::SetFirstDisplayPositionY(float lcY)
-{
- return SetFirstDisplayPositionY(_CoordinateSystemUtils::ConvertToInteger(lcY));
-}
-
int
TextObject::GetMaxLineHeight(void) const
{
- IF_NOT_CONSTRUCTED(return -1);
-
- int pcMaxHeight = __pCompositeText->GetMaxLineHeight();
- pcMaxHeight = Math::Max(pcMaxHeight, TextUtility::GetFontMaxHeight(__pDefaultFont));
- int lcMaxHeight = _Text::ConvertToVirCoord(pcMaxHeight);
-
- return lcMaxHeight;
+ return _CoordinateSystemUtils::ConvertToInteger(GetMaxLineHeightF());
}
float
TextObject::GetMaxLineHeightF(void) const
{
- return _CoordinateSystemUtils::ConvertToFloat(GetMaxLineHeight());
+ IF_NOT_CONSTRUCTED(return -1);
+
+ float lineMaxHeight = __pCompositeText->GetMaxLineHeightF();
+ float fontMaxHeight = TextUtility::GetFontMaxHeightF(__pDefaultFont);
+
+ return (lineMaxHeight > fontMaxHeight) ? lineMaxHeight: fontMaxHeight;
}
bool
{
IF_NOT_CONSTRUCTED(return false);
- int firstDisplayPositionY = __pTextColumn->GetFirstDisplayPositionY();
+ float firstDisplayPositionY = __pTextColumn->GetFirstDisplayPositionYF();
bool isDisplayedAtStartPosition = (firstDisplayPositionY == 0) ? true : false;
{
IF_NOT_CONSTRUCTED(return false);
- int totalHeight = 0;
- int firstDisplayPositionY = 0;
+ float totalHeight = 0;
+ float firstDisplayPositionY = 0;
- firstDisplayPositionY = __pTextColumn->GetFirstDisplayPositionY();
- totalHeight = __pTextColumn->GetTotalHeight();
+ firstDisplayPositionY = __pTextColumn->GetFirstDisplayPositionYF();
+ totalHeight = __pTextColumn->GetTotalHeightF();
- bool isDisplayedAtEndPosition = ((totalHeight - firstDisplayPositionY) <= __pcRect.height) ? true : false;
+ bool isDisplayedAtEndPosition = ((totalHeight - firstDisplayPositionY) <= __rect.height) ? true : false;
return isDisplayedAtEndPosition;
}
}
result
-TextObject::SetBounds(const Rectangle& lcRect)
+TextObject::SetBounds(const Rectangle& rect)
+{
+ return SetBounds(_CoordinateSystemUtils::ConvertToFloat(rect));
+}
+
+result
+TextObject::SetBounds(const FloatRectangle& rect)
{
IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
- SysTryReturn(NID_GRP, (lcRect.width >= 0) && (lcRect.height >= 0), E_OUT_OF_RANGE, E_OUT_OF_RANGE
- , "[E_OUT_OF_RANGE] The given rectangle(width:%d,height:%d) is out of range.\n", lcRect.width, lcRect.height);
+ SysTryReturn(NID_GRP, (rect.width >= 0) && (rect.height >= 0), E_OUT_OF_RANGE, E_OUT_OF_RANGE
+ , "[E_OUT_OF_RANGE] The given rectangle(width:%d,height:%d) is out of range.\n", rect.width, rect.height);
- if (__rect.width != lcRect.width)
+ if (__rect.width != rect.width)
{
UpdateChangedInfo(0, 0, false);
}
- __rect = lcRect;
-
- if (_ResUtil::NeedToConvertCoord())
- {
- __pcRect.x = _Text::ConvertToPhyCoord(__rect.x);
- __pcRect.y = _Text::ConvertToPhyCoord(__rect.y);
- __pcRect.width = _Text::ConvertToPhyCoordWidth(__rect.width);
-
- if (_Screen::GetWidth() == 600 || _Screen::GetWidth() == 1280 || _Screen::GetWidth() == 1920 || _Screen::GetWidth() == 2560)
- {
- __pcRect.width++;
- }
-
- __pcRect.height = _Text::ConvertToPhyCoordHeight(__rect.height);
- }
- else
- {
- __pcRect = __rect;
- }
+ __rect = rect;
return E_SUCCESS;
}
result
-TextObject::SetBounds(const FloatRectangle& lcRect)
+TextObject::SetLineSpace(int lineSpacing)
{
- return SetBounds(_CoordinateSystemUtils::ConvertToInteger(FloatRectangle(lcRect.x, lcRect.y, ceil(lcRect.width), ceil(lcRect.height))));
+ return SetLineSpace(_CoordinateSystemUtils::ConvertToFloat(lineSpacing));
}
result
-TextObject::SetLineSpace(int lcLineSpacing)
+TextObject::SetLineSpace(float lineSpacing)
{
IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
- SysTryReturn(NID_GRP, lcLineSpacing >= 0, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+ SysTryReturn(NID_GRP, lineSpacing >= 0, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid. lineSpacing(%d)", lineSpacing);
- int pcLineSpacing = _Text::ConvertToPhyCoord(lcLineSpacing);
-
- if (__pCompositeText->GetLineSpace() != pcLineSpacing)
+ if (__pCompositeText->GetLineSpace() != lineSpacing)
{
- __pCompositeText->SetLineSpace(pcLineSpacing);
+ __pCompositeText->SetLineSpace(lineSpacing);
__isChanged = true;
}
- return E_SUCCESS;
+ return E_SUCCESS;
}
result
-TextObject::SetLineSpace(float lcLineSpacing)
-{
- return SetLineSpace(_CoordinateSystemUtils::ConvertToInteger(lcLineSpacing));
-}
-result
TextObject::SetElementVerticalAlignment(TextObjectAlignment alignment)
{
IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
Dimension
TextObject::GetTextExtent(int startTextIndex, int textLength) const
{
- IF_NOT_CONSTRUCTED(return Dimension(-1, -1));
-
- Dimension pcTextSize;
- result r = __pCompositeText->GetRegion(startTextIndex, textLength, pcTextSize.width, pcTextSize.height);
- SysTryReturn(NID_GRP, r == E_SUCCESS, Dimension(-1, -1), r, "[%s] Propagating.", GetErrorMessage(r));
-
- Dimension lcTextSize;
- lcTextSize.width = _Text::ConvertToVirCoord(pcTextSize.width);
- lcTextSize.height = _Text::ConvertToVirCoord(pcTextSize.height);
- SetLastResult(E_SUCCESS);
-
- return lcTextSize;
+ return _CoordinateSystemUtils::ConvertToInteger(GetTextExtentF(startTextIndex,textLength));
}
FloatDimension
TextObject::GetTextExtentF(int startTextIndex, int textLength) const
{
- return _CoordinateSystemUtils::ConvertToFloat(GetTextExtent(startTextIndex,textLength));
+ IF_NOT_CONSTRUCTED(return FloatDimension(-1, -1));
+
+ FloatDimension textSize;
+ result r = __pCompositeText->GetRegion(startTextIndex, textLength, textSize.width, textSize.height);
+ SysTryReturn(NID_GRP, r == E_SUCCESS, FloatDimension(-1, -1), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SetLastResult(E_SUCCESS);
+
+ return textSize;
}
result
__pDefaultFont = pTmpFont;
__pCompositeText->SetRange(startTextIndex, textLength);
- r = __pCompositeText->SetFont(pFont);
+ r = __pCompositeText->SetFont(__pDefaultFont);
SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
UpdateChangedInfo(__pCompositeText->GetWorkStart(), 0);
result
TextObject::SetDefaultFontSize(int size)
{
- IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
-
- _FontImpl::GetInstance(*__pDefaultFont)->SetSize(size);
-
- return E_SUCCESS;
+ return SetDefaultFontSize(_CoordinateSystemUtils::ConvertToFloat(size));
}
result
TextObject::SetDefaultFontSize(float size)
{
- return SetDefaultFontSize(_CoordinateSystemUtils::ConvertToInteger(size));
+ IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
+
+ _FontImpl::GetInstance(*__pDefaultFont)->SetSize(size);
+
+ return E_SUCCESS;
}
int
{
IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
- TextImage* pImageText = new (std::nothrow)TextImage(bitmap, sourceType, null, (TextObjectAlignment)(TEXT_OBJECT_ALIGNMENT_LEFT | TEXT_OBJECT_ALIGNMENT_TOP));
+ TextImage* pImageText = new (std::nothrow)TextImage(bitmap, sourceType, (TextObjectAlignment)(TEXT_OBJECT_ALIGNMENT_LEFT | TEXT_OBJECT_ALIGNMENT_TOP));
SysTryReturn(NID_GRP, pImageText, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
int addedTextLength = pImageText->GetTextLength();
IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
result r = E_SUCCESS;
- TextImage* pImageText = new (std::nothrow)TextImage(bitmap, sourceType, null, (TextObjectAlignment)(TEXT_OBJECT_ALIGNMENT_LEFT | TEXT_OBJECT_ALIGNMENT_TOP));
+ TextImage* pImageText = new (std::nothrow)TextImage(bitmap, sourceType, (TextObjectAlignment)(TEXT_OBJECT_ALIGNMENT_LEFT | TEXT_OBJECT_ALIGNMENT_TOP));
SysTryReturn(NID_GRP, pImageText, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
r = __pCompositeText->AppendElement(*pImageText);
}
int
-TextObject::GetTextIndexFromPosition(int lcX, int lcY, bool cursorMode) const
+TextObject::GetTextIndexFromPosition(int x, int y, bool cursorMode) const
+{
+ return GetTextIndexFromPosition(_CoordinateSystemUtils::ConvertToFloat(x), _CoordinateSystemUtils::ConvertToFloat(y), cursorMode);
+}
+
+int
+TextObject::GetTextIndexFromPosition(float x, float y, bool cursorMode) const
{
IF_NOT_CONSTRUCTED(return -1);
return -1;
}
- int pcX = _Text::ConvertToPhyCoord(lcX);
- int pcY = _Text::ConvertToPhyCoord(lcY);
-
if (__wrap == TEXT_OBJECT_WRAP_TYPE_NONE)
{
- return GetTextIndexFromPositionInNoneWrap(pcX, pcY, !cursorMode);
+ return GetTextIndexFromPositionInNoneWrap(x, y, !cursorMode);
}
else
{
- return GetTextIndexFromPositionInWrap(pcX, pcY, !cursorMode);
- }
+ return GetTextIndexFromPositionInWrap(x, y, !cursorMode);
+ }
}
int
-TextObject::GetTextIndexFromPosition(float lcX, float lcY, bool cursorMode) const
+TextObject::GetTextIndexFromPositionAtLine(int lineIndex, int x, bool cursorMode) const
{
- return GetTextIndexFromPosition(_CoordinateSystemUtils::ConvertToInteger(lcX), _CoordinateSystemUtils::ConvertToInteger(lcY), cursorMode);
+ return GetTextIndexFromPositionAtLine(lineIndex, _CoordinateSystemUtils::ConvertToFloat(x), cursorMode);
}
int
-TextObject::GetTextIndexFromPositionAtLine(int lineIndex, int lcX, bool cursorMode) const
+TextObject::GetTextIndexFromPositionAtLine(int lineIndex, float x, bool cursorMode) const
{
IF_NOT_CONSTRUCTED(return -1);
TextLine* pTextLine = __pTextColumn->GetTextLine(lineIndex);
SysTryReturn(NID_GRP, pTextLine, -1, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- int pcX = _Text::ConvertToPhyCoord(lcX);
int lineOffset = pTextLine->GetTextOffset();
int lineLength = pTextLine->GetTextLength();
int length = 0;
TextElementType objectType;
- Rectangle lineBounds = pTextLine->GetBounds();
- Dimension lineTextSize;
+ FloatRectangle lineBounds = pTextLine->GetBoundsF();
+ FloatDimension lineTextSize;
pTextLine->GetRegion(0, lineLength, lineTextSize.width, lineTextSize.height);
switch (__align & TEXT_ALIGNMASK_HORIZ)
break;
case TEXT_OBJECT_ALIGNMENT_CENTER:
- pcX -= (lineBounds.width - lineTextSize.width) / 2;
+ x -= (lineBounds.width - lineTextSize.width) / 2;
break;
case TEXT_OBJECT_ALIGNMENT_RIGHT:
- pcX -= (lineBounds.width - lineTextSize.width);
+ x -= (lineBounds.width - lineTextSize.width);
break;
}
- pcX = (pcX < 0) ? 0 : pcX;
+ x = (x < 0) ? 0 : x;
__pCompositeText->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
int endType = 0;
if (cursorMode)
{
- __pCompositeText->ForwardAnalyzeWithFocusedObjectType(lineOffset, lineLength, pcX, length, objectType);
+ __pCompositeText->ForwardAnalyzeWithFocusedObjectType(lineOffset, lineLength, x, length, objectType);
}
else
{
- endType = __pCompositeText->ForwardAnalyzeInNoneCursorMode(lineOffset, lineLength, pcX, length);
- }
-
- __pCompositeText->SetWrap(__wrap);
-
- if (!cursorMode)
- {
- if (endType == -1)
- {
- return -1;
- }
- }
-
- int index = pTextLine->GetTextOffset() + length;
- if (pTextLine->GetEndType() == TEXT_RETBY_LINEFEED && lineLength == length && pTextLine->GetTextOffset() < index)
- {
- index--;
- }
-
- if (index != GetTextLength() && index == lineOffset + lineLength)
- {
- TextElement* pTextElement = GetElementAtTextIndex(index-1);
- if (pTextElement != null)
- {
- const TextSimple* pSimpleText = dynamic_cast <const TextSimple*>(pTextElement);
- if (pSimpleText != null)
- {
- const wchar_t* pText = pSimpleText->GetText();
- SysTryReturn(NID_GRP, pText, -1, E_SYSTEM, "[E_SYSTEM] Fail to get text.");
-
- int i = index - 1 - pSimpleText->GetTextOffset();
- SysTryReturn(NID_GRP, i >= 0 && i < pSimpleText->GetTextLength(), -1, E_OUT_OF_RANGE
- , "[E_OUT_OF_RANGE] text index(%d) must greater than 0 and must be less than total string length(%d)",i, pSimpleText->GetTextLength());
-
- if (pText[i] == L' ')
- {
- index--;
- }
- }
- }
- }
-
- SetLastResult(E_SUCCESS);
-
- return index;
-}
-
-int
-TextObject::GetTextIndexFromPositionAtLine(int lineIndex, float lcX, bool cursorMode) const
-{
- IF_NOT_CONSTRUCTED(return -1);
-
- SysTryReturn(NID_GRP, lineIndex >= 0, -1, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid. (lineIndex = %d)", lineIndex);
-
- TextLine* pTextLine = __pTextColumn->GetTextLine(lineIndex);
- SysTryReturn(NID_GRP, pTextLine, -1, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
-
- lcX = _CoordinateSystemUtils::ConvertToInteger(lcX);
- int pcX = _Text::ConvertToPhyCoord(lcX);
- int lineOffset = pTextLine->GetTextOffset();
- int lineLength = pTextLine->GetTextLength();
- int length = 0;
- TextElementType objectType;
- Rectangle lineBounds = pTextLine->GetBounds();
- Dimension lineTextSize;
- pTextLine->GetRegion(0, lineLength, lineTextSize.width, lineTextSize.height);
-
- switch (__align & TEXT_ALIGNMASK_HORIZ)
- {
- case TEXT_OBJECT_ALIGNMENT_LEFT:
- break;
-
- case TEXT_OBJECT_ALIGNMENT_CENTER:
- pcX -= (lineBounds.width - lineTextSize.width) / 2;
- break;
-
- case TEXT_OBJECT_ALIGNMENT_RIGHT:
- pcX -= (lineBounds.width - lineTextSize.width);
- break;
- }
-
- pcX = (pcX < 0) ? 0 : pcX;
- __pCompositeText->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
-
- int endType = 0;
-
- if (cursorMode)
- {
- __pCompositeText->ForwardAnalyzeWithFocusedObjectType(lineOffset, lineLength, pcX, length, objectType);
- }
- else
- {
- endType = __pCompositeText->ForwardAnalyzeInNoneCursorMode(lineOffset, lineLength, pcX, length);
+ endType = __pCompositeText->ForwardAnalyzeInNoneCursorMode(lineOffset, lineLength, x, length);
}
__pCompositeText->SetWrap(__wrap);
}
int
-TextObject::GetCutLinkIndexFromPositionData(int lcX, int lcY) const
+TextObject::GetCutLinkIndexFromPositionData(int x, int y) const
+{
+ return GetCutLinkIndexFromPositionData(_CoordinateSystemUtils::ConvertToFloat(x), _CoordinateSystemUtils::ConvertToFloat(y));
+}
+
+int
+TextObject::GetCutLinkIndexFromPositionData(float x, float y) const
{
IF_NOT_CONSTRUCTED(return -1);
}
int textIndex = 0;
- int pcX = _Text::ConvertToPhyCoord(lcX);
- int pcY = _Text::ConvertToPhyCoord(lcY);
if (__wrap == TEXT_OBJECT_WRAP_TYPE_NONE)
{
- textIndex = GetTextIndexFromPositionInNoneWrap(pcX, pcY, false);
+ textIndex = GetTextIndexFromPositionInNoneWrap(x, y, false);
}
else
{
- textIndex = GetTextIndexFromPositionInWrap(pcX, pcY, false);
+ textIndex = GetTextIndexFromPositionInWrap(x, y, false);
}
if (textIndex < 0)
return -1;
}
- int width = 0;
- int height = 0;
- Point absPoint;
- Point relPoint;
+ float width = 0;
+ float height = 0;
+ FloatPoint absPoint;
+ FloatPoint relPoint;
+
if (__wrap == TEXT_OBJECT_WRAP_TYPE_NONE)
{
r = GetTextPositionInfoInNoneWrapAt(textIndex, width, height, absPoint.x, absPoint.y, relPoint.x, relPoint.y);
r = GetTextPositionInfoInWrapAt(textIndex, width, height, absPoint.x, absPoint.y, relPoint.x, relPoint.y);
}
SysTryReturn(NID_GRP, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
- SysTryReturn(NID_GRP, pcY + __pcRect.y >= relPoint.y, -1, E_SYSTEM, "[E_SYSTEM] Fail to get text position information");
-
- return __pCompositeText->GetCutLinkElementIndexAt(textIndex);
-}
+ SysTryReturn(NID_GRP, y + __rect.y >= relPoint.y, -1, E_SYSTEM, "[E_SYSTEM] Fail to get text position information");
-int
-TextObject::GetCutLinkIndexFromPositionData(float lcX, float lcY) const
-{
- return GetCutLinkIndexFromPositionData(_CoordinateSystemUtils::ConvertToInteger(lcX), _CoordinateSystemUtils::ConvertToInteger(lcY));
+ return __pCompositeText->GetCutLinkElementIndexAt(textIndex);
}
TextElement*
result
TextObject::GetCutLinkBounds(int cutLinkIndex, Point& startPoint, Point& endPoint) const
{
+ FloatPoint startPointF = _CoordinateSystemUtils::ConvertToFloat(startPoint);
+ FloatPoint endPointF = _CoordinateSystemUtils::ConvertToFloat(endPoint);
+
+ result r = GetCutLinkBounds(cutLinkIndex, startPointF, endPointF);
+ SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ startPoint = _CoordinateSystemUtils::ConvertToInteger(startPointF);
+ endPoint = _CoordinateSystemUtils::ConvertToInteger(endPointF);
+
+ return E_SUCCESS;
+}
+
+result
+TextObject::GetCutLinkBounds(int cutLinkIndex, FloatPoint& startPoint, FloatPoint& endPoint) const
+{
IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
result r = E_SUCCESS;
int textIndex = 0;
int textLength = 0;
- int width = 0;
- int heigth = 0;
- Point tempPoint;
+ float width = 0;
+ float heigth = 0;
+ FloatPoint tempPoint;
r = __pCompositeText->GetCutLinkObjectInfo(cutLinkIndex, textIndex, textLength);
SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
endPoint.x = endPoint.x + width;
endPoint.y = endPoint.y + heigth;
- if (_ResUtil::NeedToConvertCoord())
- {
- startPoint.x = _Text::ConvertToVirCoord(startPoint.x);
- startPoint.y = _Text::ConvertToVirCoord(startPoint.y);
- endPoint.x = _Text::ConvertToVirCoord(endPoint.x);
- endPoint.y = _Text::ConvertToVirCoord(endPoint.y);
- }
-
return E_SUCCESS;
CATCH:
}
result
-TextObject::GetCutLinkBounds(int cutLinkIndex, FloatPoint& startPoint, FloatPoint& endPoint) const
+TextObject::GetTextPositionInfoAt(int textIndex, int& width, int& height, int& absX, int& absY, int& logicalX, int& logicalY) const
{
- Point newStartPoint = _CoordinateSystemUtils::ConvertToInteger(startPoint);
- Point newEndPoint = _CoordinateSystemUtils::ConvertToInteger(endPoint);
- result r = GetCutLinkBounds(cutLinkIndex, newStartPoint, newEndPoint);
+ IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
- startPoint = _CoordinateSystemUtils::ConvertToFloat(newStartPoint);
- endPoint = _CoordinateSystemUtils::ConvertToFloat(newEndPoint);
+ float widthF = _CoordinateSystemUtils::ConvertToFloat(width);
+ float heightF = _CoordinateSystemUtils::ConvertToFloat(height);
+ float absXF = _CoordinateSystemUtils::ConvertToFloat(absX);
+ float absYF = _CoordinateSystemUtils::ConvertToFloat(absY);
+ float logicalXF = _CoordinateSystemUtils::ConvertToFloat(logicalX);
+ float logicalYF = _CoordinateSystemUtils::ConvertToFloat(logicalY);
- return r;
+ result r = GetTextPositionInfoAt(textIndex, widthF, heightF, absXF, absYF, logicalXF, logicalYF);
+ SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ width = _CoordinateSystemUtils::ConvertToInteger(widthF);
+ height = _CoordinateSystemUtils::ConvertToInteger(heightF);
+ absX = _CoordinateSystemUtils::ConvertToInteger(absXF);
+ absY = _CoordinateSystemUtils::ConvertToInteger(absYF);
+ logicalX = _CoordinateSystemUtils::ConvertToInteger(logicalXF);
+ logicalY = _CoordinateSystemUtils::ConvertToInteger(logicalYF);
+
+ return E_SUCCESS;
}
result
-TextObject::GetTextPositionInfoAt(int textIndex, int& width, int& height, int& absX, int& absY, int& logicalX, int& logicalY) const
+TextObject::GetTextPositionInfoAt(int textIndex, float& width, float& height, float& absX, float& absY, float& logicalX, float& logicalY) const
{
IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
if (lineCount < 1)
{
- _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*__pDefaultFont));
+ _FontImpl* pFont = _FontImpl::GetInstance(*__pDefaultFont);
SysTryReturn(NID_GRP, pFont, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
- int maxHeight = TextUtility::GetFontMaxHeight(pFont);
- int posX = 0;
- int posY = 0;
+ float maxHeight = TextUtility::GetFontMaxHeightF(pFont);
+ float posX = 0;
+ float posY = 0;
absX = 0;
absY = 0;
break;
case TEXT_OBJECT_ALIGNMENT_MIDDLE:
- posY += (__pcRect.height - maxHeight) / 2;
+ posY += (__rect.height - maxHeight) / 2;
break;
case TEXT_OBJECT_ALIGNMENT_BOTTOM:
- posY += (__pcRect.height - maxHeight);
+ posY += (__rect.height - maxHeight);
break;
}
- logicalY = __pcRect.y + posY;
+ logicalY = __rect.y + posY;
switch (__align & TEXT_ALIGNMASK_HORIZ)
{
break;
case TEXT_OBJECT_ALIGNMENT_CENTER:
- posX += __pcRect.width / 2;
+ posX += __rect.width / 2;
break;
case TEXT_OBJECT_ALIGNMENT_RIGHT:
- posX += __pcRect.width;
+ posX += __rect.width;
break;
}
- logicalX = __pcRect.x + posX;
+ logicalX = __rect.x + posX;
}
else
{
- int lineHeight = maxHeight + __pCompositeText->GetLineSpace();
+ float lineHeight = maxHeight + __pCompositeText->GetLineSpaceF();
TextObjectAlignment alignment = __pCompositeText->GetElementVerticalAlignment();
switch (alignment & TEXT_ALIGNMASK_VERT)
{
break;
case TEXT_OBJECT_ALIGNMENT_CENTER:
- posX += __pcRect.width / 2;
+ posX += __rect.width / 2;
break;
case TEXT_OBJECT_ALIGNMENT_RIGHT:
- posX += __pcRect.width;
+ posX += __rect.width;
break;
}
- logicalX = posX + __pcRect.x;
- logicalY = posY + __pcRect.y;
+ logicalX = posX + __rect.x;
+ logicalY = posY + __rect.y;
}
width = 0;
SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}
- if (_ResUtil::NeedToConvertCoord())
- {
- width = _Text::ConvertToVirCoord(width);
- height = _Text::ConvertToVirCoord(height);
- absX = _Text::ConvertToVirCoord(absX);
- absY = _Text::ConvertToVirCoord(absY);
- logicalX = _Text::ConvertToVirCoord(logicalX);
- logicalY = _Text::ConvertToVirCoord(logicalY);
- }
-
return E_SUCCESS;
}
result
-TextObject::GetTextPositionInfoAt(int textIndex, float& width, float& height, float& absX, float& absY, float& logicalX, float& logicalY) const
+TextObject::GetBlockTextPositionInfoAt(int textIndex, int& width, int& height, int& absX, int& absY, int& logicalX, int& logicalY) const
{
- int newWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int newHeight = _CoordinateSystemUtils::ConvertToInteger(height);
- int newAbsX = _CoordinateSystemUtils::ConvertToInteger(absX);
- int newAbsY = _CoordinateSystemUtils::ConvertToInteger(absY);
- int newLogicalX = _CoordinateSystemUtils::ConvertToInteger(logicalX);
- int newLogicalY = _CoordinateSystemUtils::ConvertToInteger(logicalY);
+ float widthF = _CoordinateSystemUtils::ConvertToFloat(width);
+ float heightF = _CoordinateSystemUtils::ConvertToFloat(height);
+ float absXF = _CoordinateSystemUtils::ConvertToFloat(absX);
+ float absYF = _CoordinateSystemUtils::ConvertToFloat(absY);
+ float logicalXF = _CoordinateSystemUtils::ConvertToFloat(logicalX);
+ float logicalYF = _CoordinateSystemUtils::ConvertToFloat(logicalY);
- result r = GetTextPositionInfoAt(textIndex, newWidth, newHeight, newAbsX, newAbsY, newLogicalX, newLogicalY);
+ result r = GetBlockTextPositionInfoAt(textIndex, widthF, heightF, absXF, absYF, logicalXF, logicalYF);
+ SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- width = _CoordinateSystemUtils::ConvertToFloat(newWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(newHeight);
- absX = _CoordinateSystemUtils::ConvertToFloat(newAbsX);
- absY = _CoordinateSystemUtils::ConvertToFloat(newAbsY);
- logicalX = _CoordinateSystemUtils::ConvertToFloat(newLogicalX);
- logicalY = _CoordinateSystemUtils::ConvertToFloat(newLogicalY);
+ width = _CoordinateSystemUtils::ConvertToInteger(widthF);
+ height = _CoordinateSystemUtils::ConvertToInteger(heightF);
+ absX = _CoordinateSystemUtils::ConvertToInteger(absXF);
+ absY = _CoordinateSystemUtils::ConvertToInteger(absYF);
+ logicalX = _CoordinateSystemUtils::ConvertToInteger(logicalXF);
+ logicalY = _CoordinateSystemUtils::ConvertToInteger(logicalYF);
- return r;
+ return E_SUCCESS;
}
result
-TextObject::GetBlockTextPositionInfoAt(int textIndex, int& width, int& height, int& absX, int& absY, int& logicalX, int& logicalY) const
+TextObject::GetBlockTextPositionInfoAt(int textIndex, float& width, float& height, float& absX, float& absY, float& logicalX, float& logicalY) const
{
IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
if (lineCount < 1)
{
- _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*__pDefaultFont));
+ _FontImpl* pFont =_FontImpl::GetInstance(*__pDefaultFont);
SysTryReturn(NID_GRP, pFont, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
- int maxHeight = TextUtility::GetFontMaxHeight(pFont);
- int posX = 0;
- int posY = 0;
+ float maxHeight = TextUtility::GetFontMaxHeightF(pFont);
+ float posX = 0;
+ float posY = 0;
absX = 0;
absY = 0;
break;
case TEXT_OBJECT_ALIGNMENT_MIDDLE:
- posY += (__pcRect.height - maxHeight) / 2;
+ posY += (__rect.height - maxHeight) / 2;
break;
case TEXT_OBJECT_ALIGNMENT_BOTTOM:
- posY += (__pcRect.height - maxHeight);
+ posY += (__rect.height - maxHeight);
break;
}
- logicalY = __pcRect.y + posY;
+ logicalY = __rect.y + posY;
switch (__align & TEXT_ALIGNMASK_HORIZ)
{
break;
case TEXT_OBJECT_ALIGNMENT_CENTER:
- posX += __pcRect.width / 2;
+ posX += __rect.width / 2;
break;
case TEXT_OBJECT_ALIGNMENT_RIGHT:
- posX += __pcRect.width;
+ posX += __rect.width;
break;
}
- logicalX = __pcRect.x + posX;
+ logicalX = __rect.x + posX;
}
else
{
- int lineHeight = maxHeight + __pCompositeText->GetLineSpace();
+ float lineHeight = maxHeight + __pCompositeText->GetLineSpace();
TextObjectAlignment alignment = __pCompositeText->GetElementVerticalAlignment();
switch (alignment & TEXT_ALIGNMASK_VERT)
{
break;
}
- logicalX = __pcRect.x;
- logicalY = posY + __pcRect.y;
+ logicalX = __rect.x;
+ logicalY = posY + __rect.y;
}
width = 0;
SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}
- if (_ResUtil::NeedToConvertCoord())
- {
- width = _Text::ConvertToVirCoord(width);
- height = _Text::ConvertToVirCoord(height);
- absX = _Text::ConvertToVirCoord(absX);
- absY = _Text::ConvertToVirCoord(absY);
- logicalX = _Text::ConvertToVirCoord(logicalX);
- logicalY = _Text::ConvertToVirCoord(logicalY);
- }
-
return E_SUCCESS;
}
result
-TextObject::GetBlockTextPositionInfoAt(int textIndex, float& width, float& height, float& absX, float& absY, float& logicalX, float& logicalY) const
-{
- int newWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int newHeight = _CoordinateSystemUtils::ConvertToInteger(height);
- int newAbsX = _CoordinateSystemUtils::ConvertToInteger(absX);
- int newAbsY = _CoordinateSystemUtils::ConvertToInteger(absY);
- int newLogicalX = _CoordinateSystemUtils::ConvertToInteger(logicalX);
- int newLogicalY = _CoordinateSystemUtils::ConvertToInteger(logicalY);
-
- result r = GetBlockTextPositionInfoAt(textIndex, newWidth, newHeight, newAbsX, newAbsY, newLogicalX, newLogicalY);
-
- width = _CoordinateSystemUtils::ConvertToFloat(newWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(newHeight);
- absX = _CoordinateSystemUtils::ConvertToFloat(newAbsX);
- absY = _CoordinateSystemUtils::ConvertToFloat(newAbsY);
- logicalX = _CoordinateSystemUtils::ConvertToFloat(newLogicalX);
- logicalY = _CoordinateSystemUtils::ConvertToFloat(newLogicalY);
-
- return r;
-}
-
-result
TextObject::SetTextObjectEllipsisType(TextObjectEllipsisType type)
{
IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
result
TextObject::DrawByLine(_CanvasImpl& canvasImpl, const Rectangle& displayRect)
{
- Rectangle targetBounds = displayRect;
-
- return __pTextColumn->Draw(canvasImpl, targetBounds, 0, __pTextColumn->GetTextLength(), __align, __action);
+ return DrawByLine(canvasImpl, _CoordinateSystemUtils::ConvertToFloat(displayRect));
}
result
TextObject::DrawByLine(_CanvasImpl& canvasImpl, const FloatRectangle& displayRect)
{
- return DrawByLine(canvasImpl, _CoordinateSystemUtils::ConvertToInteger(displayRect));
+ FloatRectangle targetBounds = displayRect;
+
+ return __pTextColumn->Draw(canvasImpl, targetBounds, 0, __pTextColumn->GetTextLength(), __align, __action);
}
int
-TextObject::GetTextIndexFromPositionInWrap(int pcX, int pcY, bool cursorMode) const
+TextObject::GetTextIndexFromPositionInWrap(int x, int y, bool cursorMode) const
+{
+ return GetTextIndexFromPositionInWrap(_CoordinateSystemUtils::ConvertToFloat(x), _CoordinateSystemUtils::ConvertToFloat(y), cursorMode);
+}
+
+int
+TextObject::GetTextIndexFromPositionInWrap(float x, float y, bool cursorMode) const
{
TextLine* pTextLine = null;
- Rectangle lineBounds;
+ FloatRectangle lineBounds;
int firstDisplayLineIndex = __pTextColumn->GetFirstDisplayLineIndex();
- int firstDisplayPositionY = __pTextColumn->GetFirstDisplayPositionY();
+ float firstDisplayPositionY = __pTextColumn->GetFirstDisplayPositionYF();
int lineCount = __pTextColumn->GetTotalLineCount();
int lineIndex = 0;
-
- int totalHeight = __pTextColumn->GetTotalHeight();
+ float totalHeight = __pTextColumn->GetTotalHeightF();
switch (__align & TEXT_ALIGNMASK_VERT)
{
break;
case TEXT_OBJECT_ALIGNMENT_MIDDLE:
- pcY -= (__pcRect.height - totalHeight) / 2;
+ y -= (__rect.height - totalHeight) / 2;
break;
case TEXT_OBJECT_ALIGNMENT_BOTTOM:
- pcY -= (__pcRect.height - totalHeight);
+ y -= (__rect.height - totalHeight);
break;
}
pTextLine = __pTextColumn->GetTextLine(lineIndex);
SysTryReturn(NID_GRP, pTextLine, -1, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
if (lineIndex == firstDisplayLineIndex)
{
- if (pcY < lineBounds.y - firstDisplayPositionY)
+ if (y < lineBounds.y - firstDisplayPositionY)
{
return -1;
}
}
- if ((lineBounds.y - firstDisplayPositionY <= pcY) && (pcY < lineBounds.y + lineBounds.height - firstDisplayPositionY))
+ if ((lineBounds.y - firstDisplayPositionY <= y) && (y < lineBounds.y + lineBounds.height - firstDisplayPositionY))
{
break;
}
break;
case TEXT_OBJECT_ALIGNMENT_CENTER:
- pcX -= (lineBounds.width - lineTextSize.width) / 2;
+ x -= (lineBounds.width - lineTextSize.width) / 2;
break;
case TEXT_OBJECT_ALIGNMENT_RIGHT:
- pcX -= (lineBounds.width - lineTextSize.width);
+ x -= (lineBounds.width - lineTextSize.width);
break;
}
- if (pcX < 0)
+ if (x < 0)
{
- pcX = 0;
+ x = 0;
}
- int index = pTextLine->GetTextIndexFromPosition(pcX, cursorMode);
+ int index = pTextLine->GetTextIndexFromPosition(x, cursorMode);
SetLastResult(E_SUCCESS);
}
int
-TextObject::GetTextIndexFromPositionInWrap(float pcX, float pcY, bool cursorMode) const
+TextObject::GetTextIndexFromPositionInNoneWrap(int x, int y, bool cursorMode) const
{
- return GetTextIndexFromPositionInWrap(_CoordinateSystemUtils::ConvertToInteger(pcX), _CoordinateSystemUtils::ConvertToInteger(pcY), cursorMode);
+ return GetTextIndexFromPositionInNoneWrap(_CoordinateSystemUtils::ConvertToFloat(x), _CoordinateSystemUtils::ConvertToFloat(y), cursorMode);
}
int
-TextObject::GetTextIndexFromPositionInNoneWrap(int pcX, int pcY, bool cursorMode) const
+TextObject::GetTextIndexFromPositionInNoneWrap(float x, float y, bool cursorMode) const
{
- Dimension lineTextSize;
- Rectangle lineBounds;
+ FloatDimension lineTextSize;
+ FloatRectangle lineBounds;
int lineOffset = 0;
int lineLength = 0;
TextLine* pTextLine = null;
lineOffset = pTextLine->GetTextOffset();
lineLength = pTextLine->GetTextLength();
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
pTextLine->GetRegion(0, lineLength, lineTextSize.width, lineTextSize.height);
switch (__align & TEXT_ALIGNMASK_HORIZ)
break;
case TEXT_OBJECT_ALIGNMENT_CENTER:
- pcX -= (lineBounds.width - lineTextSize.width) / 2;
+ x -= (lineBounds.width - lineTextSize.width) / 2;
break;
case TEXT_OBJECT_ALIGNMENT_RIGHT:
- pcX -= (lineBounds.width - lineTextSize.width);
+ x -= (lineBounds.width - lineTextSize.width);
break;
}
break;
case TEXT_OBJECT_ALIGNMENT_MIDDLE:
- pcY -= (__pcRect.height - lineTextSize.height) / 2;
+ y -= (__rect.height - lineTextSize.height) / 2;
break;
case TEXT_OBJECT_ALIGNMENT_BOTTOM:
- pcY -= (__pcRect.height - lineTextSize.height);
+ y -= (__rect.height - lineTextSize.height);
break;
}
- if (pcX < 0)
+ if (x < 0)
{
- pcX = 0;
+ x = 0;
}
- int index = pTextLine->GetTextIndexFromPosition(pcX, cursorMode);
+ int index = pTextLine->GetTextIndexFromPosition(x, cursorMode);
SetLastResult(E_SUCCESS);
- return index;
-}
-
-int
-TextObject::GetTextIndexFromPositionInNoneWrap(float pcX, float pcY, bool cursorMode) const
-{
- return GetTextIndexFromPositionInNoneWrap(_CoordinateSystemUtils::ConvertToInteger(pcX), _CoordinateSystemUtils::ConvertToInteger(pcY), cursorMode);
+ return index;
}
result
TextObject::SetFirstDisplayLineIndexFromTextIndexInWrap(int textIndex)
{
result r = E_SUCCESS;
- Rectangle lineBounds;
- int firstDisplayPositionY = 0;
+ FloatRectangle lineBounds;
+ float firstDisplayPositionY = 0;
int currentTextIndex = textIndex;
int firstDisplayLineIndex = 0;
int lineIndex = 0;
int lineCount = 0;
- int remainingHeight = 0;
+ float remainingHeight = 0;
TextLine* pTextLine = null;
bool isChanged = false;
pTextLine = __pTextColumn->GetTextLine(lineIndex);
SysTryReturn(NID_GRP, pTextLine, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
if (firstDisplayLineIndex < lineIndex)
{
pTextLine = __pTextColumn->GetTextLine(currentLineIndex);
SysTryReturn(NID_GRP, pTextLine, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- remainingHeight = __pcRect.height;
+ remainingHeight = __rect.height;
while ((remainingHeight != 0) && firstDisplayLineIndex < lineCount)
{
break;
}
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
remainingHeight -= lineBounds.height;
displayLineCount++;
while (remainingHeight && pTextLine)
{
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
remainingHeight -= lineBounds.height;
if (remainingHeight < 0)
pTextLine = __pTextColumn->GetTextLine(lineIndex);
SysTryReturn(NID_GRP, pTextLine, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- lineBounds = pTextLine->GetBounds();
- remainingHeight = __pcRect.height;
+ lineBounds = pTextLine->GetBoundsF();
+ remainingHeight = __rect.height;
firstDisplayLineIndex = lineIndex;
firstDisplayPositionY = lineBounds.y;
while ((pTextLine != null) && 0 < firstDisplayLineIndex && 0 < remainingHeight)
{
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
if (remainingHeight < lineBounds.height)
{
pTextLine = __pTextColumn->GetTextLine(lineIndex);
SysTryReturn(NID_GRP, pTextLine, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
- remainingHeight = __pcRect.height;
+ remainingHeight = __rect.height;
firstDisplayLineIndex = lineIndex;
firstDisplayPositionY = lineBounds.y;
while (pTextLine && 0 < firstDisplayLineIndex && 0 < remainingHeight)
{
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
if (remainingHeight < lineBounds.height)
{
}
else
{
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
firstDisplayLineIndex = lineIndex;
firstDisplayPositionY = lineBounds.y;
isChanged = true;
int lineOffset = 0;
int lineEndIndex = 0;
int lineLength = 0;
- Rectangle lineBounds;
- Dimension lineTextSize;
+ FloatRectangle lineBounds;
+ FloatDimension lineTextSize;
- _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*__pDefaultFont));
+ _FontImpl* pFont = _FontImpl::GetInstance(*__pDefaultFont);
SysTryReturn(NID_GRP, pFont, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
TextLine* pTextLine = __pTextColumn->GetTextLine(0);
lineLength = pTextLine->GetTextLength();
lineEndIndex = pTextLine->GetTextOffset() + pTextLine->GetTextLength();
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
pTextLine->GetRegion(0, lineLength, lineTextSize.width, lineTextSize.height);
if (currentTextIndex < pTextLine->GetTextOffset() + 1)
__pCompositeText->ForwardAnalyze(lineOffset, __pCompositeText->GetTextLength() - lineOffset, lineBounds.width,
__wrap, lineLength, lineTextSize.width, lineTextSize.height);
- lineBounds.height = Math::Max(lineBounds.height, lineTextSize.height);
+ lineBounds.height = (lineBounds.height > lineTextSize.height) ? lineBounds.height : lineTextSize.height;
if (lineBounds.height == 0)
{
- lineBounds.height = TextUtility::GetFontMaxHeight(pFont);
+ lineBounds.height = TextUtility::GetFontMaxHeightF(pFont);
}
pTextLine->SetBounds(lineBounds);
}
else if (lineEndIndex <= currentTextIndex)
{
- int gapWidth = 0;
- int gapHeight = 0;
+ float gapWidth = 0;
+ float gapHeight = 0;
+ float tempWidth = 0;
int textCount = 0;
- int tempWidth = 0;
r = __pCompositeText->GetRegion(lineEndIndex, currentTextIndex - lineEndIndex, gapWidth, gapHeight);
SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
__pCompositeText->ForwardAnalyze(lineOffset, __pCompositeText->GetTextLength() - lineOffset, lineBounds.width,
__wrap, lineLength, lineTextSize.width, lineTextSize.height);
- lineBounds.height = Math::Max(lineBounds.height, lineTextSize.height);
+ lineBounds.height = (lineBounds.height > lineTextSize.height) ? lineBounds.height: lineTextSize.height;
if (lineBounds.height == 0)
{
- lineBounds.height = TextUtility::GetFontMaxHeight(pFont);
+ lineBounds.height = TextUtility::GetFontMaxHeightF(pFont);
}
pTextLine->SetBounds(lineBounds);
TextObject::GetTextPositionInfoInWrapAt(int textIndex, int& width, int& height, int& absX, int& absY,
int& logicalX, int& logicalY) const
{
+ float widthF = _CoordinateSystemUtils::ConvertToFloat(width);
+ float heightF = _CoordinateSystemUtils::ConvertToFloat(height);
+ float absXF = _CoordinateSystemUtils::ConvertToFloat(absX);
+ float absYF = _CoordinateSystemUtils::ConvertToFloat(absY);
+ float logicalXF = _CoordinateSystemUtils::ConvertToFloat(logicalX);
+ float logicalYF = _CoordinateSystemUtils::ConvertToFloat(logicalY);
+
+ result r = GetTextPositionInfoInWrapAt(textIndex, widthF, heightF, absXF, absYF, logicalXF, logicalYF);
+ SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ width = _CoordinateSystemUtils::ConvertToInteger(widthF);
+ height = _CoordinateSystemUtils::ConvertToInteger(heightF);
+ absX = _CoordinateSystemUtils::ConvertToInteger(absXF);
+ absY = _CoordinateSystemUtils::ConvertToInteger(absYF);
+ logicalX = _CoordinateSystemUtils::ConvertToInteger(logicalXF);
+ logicalY = _CoordinateSystemUtils::ConvertToInteger(logicalYF);
+
+ return E_SUCCESS;
+}
+
+result
+TextObject::GetTextPositionInfoInWrapAt(int textIndex, float& width, float& height, float& absX, float& absY,
+ float& logicalX, float& logicalY) const
+{
TextLine* pTextLine = null;
- Rectangle lineBounds;
- int firstDisplayPositionY = __pTextColumn->GetFirstDisplayPositionY();
+ FloatRectangle lineBounds;
+ float firstDisplayPositionY = __pTextColumn->GetFirstDisplayPositionYF();
int lineCount = __pTextColumn->GetTotalLineCount();
int lineIndex = 0;
int lineOffset = 0;
int lineLength = 0;
int textIndexFromLineOffset = 0;
- int lineY = 0;
- int posX = 0;
- int posY = 0;
+ float lineY = 0;
+ float posX = 0;
+ float posY = 0;
- _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*__pDefaultFont));
+ _FontImpl* pFont = _FontImpl::GetInstance(*__pDefaultFont);
SysTryReturn(NID_GRP, pFont, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
for (lineIndex = 0; lineIndex < lineCount; lineIndex++)
pTextLine = __pTextColumn->GetTextLine(lineIndex);
SysTryReturn(NID_GRP, pTextLine, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
lineOffset = pTextLine->GetTextOffset();
lineLength = pTextLine->GetTextLength();
textIndexFromLineOffset = textIndex - lineOffset;
}
- Dimension lineTextSize;
+ FloatDimension lineTextSize;
pTextLine->GetRegion(0, lineLength, lineTextSize.width, lineTextSize.height);
if (lineTextSize.height == 0)
{
- lineTextSize.height = TextUtility::GetFontMaxHeight(pFont);
+ lineTextSize.height = TextUtility::GetFontMaxHeightF(pFont);
}
switch (__align & TEXT_ALIGNMASK_HORIZ)
break;
case TEXT_OBJECT_ALIGNMENT_MIDDLE:
- posY += (__pcRect.height - __pTextColumn->GetDisplayHeight()) / 2;
+ posY += (__rect.height - __pTextColumn->GetDisplayHeightF()) / 2;
break;
case TEXT_OBJECT_ALIGNMENT_BOTTOM:
- posY += (__pcRect.height - __pTextColumn->GetDisplayHeight());
+ posY += (__rect.height - __pTextColumn->GetDisplayHeightF());
break;
}
posY = 0;
}
- Rectangle textExtent = pTextLine->GetTextExtent(textIndexFromLineOffset, 1);
+ FloatRectangle textExtent = pTextLine->GetTextExtentF(textIndexFromLineOffset, 1);
if (lineIndex == lineCount)
{
if (textIndex >= 1)
{
Font* pTextFont = __pCompositeText->GetFont(textIndex - 1);
- textExtent.height = TextUtility::GetFontMaxHeight(pTextFont);
+ textExtent.height = TextUtility::GetFontMaxHeightF(pTextFont);
}
if (textExtent.height < 0)
{
- textExtent.height = TextUtility::GetFontMaxHeight(pFont);
+ textExtent.height = TextUtility::GetFontMaxHeightF(pFont);
}
TextObjectAlignment alignment = __pCompositeText->GetElementVerticalAlignment();
width = textExtent.width;
height = textExtent.height;
absX = posX + textExtent.x;
- logicalX = absX + __pcRect.x;
+ logicalX = absX + __rect.x;
absY = lineY;
- logicalY = absY - firstDisplayPositionY + __pcRect.y + posY;
+ logicalY = absY - firstDisplayPositionY + __rect.y + posY;
return E_SUCCESS;
}
result
-TextObject::GetTextPositionInfoInWrapAt(int textIndex, float& width, float& height, float& absX, float& absY,
- float& logicalX, float& logicalY) const
+TextObject::GetBlockTextPositionInfoInWrapAt(int textIndex, int& width, int& height, int& absX, int& absY,
+ int& logicalX, int& logicalY) const
{
- int newWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int newHeight = _CoordinateSystemUtils::ConvertToInteger(height);
- int newAbsX = _CoordinateSystemUtils::ConvertToInteger(absX);
- int newAbsY = _CoordinateSystemUtils::ConvertToInteger(absY);
- int newLogicalX = _CoordinateSystemUtils::ConvertToInteger(logicalX);
- int newLogicalY = _CoordinateSystemUtils::ConvertToInteger(logicalY);
+ float widthF = _CoordinateSystemUtils::ConvertToFloat(width);
+ float heightF = _CoordinateSystemUtils::ConvertToFloat(height);
+ float absXF = _CoordinateSystemUtils::ConvertToFloat(absX);
+ float absYF = _CoordinateSystemUtils::ConvertToFloat(absY);
+ float logicalXF = _CoordinateSystemUtils::ConvertToFloat(logicalX);
+ float logicalYF = _CoordinateSystemUtils::ConvertToFloat(logicalY);
- result r = GetTextPositionInfoInWrapAt(textIndex, newWidth, newHeight, newAbsX, newAbsY, newLogicalX, newLogicalY);
+ result r = GetBlockTextPositionInfoInWrapAt(textIndex, widthF, heightF, absXF, absYF, logicalXF, logicalYF);
+ SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- width = _CoordinateSystemUtils::ConvertToFloat(newWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(newHeight);
- absX = _CoordinateSystemUtils::ConvertToFloat(newAbsX);
- absY = _CoordinateSystemUtils::ConvertToFloat(newAbsY);
- logicalX = _CoordinateSystemUtils::ConvertToFloat(newLogicalX);
- logicalY = _CoordinateSystemUtils::ConvertToFloat(newLogicalY);
+ width = _CoordinateSystemUtils::ConvertToInteger(widthF);
+ height = _CoordinateSystemUtils::ConvertToInteger(heightF);
+ absX = _CoordinateSystemUtils::ConvertToInteger(absXF);
+ absY = _CoordinateSystemUtils::ConvertToInteger(absYF);
+ logicalX = _CoordinateSystemUtils::ConvertToInteger(logicalXF);
+ logicalY = _CoordinateSystemUtils::ConvertToInteger(logicalYF);
- return r;
+ return E_SUCCESS;
}
result
-TextObject::GetBlockTextPositionInfoInWrapAt(int textIndex, int& width, int& height, int& absX, int& absY,
- int& logicalX, int& logicalY) const
+TextObject::GetBlockTextPositionInfoInWrapAt(int textIndex, float& width, float& height, float& absX, float& absY,
+ float& logicalX, float& logicalY) const
{
TextLine* pTextLine = null;
- Rectangle lineBounds;
- int firstDisplayPositionY = __pTextColumn->GetFirstDisplayPositionY();
+ FloatRectangle lineBounds;
+ float firstDisplayPositionY = __pTextColumn->GetFirstDisplayPositionYF();
int lineCount = __pTextColumn->GetTotalLineCount();
int lineIndex = 0;
int lineOffset = 0;
int lineLength = 0;
int textIndexFromLineOffset = 0;
- int lineY = 0;
- int posX = 0;
- int posY = 0;
+ float lineY = 0;
+ float posX = 0;
+ float posY = 0;
- _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*__pDefaultFont));
+ _FontImpl* pFont = _FontImpl::GetInstance(*__pDefaultFont);
SysTryReturn(NID_GRP, pFont, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
for (lineIndex = 0; lineIndex < lineCount; lineIndex++)
pTextLine = __pTextColumn->GetTextLine(lineIndex);
SysTryReturn(NID_GRP, pTextLine, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
lineOffset = pTextLine->GetTextOffset();
lineLength = pTextLine->GetTextLength();
break;
case TEXT_OBJECT_ALIGNMENT_MIDDLE:
- posY += (__pcRect.height - __pTextColumn->GetDisplayHeight()) / 2;
+ posY += (__rect.height - __pTextColumn->GetDisplayHeight()) / 2;
break;
case TEXT_OBJECT_ALIGNMENT_BOTTOM:
- posY += (__pcRect.height - __pTextColumn->GetDisplayHeight());
+ posY += (__rect.height - __pTextColumn->GetDisplayHeight());
break;
}
posY = 0;
}
- Rectangle textExtent = pTextLine->GetBlockTextExtent(textIndexFromLineOffset, 1);
+ FloatRectangle textExtent = pTextLine->GetBlockTextExtentF(textIndexFromLineOffset, 1);
if (lineIndex == lineCount)
{
if (textIndex >= 1)
{
Font* pTextFont = __pCompositeText->GetFont(textIndex - 1);
- textExtent.height = TextUtility::GetFontMaxHeight(pTextFont);
+ textExtent.height = TextUtility::GetFontMaxHeightF(pTextFont);
}
if (textExtent.height < 0)
{
- textExtent.height = TextUtility::GetFontMaxHeight(pFont);
+ textExtent.height = TextUtility::GetFontMaxHeightF(pFont);
}
TextObjectAlignment alignment = __pCompositeText->GetElementVerticalAlignment();
width = textExtent.width;
height = textExtent.height;
absX = posX + textExtent.x;
- logicalX = absX + __pcRect.x;
+ logicalX = absX + __rect.x;
absY = lineY;
- logicalY = absY - firstDisplayPositionY + __pcRect.y + posY;
+ logicalY = absY - firstDisplayPositionY + __rect.y + posY;
return E_SUCCESS;
}
result
-TextObject::GetBlockTextPositionInfoInWrapAt(int textIndex, float& width, float& height, float& absX, float& absY,
- float& logicalX, float& logicalY) const
+TextObject::GetTextPositionInfoInNoneWrapAt(int textIndex, int& width, int& height, int& absX, int& absY,
+ int& logicalX, int& logicalY) const
{
- int newWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int newHeight = _CoordinateSystemUtils::ConvertToInteger(height);
- int newAbsX = _CoordinateSystemUtils::ConvertToInteger(absX);
- int newAbsY = _CoordinateSystemUtils::ConvertToInteger(absY);
- int newLogicalX = _CoordinateSystemUtils::ConvertToInteger(logicalX);
- int newLogicalY = _CoordinateSystemUtils::ConvertToInteger(logicalY);
+ float widthF = _CoordinateSystemUtils::ConvertToFloat(width);
+ float heightF = _CoordinateSystemUtils::ConvertToFloat(height);
+ float absXF = _CoordinateSystemUtils::ConvertToFloat(absX);
+ float absYF = _CoordinateSystemUtils::ConvertToFloat(absY);
+ float logicalXF = _CoordinateSystemUtils::ConvertToFloat(logicalX);
+ float logicalYF = _CoordinateSystemUtils::ConvertToFloat(logicalY);
- result r = GetBlockTextPositionInfoInWrapAt(textIndex, newWidth, newHeight, newAbsX, newAbsY, newLogicalX, newLogicalY);
+ result r = GetTextPositionInfoInNoneWrapAt(textIndex, widthF, heightF, absXF, absYF, logicalXF, logicalYF);
+ SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- width = _CoordinateSystemUtils::ConvertToFloat(newWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(newHeight);
- absX = _CoordinateSystemUtils::ConvertToFloat(newAbsX);
- absY = _CoordinateSystemUtils::ConvertToFloat(newAbsY);
- logicalX = _CoordinateSystemUtils::ConvertToFloat(newLogicalX);
- logicalY = _CoordinateSystemUtils::ConvertToFloat(newLogicalY);
+ width = _CoordinateSystemUtils::ConvertToInteger(widthF);
+ height = _CoordinateSystemUtils::ConvertToInteger(heightF);
+ absX = _CoordinateSystemUtils::ConvertToInteger(absXF);
+ absY = _CoordinateSystemUtils::ConvertToInteger(absYF);
+ logicalX = _CoordinateSystemUtils::ConvertToInteger(logicalXF);
+ logicalY = _CoordinateSystemUtils::ConvertToInteger(logicalYF);
- return r;
+ return E_SUCCESS;
}
result
-TextObject::GetTextPositionInfoInNoneWrapAt(int textIndex, int& width, int& height, int& absX, int& absY,
- int& logicalX, int& logicalY) const
+TextObject::GetTextPositionInfoInNoneWrapAt(int textIndex, float& width, float& height, float& absX, float& absY,
+ float& logicalX, float& logicalY) const
{
TextLine* pTextLine = null;
pTextLine = __pTextColumn->GetTextLine(0);
SysTryReturn(NID_GRP, pTextLine, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
int lineLength = pTextLine->GetTextLength();
- int posX = 0;
- int posY = 0;
+ float posX = 0;
+ float posY = 0;
- _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*__pDefaultFont));
+ _FontImpl* pFont = _FontImpl::GetInstance(*__pDefaultFont);
SysTryReturn(NID_GRP, pFont, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
- Dimension lineTextSize;
- Rectangle lineBounds;
- lineBounds = pTextLine->GetBounds();
+ FloatDimension lineTextSize;
+ FloatRectangle lineBounds;
+ lineBounds = pTextLine->GetBoundsF();
pTextLine->GetRegion(0, lineLength, lineTextSize.width, lineTextSize.height);
if (lineTextSize.height == 0 || pTextLine->GetTextLength() == 0)
{
- lineTextSize.height = TextUtility::GetFontMaxHeight(pFont);
+ lineTextSize.height = TextUtility::GetFontMaxHeightF(pFont);
}
switch (__align & TEXT_ALIGNMASK_HORIZ)
break;
case TEXT_OBJECT_ALIGNMENT_MIDDLE:
- posY += (__pcRect.height - lineTextSize.height) / 2;
+ posY += (__rect.height - lineTextSize.height) / 2;
break;
case TEXT_OBJECT_ALIGNMENT_BOTTOM:
- posY += (__pcRect.height - lineTextSize.height);
+ posY += (__rect.height - lineTextSize.height);
break;
}
posX = (posX < 0) ? 0 : posX;
posY = (posY < 0) ? 0 : posY;
- Rectangle textExtent = pTextLine->GetTextExtent(textIndex - pTextLine->GetTextOffset(), 1);
+ FloatRectangle textExtent = pTextLine->GetTextExtentF(textIndex - pTextLine->GetTextOffset(), 1);
if (textIndex >= 1)
{
Font* pTextFont = __pCompositeText->GetFont(textIndex - 1);
- textExtent.height = TextUtility::GetFontMaxHeight(pTextFont);
+ textExtent.height = TextUtility::GetFontMaxHeightF(pTextFont);
}
if (textExtent.height < 0)
{
- textExtent.height = TextUtility::GetFontMaxHeight(pFont);
+ textExtent.height = TextUtility::GetFontMaxHeightF(pFont);
}
TextObjectAlignment alignment = __pCompositeText->GetElementVerticalAlignment();
}
absX = posX + textExtent.x;
- logicalX = (absX >= 0) ? absX + __pcRect.x : absX;
+ logicalX = (absX >= 0) ? absX + __rect.x : absX;
absY = posY;
- logicalY = absY + __pcRect.y;
+ logicalY = absY + __rect.y;
width = textExtent.width;
height = textExtent.height;
return E_SUCCESS;
}
-result
-TextObject::GetTextPositionInfoInNoneWrapAt(int textIndex, float& width, float& height, float& absX, float& absY,
- float& logicalX, float& logicalY) const
-{
- int newWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int newHeight = _CoordinateSystemUtils::ConvertToInteger(height);
- int newAbsX = _CoordinateSystemUtils::ConvertToInteger(absX);
- int newAbsY = _CoordinateSystemUtils::ConvertToInteger(absY);
- int newLogicalX = _CoordinateSystemUtils::ConvertToInteger(logicalX);
- int newLogicalY = _CoordinateSystemUtils::ConvertToInteger(logicalY);
-
- result r = GetTextPositionInfoInNoneWrapAt(textIndex, newWidth, newHeight, newAbsX, newAbsY, newLogicalX, newLogicalY);
-
- width = _CoordinateSystemUtils::ConvertToFloat(newWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(newHeight);
- absX = _CoordinateSystemUtils::ConvertToFloat(newAbsX);
- absY = _CoordinateSystemUtils::ConvertToFloat(newAbsY);
- logicalX = _CoordinateSystemUtils::ConvertToFloat(newLogicalX);
- logicalY = _CoordinateSystemUtils::ConvertToFloat(newLogicalY);
-
- return r;
-}
-
int
TextObject::GetTotalComposedHeight(void) const
{
int
TextObject::GetLineWidthAt(int lineIndex) const
{
+ return _CoordinateSystemUtils::ConvertToInteger(GetLineWidthAtF(lineIndex));
+}
+
+float
+TextObject::GetLineWidthAtF(int lineIndex) const
+{
IF_NOT_CONSTRUCTED(return -1);
result r = E_SUCCESS;
TextLine* pTextLine = null;
- Dimension lineTextSize;
+ FloatDimension lineTextSize;
int lineLength = 0;
- int pcWidth = 0;
- int lcWidth = 0;
pTextLine = __pTextColumn->GetTextLine(lineIndex);
SysTryCatch(NID_GRP, pTextLine, , E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
lineLength = pTextLine->GetTextLength();
r = pTextLine->GetRegion(0, lineLength, lineTextSize.width, lineTextSize.height);
- SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- pcWidth = lineTextSize.width;
- lcWidth = _Text::ConvertToVirCoord(pcWidth);
+ SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
SetLastResult(E_SUCCESS);
- return lcWidth;
+ return lineTextSize.width;
CATCH:
- return -1;
+ return -1;
}
-float
-TextObject::GetLineWidthAtF(int lineIndex) const
+int
+TextObject::GetTotalHeight(void) const
{
- return _CoordinateSystemUtils::ConvertToFloat(GetLineWidthAt(lineIndex));
+ return _CoordinateSystemUtils::ConvertToInteger(GetTotalHeightF());
}
-int
-TextObject::GetTotalHeight(void) const
+float
+TextObject::GetTotalHeightF(void) const
{
IF_NOT_CONSTRUCTED(return -1);
- int pcHeight = 0;
+ float height = 0;
if (IsPartialComposingModeEnabled())
{
- pcHeight = __pCompositeText->GetAnalysedTotalHeight();
+ height = __pCompositeText->GetAnalysedTotalHeightF();
}
else
{
- pcHeight = __pTextColumn->GetTotalHeight();
+ height = __pTextColumn->GetTotalHeightF();
}
- int lcHeight = _Text::ConvertToVirCoord(pcHeight);
-
- return lcHeight;
-}
-
-float
-TextObject::GetTotalHeightF(void) const
-{
- return _CoordinateSystemUtils::ConvertToFloat(GetTotalHeight());
+ return height;
}
int
{
IF_NOT_CONSTRUCTED(return -1);
- int lcSlidingStep = _Text::ConvertToVirCoord(__slidingStep);
-
- return lcSlidingStep;
+ return __slidingStep;
}
result
-TextObject::SetSlidingStep(int lcSlidingStep)
+TextObject::SetSlidingStep(int slidingStep)
{
IF_NOT_CONSTRUCTED(return E_INVALID_STATE);
- int pcSlidingStep = _Text::ConvertToPhyCoord(lcSlidingStep);
-
- __slidingStep = pcSlidingStep;
+ __slidingStep = slidingStep;
return E_SUCCESS;
}
int
TextObject::GetLineHeightAt(int lineIndex) const
+{
+ return _CoordinateSystemUtils::ConvertToInteger(GetLineHeightAtF(lineIndex));
+}
+
+float
+TextObject::GetLineHeightAtF(int lineIndex) const
{
IF_NOT_CONSTRUCTED(return -1);
SysTryReturn(NID_GRP, lineIndex >= 0, -1, E_INVALID_ARG
, "[E_INVALID_ARG] The argument is invalid. (lineIndex = %d)", lineIndex);
- int pcHeight = __pTextColumn->GetLineHeightAt(lineIndex);
- int lcHeight = _Text::ConvertToVirCoord(pcHeight);
-
- return lcHeight;
-}
-
-float
-TextObject::GetLineHeightAtF(int lineIndex) const
-{
- return _CoordinateSystemUtils::ConvertToFloat(GetLineHeightAt(lineIndex));
+ return __pTextColumn->GetLineHeightAtF(lineIndex);
}
int
int
TextObject::GetFirstDisplayPositionY(void) const
{
- IF_NOT_CONSTRUCTED(return -1);
-
- int pcFirstDisplayPositionY = __pTextColumn->GetFirstDisplayPositionY();
- int lcFirstDisplayPositionY = _Text::ConvertToVirCoord(pcFirstDisplayPositionY);
-
- return lcFirstDisplayPositionY;
+ return _CoordinateSystemUtils::ConvertToInteger(GetFirstDisplayPositionYF());
}
float
TextObject::GetFirstDisplayPositionYF(void) const
{
- return _CoordinateSystemUtils::ConvertToFloat(GetFirstDisplayPositionY());
+ IF_NOT_CONSTRUCTED(return -1);
+
+ return __pTextColumn->GetFirstDisplayPositionYF();
}
int
-TextObject::GetLineIndexAtPositionY(int lcY) const
+TextObject::GetLineIndexAtPositionY(int y) const
{
- IF_NOT_CONSTRUCTED(return -1);
-
- int pcY = _Text::ConvertToPhyCoord(lcY);
-
- return __pTextColumn->GetLineIndexAtPositionY(pcY);
+ return GetLineIndexAtPositionY(_CoordinateSystemUtils::ConvertToFloat(y));
}
int
-TextObject::GetLineIndexAtPositionY(float lcY) const
+TextObject::GetLineIndexAtPositionY(float y) const
{
- return GetLineIndexAtPositionY(_CoordinateSystemUtils::ConvertToInteger(lcY));
+ IF_NOT_CONSTRUCTED(return -1);
+
+ return __pTextColumn->GetLineIndexAtPositionY(y);
}
int
{
IF_NOT_CONSTRUCTED(return Rectangle(0,0,0,0));
- return __rect;
+ return _CoordinateSystemUtils::ConvertToInteger(__rect);
}
FloatRectangle
{
IF_NOT_CONSTRUCTED(return -1);
- int pcLineSpacing = __pCompositeText->GetLineSpace();
- int lcLineSpacing = _Text::ConvertToVirCoord(pcLineSpacing);
-
- return lcLineSpacing;
+ return __pCompositeText->GetLineSpace();
}
float
Rectangle
TextObject::GetBoundsAtLine(int lineIndex) const
{
- IF_NOT_CONSTRUCTED(return Rectangle(-1, -1, -1, -1));
+ return _CoordinateSystemUtils::ConvertToInteger(GetBoundsAtLineF(lineIndex));
+}
+
+FloatRectangle
+TextObject::GetBoundsAtLineF(int lineIndex) const
+{
+ IF_NOT_CONSTRUCTED(return FloatRectangle(-1, -1, -1, -1));
- SysTryReturn(NID_GRP, lineIndex >= 0, Rectangle(-1, -1, -1, -1), E_INVALID_ARG
+ SysTryReturn(NID_GRP, lineIndex >= 0, FloatRectangle(-1, -1, -1, -1), E_INVALID_ARG
, "[E_INVALID_ARG] The argument is invalid. (lineIndex = %d)", lineIndex);
TextLine* pTextLine = __pTextColumn->GetTextLine(lineIndex);
- SysTryReturn(NID_GRP, pTextLine, Rectangle(-1, -1, -1, -1), E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
+ SysTryReturn(NID_GRP, pTextLine, FloatRectangle(-1, -1, -1, -1), E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
- Rectangle lineBounds = pTextLine->GetBounds();
+ FloatRectangle lineBounds = pTextLine->GetBoundsF();
- return lineBounds;
+ return lineBounds;
}
-FloatRectangle
-TextObject::GetBoundsAtLineF(int lineIndex) const
+Point
+TextObject::GetDisplayPositionAtLine(int lineIndex, int textIndexFromLineOffset)
{
- return _CoordinateSystemUtils::ConvertToFloat(GetBoundsAtLine(lineIndex));
+ return _CoordinateSystemUtils::ConvertToInteger(GetDisplayPositionAtLineF(lineIndex, textIndexFromLineOffset));
}
-Point
-TextObject::GetDisplayPositionAtLine(int lineIndex, int textIndexFromLineOffset)
+FloatPoint
+TextObject::GetDisplayPositionAtLineF(int lineIndex, int textIndexFromLineOffset)
{
- IF_NOT_CONSTRUCTED(return Point(-1, -1));
+ IF_NOT_CONSTRUCTED(return FloatPoint(-1.0f, -1.0f));
- SysTryReturn(NID_GRP, lineIndex >= 0, Point(-1, -1), E_INVALID_ARG
+ SysTryReturn(NID_GRP, lineIndex >= 0, FloatPoint(-1.0f, -1.0f), E_INVALID_ARG
, "[E_INVALID_ARG] The argument is invalid. (lineIndex = %d)", lineIndex);
TextLine* pTextLine = __pTextColumn->GetTextLine(lineIndex);
- SysTryReturn(NID_GRP, pTextLine, Point(-1, -1), E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
+ SysTryReturn(NID_GRP, pTextLine, FloatPoint(-1.0f, -1.0f), E_SYSTEM, "[E_SYSTEM] Fail to get text line.");
int lineOffset = pTextLine->GetTextOffset();
int lineLength = pTextLine->GetTextLength();
- Dimension lineTextSize;
- Dimension extentDim;
+ FloatDimension lineTextSize;
+ FloatDimension extentDim;
+ FloatRectangle lineBounds;
int textCount = 0;
- Rectangle lineBounds;
pTextLine->GetRegion(0, lineLength, lineTextSize.width, lineTextSize.height);
- lineBounds = pTextLine->GetBounds();
+ lineBounds = pTextLine->GetBoundsF();
__pCompositeText->ForwardAnalyze(lineOffset, textIndexFromLineOffset, lineTextSize.width, __wrap, textCount, extentDim.width, extentDim.height);
break;
}
- if (extentDim.width < 0)
+ if (extentDim.width < 0.0f)
{
- extentDim.width = 0;
+ extentDim.width = 0.0f;
}
- return Point(extentDim.width + __rect.x, lineBounds.y - __pTextColumn->GetFirstDisplayPositionY() + __rect.y);
-}
-
-FloatPoint
-TextObject::GetDisplayPositionAtLineF(int lineIndex, int textIndexFromLineOffset)
-{
- return _CoordinateSystemUtils::ConvertToFloat(GetDisplayPositionAtLine(lineIndex, textIndexFromLineOffset));
+ return FloatPoint(extentDim.width + __rect.x, lineBounds.y - __pTextColumn->GetFirstDisplayPositionYF() + __rect.y);
}
Tizen::Base::String
#include "FGrp_TextTextUtility.h"
#include "FGrp_FontImpl.h"
#include "../FGrp_BitmapUtil.h"
-#include "../FGrp_Font.h"
-#include "../FGrp_Canvas.h"
#include "FGrp_CoordinateSystemUtils.h"
#include <fribidi.h>
TextSimple::ForwardAnalyze(int startTextIndex, int textLength, int maxWidth, TextObjectWrapType wrap, int& actualLength,
int& width, int& height)
{
+ int maxWidthF = _CoordinateSystemUtils::ConvertToFloat(maxWidth);
+ int widthF = _CoordinateSystemUtils::ConvertToFloat(width);
+ int heightF = _CoordinateSystemUtils::ConvertToFloat(height);
+
+ int r = ForwardAnalyze(startTextIndex, textLength, maxWidthF, wrap, actualLength, widthF, heightF);
+
+ width = _CoordinateSystemUtils::ConvertToInteger(widthF);
+ height = _CoordinateSystemUtils::ConvertToInteger(heightF);
+
+ return r;
+}
+
+int
+TextSimple::ForwardAnalyze(int startTextIndex, int textLength, float maxWidth, TextObjectWrapType wrap,
+ int& actualLength, float& width, float& height)
+{
int charCount = 0;
int r = TEXT_RETBY_NORMAL;
}
Font* pCurrentFont = GetCurrentFont();
- _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*pCurrentFont));
- SysTryReturn(NID_GRP, pFont, -1, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
+ _FontImpl* pFontImpl = _FontImpl::GetInstance(*pCurrentFont);
+ SysTryReturn(NID_GRP, pFontImpl, -1, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
const wchar_t* pText = &_pText[startTextIndex];
int length = ConvertEnterToSpace(pModifiedText, pText, textLength);
pModifiedText[length] = 0;
- actualLength = TextUtility::GetCharCountInWidth(pFont, pModifiedText, length, maxWidth, _outline, width, height);
+ actualLength = TextUtility::GetCharCountInWidth(pFontImpl, pModifiedText, length, maxWidth, _outline, width, height);
charCount = textLength;
r = TEXT_RETBY_NORMAL;
}
else
{
- actualLength = TextUtility::GetCharCountInWidth(pFont, pText, textLength, maxWidth, _outline, width, height);
+ actualLength = TextUtility::GetCharCountInWidth(pFontImpl, pText, textLength, maxWidth, _outline, width, height);
charCount = textLength;
r = TEXT_RETBY_NORMAL;
}
case TEXT_OBJECT_WRAP_TYPE_CHARACTER:
r = GetSentenceLength(pText, textLength, charCount);
- actualLength = TextUtility::GetCharCountInWidth(pFont, pText, charCount, maxWidth, _outline, width, height);
+ actualLength = TextUtility::GetCharCountInWidth(pFontImpl, pText, charCount, maxWidth, _outline, width, height);
if (_pText[startTextIndex + actualLength] == TEXT_LINE_FEED || _pText[startTextIndex + actualLength] == TEXT_CARRIAGE_RETURN)
{
(actualLength)++;
if (charCount != 0)
{
- actualLength = TextUtility::GetCharCountInWidth(pFont, pText, charCount, maxWidth, _outline, width, height);
+ actualLength = TextUtility::GetCharCountInWidth(pFontImpl, pText, charCount, maxWidth, _outline, width, height);
actualLength = charCount;
}
}
break;
case TEXT_OBJECT_WRAP_TYPE_WORD:
- actualLength = TextUtility::GetCharCountInWidth(pFont, pText, textLength, maxWidth, _outline, width, height);
+ actualLength = TextUtility::GetCharCountInWidth(pFontImpl, pText, textLength, maxWidth, _outline, width, height);
int widthcheck = width;
if (_pText[startTextIndex + actualLength] == TEXT_LINE_FEED || _pText[startTextIndex + actualLength] == TEXT_CARRIAGE_RETURN)
if (charCount > (actualLength / 2))
{
const wchar_t* pExtraText = &_pText[startTextIndex + charCount];
- int overCharCount = TextUtility::GetCharCountInWidth(pFont, pExtraText, actualLength - charCount, maxWidth, _outline, width, height);
+ int overCharCount = TextUtility::GetCharCountInWidth(pFontImpl, pExtraText, actualLength - charCount, maxWidth, _outline, width, height);
actualLength = actualLength - overCharCount;
width = widthcheck - width;
}
else
{
- actualLength = TextUtility::GetCharCountInWidth(pFont, pText, charCount, maxWidth, _outline, width, height);
+ actualLength = TextUtility::GetCharCountInWidth(pFontImpl, pText, charCount, maxWidth, _outline, width, height);
}
actualLength = charCount;
if (height == 0 && (textLength > 0))
{
- height = pFont->GetLeading().ToInt();
+ height = pFontImpl->GetLeading();
}
if (actualLength < charCount)
return r;
}
-int
-TextSimple::ForwardAnalyze(int startTextIndex, int textLength, float maxWidth, TextObjectWrapType wrap,
- int& actualLength, float& width, float& height)
-{
- int iMaxWidth = _CoordinateSystemUtils::ConvertToInteger(maxWidth);
- int iWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int iHeight = _CoordinateSystemUtils::ConvertToInteger(height);
- int r = ForwardAnalyze(startTextIndex, textLength, iMaxWidth, wrap, actualLength, iWidth, iHeight);
- width = _CoordinateSystemUtils::ConvertToFloat(iWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(iHeight);
- return r;
-}
-
bool
TextSimple::IsKorean(const wchar_t* ch) const
{
result
TextSimple::GetRegion(int textIndex, int textLength, int& width, int& height) const
{
- const wchar_t* pText = null;
- Font* pCurrentFont = GetCurrentFont();
- SysTryReturn(NID_GRP, pCurrentFont, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not line wrapped yet.");
+ float widthF = _CoordinateSystemUtils::ConvertToInteger(width);
+ float heightF = _CoordinateSystemUtils::ConvertToInteger(height);
- _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*pCurrentFont));
- SysTryReturn(NID_GRP, pFont, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
+ result r = GetRegion(textIndex, textLength, widthF, heightF);
- if (textLength > _length)
- {
- textLength = _length;
- }
+ width = _CoordinateSystemUtils::ConvertToFloat(widthF);
+ height = _CoordinateSystemUtils::ConvertToFloat(heightF);
- if (textLength == 0)
- {
- width = 0;
- height = 0;
-
- return E_SUCCESS;
- }
-
- if (__bitmapProperty.pBitmap)
- {
- if (__bitmapProperty.displayEnable)
- {
- width = __bitmapProperty.pBitmap->GetWidth();
- height = __bitmapProperty.pBitmap->GetHeight();
- }
- else
- {
- width = 0;
- height = 0;
- }
-
- return E_SUCCESS;
- }
-
- pText = &_pText[textIndex];
-
- switch (_userWrap)
- {
- case TEXT_OBJECT_WRAP_TYPE_NONE:
- {
- wchar_t* pModifiedText = new (std::nothrow) wchar_t[textLength + 1];
- SysTryReturn(NID_GRP, pModifiedText, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
-
- int length = ConvertEnterToSpace(pModifiedText, pText, textLength);
- pModifiedText[textLength] = 0;
-
- TextUtility::GetTextExtent(pFont, pModifiedText, length, _outline, width, height);
-
- delete[] pModifiedText;
- pModifiedText = null;
- }
- break;
-
- case TEXT_OBJECT_WRAP_TYPE_CHARACTER:
- // fall through
- case TEXT_OBJECT_WRAP_TYPE_WORD:
- TextUtility::GetTextExtent(pFont, pText, textLength, _outline, width, height);
- break;
- }
-
- if (height == 0 && (textLength > 0))
- {
- height = pFont->GetLeading().ToInt();
- }
-
- return E_SUCCESS;
-}
-
-result
-TextSimple::GetRegion(int textIndex, int textLength, float& width, float& height) const
-{
- int iWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int iHeight = _CoordinateSystemUtils::ConvertToInteger(height);
- result r = GetRegion(textIndex, textLength, iWidth, iHeight);
- width = _CoordinateSystemUtils::ConvertToFloat(iWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(iHeight);
return r;
}
result
-TextSimple::GetBlockRegion(int textIndex, int textLength, int& width, int& height) const
+TextSimple::GetRegion(int textIndex, int textLength, float& width, float& height) const
{
const wchar_t* pText = null;
Font* pCurrentFont = GetCurrentFont();
SysTryReturn(NID_GRP, pCurrentFont, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not line wrapped yet.");
- _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*pCurrentFont));
- SysTryReturn(NID_GRP, pFont, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
+ _FontImpl* pFontImpl = _FontImpl::GetInstance(*pCurrentFont);
+ SysTryReturn(NID_GRP, pFontImpl, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
if (textLength > _length)
{
int length = ConvertEnterToSpace(pModifiedText, pText, textLength);
pModifiedText[textLength] = 0;
- TextUtility::GetTextExtent(pFont, pModifiedText, length, _outline, width, height);
+ TextUtility::GetTextExtent(pFontImpl, pModifiedText, length, _outline, width, height);
delete[] pModifiedText;
pModifiedText = null;
case TEXT_OBJECT_WRAP_TYPE_CHARACTER:
// fall through
case TEXT_OBJECT_WRAP_TYPE_WORD:
- TextUtility::GetTextExtent(pFont, pText, textLength, _outline, width, height);
-
- if (pText[textLength-1] == TEXT_LINE_FEED || pText[textLength-1] == TEXT_CARRIAGE_RETURN)
- {
- width += LINE_FEED_WIDTH;
- }
+ TextUtility::GetTextExtent(pFontImpl, pText, textLength, _outline, width, height);
break;
}
if (height == 0 && (textLength > 0))
{
- pFont->GetLeading().ToInt();
+ height = pFontImpl->GetLeading();
}
return E_SUCCESS;
}
-result
-TextSimple::GetBlockRegion(int textIndex, int textLength, float& width, float& height) const
-{
- int iWidth = _CoordinateSystemUtils::ConvertToInteger(width);
- int iHeight = _CoordinateSystemUtils::ConvertToInteger(height);
- result r = GetBlockRegion(textIndex, textLength, iWidth, iHeight);
- width = _CoordinateSystemUtils::ConvertToFloat(iWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(iHeight);
- return r;
-}
-
int
TextSimple::GetHeight(void) const
{
TextSimple::Draw(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength,
const TextObjectAlignment align, const TextObjectActionType action)
{
+ FloatRectangle displayRectF = _CoordinateSystemUtils::ConvertToFloat(displayRect);
+
+ return Draw(canvasImpl, displayRectF, startTextIndex, textLength, align, action);
+}
+
+result
+TextSimple::Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength,
+ const TextObjectAlignment alignment, const TextObjectActionType action)
+{
SysTryReturn(NID_GRP, textLength <= _length, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
if (textLength == 0)
}
result r = E_SUCCESS;
- _Canvas* pCanvas = _Canvas::GetInstance(canvasImpl);
- SysTryReturn(NID_GRP, pCanvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native canvas instance.");
if (__bitmapProperty.pBitmap)
{
if (__bitmapProperty.displayEnable)
{
- r = pCanvas->DrawBitmap(Point(displayRect.x, displayRect.y), *_GetBitmapEx(*_BitmapImpl::GetInstance(*__bitmapProperty.pBitmap)));
+ r = canvasImpl.DrawBitmap(FloatPoint(displayRect.x, displayRect.y), *_BitmapImpl::GetInstance(*__bitmapProperty.pBitmap));
SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
}
}
Color foregroundColor = GetCurrentForegroundColor();
- pCanvas->SetForegroundColor(foregroundColor);
+ canvasImpl.SetForegroundColor(foregroundColor);
Color backgroundColor = GetCurrentBackgroundColor();
- pCanvas->SetBackgroundColor(backgroundColor);
+ canvasImpl.SetBackgroundColor(backgroundColor);
Color outlineColor = GetCurrentOutlineColor();
Font* pCurrentFont = GetCurrentFont();
SysTryReturn(NID_GRP, pCurrentFont, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not line wrapped yet.");
- _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*pCurrentFont));
- SysTryReturn(NID_GRP, pFont, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
+ _FontImpl* pFontImpl = _FontImpl::GetInstance(*pCurrentFont);
+ SysTryReturn(NID_GRP, pFontImpl, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
- r = pCanvas->SetPriorityFont(*pFont);
+ r = canvasImpl.SetPriorityFont(*pCurrentFont);
SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
if (_userWrap != TEXT_OBJECT_WRAP_TYPE_NONE)
{
if (_outline)
{
- return TextUtility::DrawOutlineText(*pCanvas, displayRect.x, displayRect.y, &_pText[startTextIndex], textLength, outlineColor);
+ return TextUtility::DrawOutlineText(canvasImpl, displayRect.x, displayRect.y, &_pText[startTextIndex], textLength, outlineColor);
}
else
{
- return TextUtility::DrawText(*pCanvas, displayRect.x, displayRect.y, &_pText[startTextIndex], textLength);
+ return TextUtility::DrawText(canvasImpl, displayRect.x, displayRect.y, &_pText[startTextIndex], textLength);
}
}
else
if (_outline)
{
- TextUtility::DrawOutlineText(*pCanvas, displayRect.x, displayRect.y, pModifiedText, length, outlineColor);
+ TextUtility::DrawOutlineText(canvasImpl, displayRect.x, displayRect.y, pModifiedText, length, outlineColor);
}
else
{
- TextUtility::DrawText(*pCanvas, displayRect.x, displayRect.y, pModifiedText, length);
+ TextUtility::DrawText(canvasImpl, displayRect.x, displayRect.y, pModifiedText, length);
}
delete[] pModifiedText;
return E_SUCCESS;
}
-result
-TextSimple::Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength,
- const TextObjectAlignment alignment, const TextObjectActionType action)
-{
- Rectangle iDisplayRect;
- iDisplayRect.x = _CoordinateSystemUtils::ConvertToInteger(displayRect.x);
- iDisplayRect.y = _CoordinateSystemUtils::ConvertToInteger(displayRect.y);
- iDisplayRect.width = _CoordinateSystemUtils::ConvertToInteger(displayRect.width);
- iDisplayRect.height = _CoordinateSystemUtils::ConvertToInteger(displayRect.height);
-
- return Draw(canvasImpl, iDisplayRect, startTextIndex, textLength, alignment, action);
-}
-
TextElement*
TextSimple::CloneN(TextComponentInfoValueType type, unsigned int value)
{
int
TextSimple::GetBaseline(void) const
{
+ return _CoordinateSystemUtils::ConvertToInteger(GetBaselineF());
+}
+
+float
+TextSimple::GetBaselineF(void) const
+{
Font* pCurrentFont = GetCurrentFont();
SysTryReturn(NID_GRP, pCurrentFont, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not line wrapped yet.");
- _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*pCurrentFont));
- SysTryReturn(NID_GRP, pFont, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
+ _FontImpl* pFontImpl = _FontImpl::GetInstance(*pCurrentFont);
+ SysTryReturn(NID_GRP, pFontImpl, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
- return (-1) * pFont->GetDescender().ToInt();
+ return (-1) * pFontImpl->GetDescenderF();
}
}}} // Tizen::Graphics::_Text
#include <new>
#include <FBaseSysLog.h>
-#include "../FGrp_Canvas.h"
+#include <FBaseColLinkedList.h>
+#include "FGrp_CanvasImpl.h"
#include "FGrp_FontImpl.h"
#include "FGrp_TextCommon.h"
#include "FGrp_TextTextSimple.h"
using namespace Tizen::Base::Utility;
using namespace Tizen::Base;
-// [TODO] use before _Font::GetTextExtent is working properly.
-#define EXTENT_BIDI_LIST
+#define Release(x) \
+ if (x) \
+ { \
+ delete x; \
+ x = null; \
+ }
namespace Tizen { namespace Graphics
{
int
TextUtility::GetFontMaxHeight(Font* pFont)
{
- if (!pFont)
- {
- return 0;
- }
-
- _Font* pNativeFont = _Font::GetInstance(*_FontImpl::GetInstance(*pFont));
- SysTryReturn(NID_GRP, pNativeFont, -1, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
-
- return pNativeFont->GetLeading().ToInt();
+ return _CoordinateSystemUtils::ConvertToInteger(GetFontMaxHeightF(pFont));
}
int
-TextUtility::GetFontMaxHeight(_Font* pFont)
+TextUtility::GetFontMaxHeight(_FontImpl* pFont)
+{
+ return _CoordinateSystemUtils::ConvertToInteger(GetFontMaxHeightF(pFont));
+}
+
+float
+TextUtility::GetFontMaxHeightF(Font* pFont)
{
if (!pFont)
{
return 0;
}
- return pFont->GetLeading().ToInt();
+ return pFont->GetMaxHeightF();
}
-
float
-TextUtility::GetFontMaxHeightF(Font* pFont)
+TextUtility::GetFontMaxHeightF(_FontImpl* pFont)
{
- return _CoordinateSystemUtils::ConvertToFloat(GetFontMaxHeight(pFont));
-}
+ if (!pFont)
+ {
+ return 0;
+ }
-float
-TextUtility::GetFontMaxHeightF(_Font* pFont)
-{
- return _CoordinateSystemUtils::ConvertToFloat(GetFontMaxHeight(pFont));
+ return pFont->GetLeadingF();
}
int
}
int
-TextUtility::GetCharCountInWidth(_Font* pFont, const wchar_t* pText, int textLength, int maxWidth, bool outline, int& width, int& height)
+TextUtility::GetCharCountInWidth(_FontImpl* pFont, const wchar_t* pText, int textLength, float maxWidth, bool outline, float& width, float& height)
{
if (!pFont)
{
result r = E_SUCCESS;
int count = 0;
- Dimension lineDimension;
+ FloatDimension lineDimension;
+
+ r = pFont->GetTextExtent(maxWidth, pText, 0, textLength, outline, L"", count, lineDimension);
- r = pFont->GetTextExtent(maxWidth, _Util::String(pText, textLength), outline, L"", count, lineDimension);
SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
width = lineDimension.width;
- height = pFont->GetLeading().ToInt();
+ height = pFont->GetLeadingF();
SetLastResult(E_SUCCESS);
return 0;
}
-int
-TextUtility::GetCharCountInWidth(_Font* pFont, const wchar_t* pText, int textLength, float maxWidth, bool outline, float& width, float& height)
-{
- int iMaxWidth = _CoordinateSystemUtils::ConvertToInteger(maxWidth);
- int iWidth = 0;
- int iHeight = 0;
- int charCount = GetCharCountInWidth(pFont, pText, textLength, iMaxWidth, outline, iWidth, iHeight);
- width = _CoordinateSystemUtils::ConvertToFloat(iWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(iHeight);
-
- return charCount;
-}
-
result
TextUtility::CopyText(wchar_t* pDstText, const wchar_t* pSrcText, int textLength)
{
}
result
-TextUtility::DrawText(_Canvas& canvas, int x, int y, const wchar_t* pText, int textLength)
+TextUtility::DrawText(_CanvasImpl& canvasImpl, int x, int y, const wchar_t* pText, int textLength)
+{
+ return DrawText(canvasImpl, _CoordinateSystemUtils::ConvertToFloat(x), _CoordinateSystemUtils::ConvertToFloat(y), pText, textLength);
+}
+
+result
+TextUtility::DrawText(_CanvasImpl& canvasImpl, float x, float y, const wchar_t* pText, int textLength)
{
result r = E_SUCCESS;
- Point point(x, y);
+ FloatPoint point(x, y);
Tizen::Base::String text(pText);
textLength--;
}
- r = canvas.DrawText(point, text, 0, textLength);
+ r = canvasImpl.DrawText(point, text, 0, textLength);
SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- return E_SUCCESS;
+ return E_SUCCESS;
}
result
-TextUtility::DrawText(_Canvas& canvas, float x, float y, const wchar_t* pText, int textLength)
+TextUtility::DrawOutlineText(_CanvasImpl& canvasImpl, int x, int y, const wchar_t* pText, int textLength, Color outlineColor)
{
- return DrawText(canvas, _CoordinateSystemUtils::ConvertToInteger(x), _CoordinateSystemUtils::ConvertToInteger(y), pText, textLength);
+ return DrawOutlineText(canvasImpl, _CoordinateSystemUtils::ConvertToFloat(x), _CoordinateSystemUtils::ConvertToFloat(y), pText, textLength, outlineColor);
}
result
-TextUtility::DrawOutlineText(_Canvas& canvas, int x, int y, const wchar_t* pText, int textLength, Color outlineColor)
+TextUtility::DrawOutlineText(_CanvasImpl& canvasImpl, float x, float y, const wchar_t* pText, int textLength, Color outlineColor)
{
result r = E_SUCCESS;
- Point point(x, y);
+ FloatPoint point(x, y);
Tizen::Base::String text(pText);
textLength--;
}
- r = canvas.DrawText(point, text, 0, textLength, outlineColor);
+ r = canvasImpl.DrawText(point, text, 0, textLength, outlineColor);
SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
return E_SUCCESS;
}
result
-TextUtility::DrawOutlineText(_Canvas& canvas, float x, float y, const wchar_t* pText, int textLength, Color outlineColor)
-{
- return DrawOutlineText(canvas, _CoordinateSystemUtils::ConvertToInteger(x), _CoordinateSystemUtils::ConvertToInteger(y), pText, textLength, outlineColor);
-}
-
-result
-TextUtility::GetTextExtent(_Font* pFont, const wchar_t* pText, int textLength, bool outline, int& width, int& height)
+TextUtility::GetTextExtent(_FontImpl* pFont, const wchar_t* pText, int textLength, bool outline, float& width, float& height)
{
SysTryReturn(NID_GRP, pFont && pText, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
result r = E_SUCCESS;
- Dimension lineDimension;
+ FloatDimension lineDimension;
+ _FloatPair currentGap;
+ Tizen::Base::Collection::ArrayListT<_FloatPair> gapList;
+ Tizen::Base::Collection::IEnumeratorT<_FloatPair >* pEnum = null;
- // [TODO] use before _Font::GetTextExtent is working properly.
-#if defined (EXTENT_BIDI_LIST)
- _Util::AccumList<_Util::Pair<int, int> > gaptList;
+ r = pFont->GetTextExtentList(pText, 0, textLength, gapList);
+ SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- r = pFont->GetTextExtentList(_Util::String(pText, textLength), gaptList);
- for (_Util::AccumList<_Util::Pair<int, int> >::Iterator iterator = gaptList.Begin(); iterator != gaptList.End(); iterator++)
- {
- lineDimension.width = (lineDimension.width < iterator->second) ? iterator->second : lineDimension.width;
- }
+ pEnum = gapList.GetEnumeratorN();
-#else
- r = pFont->GetTextExtent(_Util::String(pText, textLength), lineDimension);
-#endif
+ while (pEnum->MoveNext() == E_SUCCESS)
+ {
+ pEnum->GetCurrent(currentGap);
- SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ lineDimension.width = (lineDimension.width < currentGap.second) ? currentGap.second : lineDimension.width;
+ }
width = lineDimension.width;
- height = pFont->GetLeading().ToInt();
+ height = pFont->GetLeadingF();
+ Release(pEnum);
return E_SUCCESS;
CATCH:
width = 0;
height = 0;
+
+ Release(pEnum);
return r;
}
result
-TextUtility::GetTextExtent(Font* pFont, const wchar_t* pText, int textLength, bool outline, int& width, int& height)
+TextUtility::GetTextExtent(Font* pFont, const wchar_t* pText, int textLength, bool outline, float& width, float& height)
{
SysTryReturn(NID_GRP, pFont && pText, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
result r = E_SUCCESS;
int count = 0;
- Dimension lineDimension;
+ FloatDimension lineDimension;
- _Font* pNativeFont = _Font::GetInstance(*_FontImpl::GetInstance(*pFont));
- SysTryReturn(NID_GRP, pNativeFont, -1, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
+ _FontImpl* pFontImpl = _FontImpl::GetInstance(*pFont);
+ SysTryReturn(NID_GRP, pFontImpl, -1, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
- r = pNativeFont->GetTextExtent((Integer::VALUE_MAX >> 1) - 1, _Util::String(pText, textLength), outline, L"", count, lineDimension);
+ r = pFontImpl->GetTextExtent((Integer::VALUE_MAX / 2.0f) - 1, pText, textLength, outline, L"", count, lineDimension);
SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
width = lineDimension.width;
- height = pNativeFont->GetLeading().ToInt();
+ height = pFontImpl->GetLeadingF();
return E_SUCCESS;
return r;
}
-result
-TextUtility::GetTextExtent(_Font* pFont, const wchar_t* pText, int textLength, bool outline, float& width, float& height)
-{
- result r = E_SUCCESS;
- int iWidth = 0;
- int iHeight = 0;
- r = GetTextExtent(pFont, pText, textLength, outline, iWidth, iHeight);
- width = _CoordinateSystemUtils::ConvertToFloat(iWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(iHeight);
-
- return r;
-}
-
-result
-TextUtility::GetTextExtent(Font* pFont, const wchar_t* pText, int textLength, bool outline, float& width, float& height)
-{
- result r = E_SUCCESS;
- int iWidth = 0;
- int iHeight = 0;
- r = GetTextExtent(pFont, pText, textLength, outline, iWidth, iHeight);
- width = _CoordinateSystemUtils::ConvertToFloat(iWidth);
- height = _CoordinateSystemUtils::ConvertToFloat(iHeight);
-
- return r;
-}
-
-}}} // Tizen::Graphics::_Text
+}}} // Tizen::Graphics::_Texts
#ifndef _FGRP_INTERNAL_TEXT_UTILITY_H_
#define _FGRP_INTERNAL_TEXT_UTILITY_H_
-#include "../FGrp_Font.h"
+#include "FGrp_CanvasImpl.h"
+#include "FGrp_FontImpl.h"
#include "FGrp_TextCommon.h"
namespace Tizen { namespace Graphics
static int GetFontMaxHeight(Font* pFont);
- static int GetFontMaxHeight(_Font* pFont);
+ static int GetFontMaxHeight(_FontImpl* pFont);
static float GetFontMaxHeightF(Font* pFont);
- static float GetFontMaxHeightF(_Font* pFont);
+ static float GetFontMaxHeightF(_FontImpl* pFont);
static int GetTextLength(const wchar_t* pText);
- static int GetCharCountInWidth(_Font* pFont, const wchar_t* pText, int textLength, int maxWidth, bool outline, int& width, int& height);
+ static int GetCharCountInWidth(_FontImpl* pFont, const wchar_t* pText, int textLength, float maxWidth, bool outline, float& width, float& height);
- static int GetCharCountInWidth(_Font* pFont, const wchar_t* pText, int textLength, float maxWidth, bool outline, float& width, float& height);
-
- static result GetTextExtent(_Font* pFont, const wchar_t* pText, int textLength, bool outline, int& width, int& height);
-
- static result GetTextExtent(Font* pFont, const wchar_t* pText, int textLength, bool outline, int& width, int& height);
-
- static result GetTextExtent(_Font* pFont, const wchar_t* pText, int textLength, bool outline, float& width, float& height);
+ static result GetTextExtent(_FontImpl* pFont, const wchar_t* pText, int textLength, bool outline, float& width, float& height);
static result GetTextExtent(Font* pFont, const wchar_t* pText, int textLength, bool outline, float& width, float& height);
static result CopyText(wchar_t* pDstText, const wchar_t* pSrcText);
- static result DrawText(_Canvas& canvas, int x, int y, const wchar_t* pText, int textLength);
+ static result DrawText(_CanvasImpl& canvasImpl, int x, int y, const wchar_t* pText, int textLength);
- static result DrawText(_Canvas& canvas, float x, float y, const wchar_t* pText, int textLength);
+ static result DrawText(_CanvasImpl& canvasImpl, float x, float y, const wchar_t* pText, int textLength);
- static result DrawOutlineText(_Canvas& canvas, int x, int y, const wchar_t* pText, int textLength, Color outlineColor);
+ static result DrawOutlineText(_CanvasImpl& canvasImpl, int x, int y, const wchar_t* pText, int textLength, Color outlineColor);
- static result DrawOutlineText(_Canvas& canvas, float x, float y, const wchar_t* pText, int textLength, Color outlineColor);
+ static result DrawOutlineText(_CanvasImpl& canvasImpl, float x, float y, const wchar_t* pText, int textLength, Color outlineColor);
}; // TextUtility
struct TextLineComposeInfo
{
int length;
- int width;
- int height;
+ float width;
+ float height;
int endType;
};